bsm-sso-client 0.4.1 → 0.4.3

Sign up to get free protection for your applications and to get access to all the features.
@@ -7,7 +7,7 @@ module Bsm::Sso::Client::Cached::ActiveRecord
7
7
 
8
8
  included do
9
9
  validates :id, :presence => true, :on => :create
10
- attr_accessible :id, :email, :kind, :level, :as => :sso
10
+ attr_accessible :id, :email, :kind, :level, :authentication_token, :as => :sso
11
11
  end
12
12
 
13
13
  module ClassMethods
@@ -17,10 +17,20 @@ module Bsm::Sso::Client::Cached::ActiveRecord
17
17
  where(:id => id).first || super
18
18
  end
19
19
 
20
+ # Cache!
21
+ def sso_authorize(token)
22
+ return nil if token.blank?
23
+
24
+ relation = where(arel_table[:updated_at].gt(Bsm::Sso::Client.expire_after.ago))
25
+ relation = relation.where(:authentication_token => token)
26
+ relation.first || super
27
+ end
28
+
20
29
  # Cache!
21
30
  def sso_cache(resource, action = nil)
22
31
  if record = where(:id => resource.id).first
23
- record.update_attributes! resource.attributes, :as => :sso
32
+ record.assign_attributes resource.attributes, :as => :sso
33
+ record.changed? ? record.save! : record.touch
24
34
  record
25
35
  else
26
36
  create! resource.attributes, :as => :sso
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.1
4
+ version: 0.4.3
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -13,7 +13,7 @@ date: 2011-10-31 00:00:00.000000000Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: activeresource
16
- requirement: &21801280 !ruby/object:Gem::Requirement
16
+ requirement: &15632760 !ruby/object:Gem::Requirement
17
17
  none: false
18
18
  requirements:
19
19
  - - ! '>='
@@ -24,10 +24,10 @@ dependencies:
24
24
  version: 3.2.0
25
25
  type: :runtime
26
26
  prerelease: false
27
- version_requirements: *21801280
27
+ version_requirements: *15632760
28
28
  - !ruby/object:Gem::Dependency
29
29
  name: actionpack
30
- requirement: &21798160 !ruby/object:Gem::Requirement
30
+ requirement: &15630560 !ruby/object:Gem::Requirement
31
31
  none: false
32
32
  requirements:
33
33
  - - ! '>='
@@ -38,10 +38,10 @@ dependencies:
38
38
  version: 3.2.0
39
39
  type: :runtime
40
40
  prerelease: false
41
- version_requirements: *21798160
41
+ version_requirements: *15630560
42
42
  - !ruby/object:Gem::Dependency
43
43
  name: railties
44
- requirement: &21794740 !ruby/object:Gem::Requirement
44
+ requirement: &15628640 !ruby/object:Gem::Requirement
45
45
  none: false
46
46
  requirements:
47
47
  - - ! '>='
@@ -52,10 +52,10 @@ dependencies:
52
52
  version: 3.2.0
53
53
  type: :runtime
54
54
  prerelease: false
55
- version_requirements: *21794740
55
+ version_requirements: *15628640
56
56
  - !ruby/object:Gem::Dependency
57
57
  name: rails_warden
58
- requirement: &21789080 !ruby/object:Gem::Requirement
58
+ requirement: &15576160 !ruby/object:Gem::Requirement
59
59
  none: false
60
60
  requirements:
61
61
  - - ~>
@@ -63,10 +63,10 @@ dependencies:
63
63
  version: 0.5.0
64
64
  type: :runtime
65
65
  prerelease: false
66
- version_requirements: *21789080
66
+ version_requirements: *15576160
67
67
  - !ruby/object:Gem::Dependency
68
68
  name: activerecord
69
- requirement: &21787900 !ruby/object:Gem::Requirement
69
+ requirement: &15575540 !ruby/object:Gem::Requirement
70
70
  none: false
71
71
  requirements:
72
72
  - - ! '>='
@@ -74,10 +74,10 @@ dependencies:
74
74
  version: '0'
75
75
  type: :development
76
76
  prerelease: false
77
- version_requirements: *21787900
77
+ version_requirements: *15575540
78
78
  - !ruby/object:Gem::Dependency
79
79
  name: rake
80
- requirement: &21786920 !ruby/object:Gem::Requirement
80
+ requirement: &15574700 !ruby/object:Gem::Requirement
81
81
  none: false
82
82
  requirements:
83
83
  - - ! '>='
@@ -85,10 +85,10 @@ dependencies:
85
85
  version: '0'
86
86
  type: :development
87
87
  prerelease: false
88
- version_requirements: *21786920
88
+ version_requirements: *15574700
89
89
  - !ruby/object:Gem::Dependency
90
90
  name: rack-test
91
- requirement: &21785660 !ruby/object:Gem::Requirement
91
+ requirement: &15573140 !ruby/object:Gem::Requirement
92
92
  none: false
93
93
  requirements:
94
94
  - - ! '>='
@@ -96,10 +96,10 @@ dependencies:
96
96
  version: '0'
97
97
  type: :development
98
98
  prerelease: false
99
- version_requirements: *21785660
99
+ version_requirements: *15573140
100
100
  - !ruby/object:Gem::Dependency
101
101
  name: rspec
102
- requirement: &21784980 !ruby/object:Gem::Requirement
102
+ requirement: &15571820 !ruby/object:Gem::Requirement
103
103
  none: false
104
104
  requirements:
105
105
  - - ! '>='
@@ -107,10 +107,10 @@ dependencies:
107
107
  version: '0'
108
108
  type: :development
109
109
  prerelease: false
110
- version_requirements: *21784980
110
+ version_requirements: *15571820
111
111
  - !ruby/object:Gem::Dependency
112
112
  name: shoulda-matchers
113
- requirement: &21783920 !ruby/object:Gem::Requirement
113
+ requirement: &15570600 !ruby/object:Gem::Requirement
114
114
  none: false
115
115
  requirements:
116
116
  - - ! '>='
@@ -118,10 +118,10 @@ dependencies:
118
118
  version: '0'
119
119
  type: :development
120
120
  prerelease: false
121
- version_requirements: *21783920
121
+ version_requirements: *15570600
122
122
  - !ruby/object:Gem::Dependency
123
123
  name: webmock
124
- requirement: &21778920 !ruby/object:Gem::Requirement
124
+ requirement: &15532020 !ruby/object:Gem::Requirement
125
125
  none: false
126
126
  requirements:
127
127
  - - ! '>='
@@ -129,10 +129,10 @@ dependencies:
129
129
  version: '0'
130
130
  type: :development
131
131
  prerelease: false
132
- version_requirements: *21778920
132
+ version_requirements: *15532020
133
133
  - !ruby/object:Gem::Dependency
134
134
  name: sqlite3-ruby
135
- requirement: &21778160 !ruby/object:Gem::Requirement
135
+ requirement: &15530340 !ruby/object:Gem::Requirement
136
136
  none: false
137
137
  requirements:
138
138
  - - ! '>='
@@ -140,7 +140,7 @@ dependencies:
140
140
  version: '0'
141
141
  type: :development
142
142
  prerelease: false
143
- version_requirements: *21778160
143
+ version_requirements: *15530340
144
144
  description: ''
145
145
  email: dimitrij@blacksquaremedia.com
146
146
  executables: []