bsm-sso-client 0.4.3 → 0.4.4
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/bsm/sso/client.rb +15 -0
- data/lib/bsm/sso/client/railtie.rb +6 -19
- metadata +24 -24
data/lib/bsm/sso/client.rb
CHANGED
@@ -26,6 +26,9 @@ module Bsm
|
|
26
26
|
mattr_writer :user_class
|
27
27
|
@@user_class = nil
|
28
28
|
|
29
|
+
mattr_accessor :warden_configuration
|
30
|
+
@@warden_configuration = nil
|
31
|
+
|
29
32
|
class << self
|
30
33
|
|
31
34
|
delegate :site=, :site, :to => :"Bsm::Sso::Client::AbstractResource"
|
@@ -51,6 +54,18 @@ module Bsm
|
|
51
54
|
tap(&block)
|
52
55
|
end
|
53
56
|
|
57
|
+
# Warden configuration. Example:
|
58
|
+
#
|
59
|
+
# # config/initializers/sso.rb
|
60
|
+
# Bsm::Sso::Client.configure do |c|
|
61
|
+
# c.warden do |manager|
|
62
|
+
# manager.default_strategies << :my_strategy
|
63
|
+
# end
|
64
|
+
# end
|
65
|
+
def warden(&block)
|
66
|
+
@@warden_configuration = block
|
67
|
+
end
|
68
|
+
|
54
69
|
# Raises an UnauthorizedAccess exception
|
55
70
|
def forbidden!(request, message = nil)
|
56
71
|
message ||= "You are not permitted to access the resource in #{request.path}"
|
@@ -3,29 +3,16 @@ require 'rails'
|
|
3
3
|
|
4
4
|
class Bsm::Sso::Client::Railtie < ::Rails::Railtie
|
5
5
|
|
6
|
-
|
7
|
-
|
6
|
+
config.app_middleware.use RailsWarden::Manager do |manager|
|
7
|
+
manager.default_strategies :sso_ticket, :sso_http_auth
|
8
|
+
manager.failure_app = Bsm::Sso::Client::FailureApp
|
9
|
+
Bsm::Sso::Client.warden_configuration.call(manager) if Bsm::Sso::Client.warden_configuration
|
8
10
|
end
|
9
11
|
|
10
12
|
config.after_initialize do
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
def self.insert_middleware!(app)
|
15
|
-
app.config.middleware.use RailsWarden::Manager do |manager|
|
16
|
-
manager.default_strategies :sso_ticket, :sso_http_auth
|
17
|
-
manager.failure_app = Bsm::Sso::Client::FailureApp
|
13
|
+
if defined?(::ActionDispatch::ShowExceptions)
|
14
|
+
ActionDispatch::ShowExceptions.rescue_responses.update("Bsm::Sso::Client::UnauthorizedAccess" => :forbidden)
|
18
15
|
end
|
19
16
|
end
|
20
17
|
|
21
|
-
def self.handle_exceptions!
|
22
|
-
return unless defined?(::ActionDispatch::ShowExceptions)
|
23
|
-
ActionDispatch::ShowExceptions.rescue_responses.update("Bsm::Sso::Client::UnauthorizedAccess" => :forbidden)
|
24
|
-
end
|
25
|
-
|
26
|
-
def self.plugin!(app)
|
27
|
-
insert_middleware!(app)
|
28
|
-
handle_exceptions!
|
29
|
-
end
|
30
|
-
|
31
18
|
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.
|
4
|
+
version: 0.4.4
|
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-
|
12
|
+
date: 2011-11-28 00:00:00.000000000Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: activeresource
|
16
|
-
requirement: &
|
16
|
+
requirement: &18658560 !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: *
|
27
|
+
version_requirements: *18658560
|
28
28
|
- !ruby/object:Gem::Dependency
|
29
29
|
name: actionpack
|
30
|
-
requirement: &
|
30
|
+
requirement: &18643480 !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: *
|
41
|
+
version_requirements: *18643480
|
42
42
|
- !ruby/object:Gem::Dependency
|
43
43
|
name: railties
|
44
|
-
requirement: &
|
44
|
+
requirement: &18641160 !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: *
|
55
|
+
version_requirements: *18641160
|
56
56
|
- !ruby/object:Gem::Dependency
|
57
57
|
name: rails_warden
|
58
|
-
requirement: &
|
58
|
+
requirement: &18640320 !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: *
|
66
|
+
version_requirements: *18640320
|
67
67
|
- !ruby/object:Gem::Dependency
|
68
68
|
name: activerecord
|
69
|
-
requirement: &
|
69
|
+
requirement: &18639760 !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: *
|
77
|
+
version_requirements: *18639760
|
78
78
|
- !ruby/object:Gem::Dependency
|
79
79
|
name: rake
|
80
|
-
requirement: &
|
80
|
+
requirement: &18639060 !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: *
|
88
|
+
version_requirements: *18639060
|
89
89
|
- !ruby/object:Gem::Dependency
|
90
90
|
name: rack-test
|
91
|
-
requirement: &
|
91
|
+
requirement: &18638400 !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: *
|
99
|
+
version_requirements: *18638400
|
100
100
|
- !ruby/object:Gem::Dependency
|
101
101
|
name: rspec
|
102
|
-
requirement: &
|
102
|
+
requirement: &18637740 !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: *
|
110
|
+
version_requirements: *18637740
|
111
111
|
- !ruby/object:Gem::Dependency
|
112
112
|
name: shoulda-matchers
|
113
|
-
requirement: &
|
113
|
+
requirement: &18637260 !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: *
|
121
|
+
version_requirements: *18637260
|
122
122
|
- !ruby/object:Gem::Dependency
|
123
123
|
name: webmock
|
124
|
-
requirement: &
|
124
|
+
requirement: &18636840 !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: *
|
132
|
+
version_requirements: *18636840
|
133
133
|
- !ruby/object:Gem::Dependency
|
134
134
|
name: sqlite3-ruby
|
135
|
-
requirement: &
|
135
|
+
requirement: &18636400 !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: *
|
143
|
+
version_requirements: *18636400
|
144
144
|
description: ''
|
145
145
|
email: dimitrij@blacksquaremedia.com
|
146
146
|
executables: []
|