bsm-sso-client 0.4.0 → 0.4.1

Sign up to get free protection for your applications and to get access to all the features.
@@ -15,6 +15,7 @@ module Bsm
15
15
  autoload :UserMethods, 'bsm/sso/client/user_methods'
16
16
  autoload :UrlHelpers, 'bsm/sso/client/url_helpers'
17
17
  autoload :FailureApp, 'bsm/sso/client/failure_app'
18
+ autoload :Cached, 'bsm/sso/client/cached'
18
19
 
19
20
  mattr_accessor :secret
20
21
  @@secret = nil
@@ -0,0 +1,3 @@
1
+ module Bsm::Sso::Client::Cached
2
+ autoload :ActiveRecord, "bsm/sso/client/cached/active_record"
3
+ end
@@ -0,0 +1,31 @@
1
+ require 'active_record/base'
2
+ require 'active_support/concern'
3
+
4
+ module Bsm::Sso::Client::Cached::ActiveRecord
5
+ extend ActiveSupport::Concern
6
+ include Bsm::Sso::Client::UserMethods
7
+
8
+ included do
9
+ validates :id, :presence => true, :on => :create
10
+ attr_accessible :id, :email, :kind, :level, :as => :sso
11
+ end
12
+
13
+ module ClassMethods
14
+
15
+ # Retrieve cached
16
+ def sso_find(id)
17
+ where(:id => id).first || super
18
+ end
19
+
20
+ # Cache!
21
+ def sso_cache(resource, action = nil)
22
+ if record = where(:id => resource.id).first
23
+ record.update_attributes! resource.attributes, :as => :sso
24
+ record
25
+ else
26
+ create! resource.attributes, :as => :sso
27
+ end
28
+ end
29
+
30
+ end
31
+ end
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.0
4
+ version: 0.4.1
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,11 +9,11 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2011-10-28 00:00:00.000000000Z
12
+ date: 2011-10-31 00:00:00.000000000Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: activeresource
16
- requirement: &19682760 !ruby/object:Gem::Requirement
16
+ requirement: &21801280 !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: *19682760
27
+ version_requirements: *21801280
28
28
  - !ruby/object:Gem::Dependency
29
29
  name: actionpack
30
- requirement: &19658260 !ruby/object:Gem::Requirement
30
+ requirement: &21798160 !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: *19658260
41
+ version_requirements: *21798160
42
42
  - !ruby/object:Gem::Dependency
43
43
  name: railties
44
- requirement: &19656340 !ruby/object:Gem::Requirement
44
+ requirement: &21794740 !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: *19656340
55
+ version_requirements: *21794740
56
56
  - !ruby/object:Gem::Dependency
57
57
  name: rails_warden
58
- requirement: &19653960 !ruby/object:Gem::Requirement
58
+ requirement: &21789080 !ruby/object:Gem::Requirement
59
59
  none: false
60
60
  requirements:
61
61
  - - ~>
@@ -63,10 +63,21 @@ dependencies:
63
63
  version: 0.5.0
64
64
  type: :runtime
65
65
  prerelease: false
66
- version_requirements: *19653960
66
+ version_requirements: *21789080
67
+ - !ruby/object:Gem::Dependency
68
+ name: activerecord
69
+ requirement: &21787900 !ruby/object:Gem::Requirement
70
+ none: false
71
+ requirements:
72
+ - - ! '>='
73
+ - !ruby/object:Gem::Version
74
+ version: '0'
75
+ type: :development
76
+ prerelease: false
77
+ version_requirements: *21787900
67
78
  - !ruby/object:Gem::Dependency
68
79
  name: rake
69
- requirement: &19653060 !ruby/object:Gem::Requirement
80
+ requirement: &21786920 !ruby/object:Gem::Requirement
70
81
  none: false
71
82
  requirements:
72
83
  - - ! '>='
@@ -74,10 +85,10 @@ dependencies:
74
85
  version: '0'
75
86
  type: :development
76
87
  prerelease: false
77
- version_requirements: *19653060
88
+ version_requirements: *21786920
78
89
  - !ruby/object:Gem::Dependency
79
90
  name: rack-test
80
- requirement: &19651900 !ruby/object:Gem::Requirement
91
+ requirement: &21785660 !ruby/object:Gem::Requirement
81
92
  none: false
82
93
  requirements:
83
94
  - - ! '>='
@@ -85,10 +96,10 @@ dependencies:
85
96
  version: '0'
86
97
  type: :development
87
98
  prerelease: false
88
- version_requirements: *19651900
99
+ version_requirements: *21785660
89
100
  - !ruby/object:Gem::Dependency
90
101
  name: rspec
91
- requirement: &19641500 !ruby/object:Gem::Requirement
102
+ requirement: &21784980 !ruby/object:Gem::Requirement
92
103
  none: false
93
104
  requirements:
94
105
  - - ! '>='
@@ -96,10 +107,10 @@ dependencies:
96
107
  version: '0'
97
108
  type: :development
98
109
  prerelease: false
99
- version_requirements: *19641500
110
+ version_requirements: *21784980
100
111
  - !ruby/object:Gem::Dependency
101
112
  name: shoulda-matchers
102
- requirement: &19640740 !ruby/object:Gem::Requirement
113
+ requirement: &21783920 !ruby/object:Gem::Requirement
103
114
  none: false
104
115
  requirements:
105
116
  - - ! '>='
@@ -107,10 +118,21 @@ dependencies:
107
118
  version: '0'
108
119
  type: :development
109
120
  prerelease: false
110
- version_requirements: *19640740
121
+ version_requirements: *21783920
111
122
  - !ruby/object:Gem::Dependency
112
123
  name: webmock
113
- requirement: &19639980 !ruby/object:Gem::Requirement
124
+ requirement: &21778920 !ruby/object:Gem::Requirement
125
+ none: false
126
+ requirements:
127
+ - - ! '>='
128
+ - !ruby/object:Gem::Version
129
+ version: '0'
130
+ type: :development
131
+ prerelease: false
132
+ version_requirements: *21778920
133
+ - !ruby/object:Gem::Dependency
134
+ name: sqlite3-ruby
135
+ requirement: &21778160 !ruby/object:Gem::Requirement
114
136
  none: false
115
137
  requirements:
116
138
  - - ! '>='
@@ -118,7 +140,7 @@ dependencies:
118
140
  version: '0'
119
141
  type: :development
120
142
  prerelease: false
121
- version_requirements: *19639980
143
+ version_requirements: *21778160
122
144
  description: ''
123
145
  email: dimitrij@blacksquaremedia.com
124
146
  executables: []
@@ -129,6 +151,7 @@ files:
129
151
  - lib/bsm/sso/client/strategies/ticket.rb
130
152
  - lib/bsm/sso/client/strategies/base.rb
131
153
  - lib/bsm/sso/client/strategies/http_auth.rb
154
+ - lib/bsm/sso/client/cached.rb
132
155
  - lib/bsm/sso/client/failure_app.rb
133
156
  - lib/bsm/sso/client/abstract_resource.rb
134
157
  - lib/bsm/sso/client/railtie.rb
@@ -137,6 +160,7 @@ files:
137
160
  - lib/bsm/sso/client/user.rb
138
161
  - lib/bsm/sso/client/warden_ext.rb
139
162
  - lib/bsm/sso/client/strategies.rb
163
+ - lib/bsm/sso/client/cached/active_record.rb
140
164
  - lib/bsm-sso-client.rb
141
165
  homepage: https://github.com/bsm/sso-client
142
166
  licenses: []