bsm-sso-client 0.6.4 → 0.7.0
Sign up to get free protection for your applications and to get access to all the features.
data/lib/bsm/sso/client.rb
CHANGED
@@ -32,9 +32,6 @@ module Bsm
|
|
32
32
|
mattr_writer :user_class
|
33
33
|
@@user_class = nil
|
34
34
|
|
35
|
-
mattr_accessor :user_attributes
|
36
|
-
@@user_attributes = {}
|
37
|
-
|
38
35
|
mattr_accessor :warden_configuration
|
39
36
|
@@warden_configuration = nil
|
40
37
|
|
@@ -55,10 +52,6 @@ module Bsm
|
|
55
52
|
@@user_class || Bsm::Sso::Client::User
|
56
53
|
end
|
57
54
|
|
58
|
-
def user_instance
|
59
|
-
user_class.new(user_attributes)
|
60
|
-
end
|
61
|
-
|
62
55
|
# Default message verifier
|
63
56
|
def verifier
|
64
57
|
raise "Please configure a secret! Example: Bsm::Sso::Client.secret = '...'" unless secret.present?
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: bsm-sso-client
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.7.0
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2012-
|
12
|
+
date: 2012-07-09 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: activeresource
|
@@ -18,7 +18,7 @@ dependencies:
|
|
18
18
|
requirements:
|
19
19
|
- - ! '>='
|
20
20
|
- !ruby/object:Gem::Version
|
21
|
-
version: 3.
|
21
|
+
version: 3.2.0
|
22
22
|
type: :runtime
|
23
23
|
prerelease: false
|
24
24
|
version_requirements: !ruby/object:Gem::Requirement
|
@@ -26,7 +26,7 @@ dependencies:
|
|
26
26
|
requirements:
|
27
27
|
- - ! '>='
|
28
28
|
- !ruby/object:Gem::Version
|
29
|
-
version: 3.
|
29
|
+
version: 3.2.0
|
30
30
|
- !ruby/object:Gem::Dependency
|
31
31
|
name: actionpack
|
32
32
|
requirement: !ruby/object:Gem::Requirement
|
@@ -34,7 +34,7 @@ dependencies:
|
|
34
34
|
requirements:
|
35
35
|
- - ! '>='
|
36
36
|
- !ruby/object:Gem::Version
|
37
|
-
version: 3.
|
37
|
+
version: 3.2.0
|
38
38
|
type: :runtime
|
39
39
|
prerelease: false
|
40
40
|
version_requirements: !ruby/object:Gem::Requirement
|
@@ -42,7 +42,7 @@ dependencies:
|
|
42
42
|
requirements:
|
43
43
|
- - ! '>='
|
44
44
|
- !ruby/object:Gem::Version
|
45
|
-
version: 3.
|
45
|
+
version: 3.2.0
|
46
46
|
- !ruby/object:Gem::Dependency
|
47
47
|
name: railties
|
48
48
|
requirement: !ruby/object:Gem::Requirement
|
@@ -50,7 +50,7 @@ dependencies:
|
|
50
50
|
requirements:
|
51
51
|
- - ! '>='
|
52
52
|
- !ruby/object:Gem::Version
|
53
|
-
version: 3.
|
53
|
+
version: 3.2.0
|
54
54
|
type: :runtime
|
55
55
|
prerelease: false
|
56
56
|
version_requirements: !ruby/object:Gem::Requirement
|
@@ -58,7 +58,7 @@ dependencies:
|
|
58
58
|
requirements:
|
59
59
|
- - ! '>='
|
60
60
|
- !ruby/object:Gem::Version
|
61
|
-
version: 3.
|
61
|
+
version: 3.2.0
|
62
62
|
- !ruby/object:Gem::Dependency
|
63
63
|
name: rails_warden
|
64
64
|
requirement: !ruby/object:Gem::Requirement
|
@@ -194,7 +194,6 @@ extensions: []
|
|
194
194
|
extra_rdoc_files: []
|
195
195
|
files:
|
196
196
|
- lib/bsm/sso/client.rb
|
197
|
-
- lib/bsm/sso/client/strategies/api_token.rb
|
198
197
|
- lib/bsm/sso/client/strategies/ticket.rb
|
199
198
|
- lib/bsm/sso/client/strategies/base.rb
|
200
199
|
- lib/bsm/sso/client/strategies/http_auth.rb
|
@@ -1,49 +0,0 @@
|
|
1
|
-
class Bsm::Sso::Client::Strategies::APIToken < Bsm::Sso::Client::Strategies::HttpAuth
|
2
|
-
|
3
|
-
def self.verifier
|
4
|
-
@verifier ||= ActiveSupport::MessageVerifier.new(secret)
|
5
|
-
end
|
6
|
-
|
7
|
-
def self.secret=(value)
|
8
|
-
@verifier = nil
|
9
|
-
@secret = value
|
10
|
-
end
|
11
|
-
|
12
|
-
def self.secret
|
13
|
-
@secret ||= Bsm::Sso::Client.secret
|
14
|
-
end
|
15
|
-
|
16
|
-
def self.user_instance
|
17
|
-
Bsm::Sso::Client.user_instance
|
18
|
-
end
|
19
|
-
|
20
|
-
def api_format?
|
21
|
-
Bsm::Sso::Client.api_formats.include? request.format.try(:to_sym)
|
22
|
-
end
|
23
|
-
|
24
|
-
def valid?
|
25
|
-
api_format? && super && !!expiration
|
26
|
-
end
|
27
|
-
|
28
|
-
def authenticate!
|
29
|
-
if expiration >= Time.now
|
30
|
-
success!(user_instance)
|
31
|
-
else
|
32
|
-
fail!(:expired)
|
33
|
-
end
|
34
|
-
end
|
35
|
-
|
36
|
-
def expiration
|
37
|
-
return @expiration if defined?(@expiration)
|
38
|
-
|
39
|
-
@expiration = begin
|
40
|
-
result = self.class.verifier.verify(token)
|
41
|
-
result if result.acts_like?(:time)
|
42
|
-
rescue ActiveSupport::MessageVerifier::InvalidSignature
|
43
|
-
nil
|
44
|
-
end
|
45
|
-
end
|
46
|
-
|
47
|
-
Warden::Strategies.add :sso_api_token, self
|
48
|
-
end
|
49
|
-
|