snaury-thin-auth-ntlm 0.0.3 → 0.0.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/VERSION.yml +1 -1
- data/lib/thin/ntlm/connection.rb +21 -5
- data/thin-auth-ntlm.gemspec +2 -2
- metadata +2 -2
data/VERSION.yml
CHANGED
data/lib/thin/ntlm/connection.rb
CHANGED
@@ -34,6 +34,22 @@ END
|
|
34
34
|
@app.respond_to?(:deferred?) && @app.deferred?(env)
|
35
35
|
end
|
36
36
|
|
37
|
+
def persistent?
|
38
|
+
@connection.request.persistent?
|
39
|
+
end
|
40
|
+
|
41
|
+
def can_persist!
|
42
|
+
@connection.can_persist!
|
43
|
+
end
|
44
|
+
|
45
|
+
def ntlm_start
|
46
|
+
@connection.ntlm_start
|
47
|
+
end
|
48
|
+
|
49
|
+
def ntlm_stop
|
50
|
+
@connection.ntlm_stop
|
51
|
+
end
|
52
|
+
|
37
53
|
def call(env)
|
38
54
|
# check if browser wants to reauthenticate
|
39
55
|
if @authenticated_as && http_authorization(env)
|
@@ -42,11 +58,11 @@ END
|
|
42
58
|
|
43
59
|
# require authentication
|
44
60
|
unless @authenticated_as
|
45
|
-
|
61
|
+
ntlm_start
|
46
62
|
@authentication_stage ||= 1
|
47
63
|
result = process(env)
|
48
64
|
return result unless @authenticated_as
|
49
|
-
|
65
|
+
ntlm_stop
|
50
66
|
end
|
51
67
|
|
52
68
|
# pass thru
|
@@ -96,7 +112,7 @@ END
|
|
96
112
|
when 1 # we are waiting for type1 message
|
97
113
|
package, t1 = token(env)
|
98
114
|
return request_auth(NTLM_REQUEST_PACKAGE, false) if t1.nil?
|
99
|
-
return request_auth unless
|
115
|
+
return request_auth unless persistent?
|
100
116
|
begin
|
101
117
|
acquire(package)
|
102
118
|
t2 = @ntlm.accept_security_context(t1)
|
@@ -108,7 +124,7 @@ END
|
|
108
124
|
package, t3 = token(env)
|
109
125
|
return request_auth(NTLM_REQUEST_PACKAGE, false) if t3.nil?
|
110
126
|
return request_auth unless package == @ntlm.package
|
111
|
-
return request_auth unless
|
127
|
+
return request_auth unless persistent?
|
112
128
|
begin
|
113
129
|
t2 = @ntlm.accept_security_context(t3)
|
114
130
|
@authenticated_as = @ntlm.get_username_from_context
|
@@ -126,7 +142,7 @@ END
|
|
126
142
|
# Returns response with authentication request to the client
|
127
143
|
def request_auth(auth = nil, finished = true, next_stage = 1)
|
128
144
|
@authentication_stage = next_stage
|
129
|
-
|
145
|
+
can_persist! unless finished
|
130
146
|
head = {}
|
131
147
|
head[WWW_AUTHENTICATE] = auth if auth
|
132
148
|
head[CONTENT_TYPE] = CONTENT_TYPE_AUTH
|
data/thin-auth-ntlm.gemspec
CHANGED
@@ -5,11 +5,11 @@
|
|
5
5
|
|
6
6
|
Gem::Specification.new do |s|
|
7
7
|
s.name = %q{thin-auth-ntlm}
|
8
|
-
s.version = "0.0.
|
8
|
+
s.version = "0.0.4"
|
9
9
|
|
10
10
|
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
11
11
|
s.authors = ["Alexey Borzenkov"]
|
12
|
-
s.date = %q{2009-08-
|
12
|
+
s.date = %q{2009-08-13}
|
13
13
|
s.email = %q{snaury@gmail.com}
|
14
14
|
s.extra_rdoc_files = [
|
15
15
|
"LICENSE.txt",
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: snaury-thin-auth-ntlm
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Alexey Borzenkov
|
@@ -9,7 +9,7 @@ autorequire:
|
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
11
|
|
12
|
-
date: 2009-08-
|
12
|
+
date: 2009-08-13 00:00:00 -07:00
|
13
13
|
default_executable:
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|