sso 0.1.0.alpha1 → 0.1.0.alpha2
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.
- checksums.yaml +4 -4
- data/lib/sso/benchmarking.rb +14 -0
- data/lib/sso/client.rb +7 -0
- data/lib/sso/client/README.md +92 -0
- data/lib/sso/client/omniauth/strategies/sso.rb +58 -0
- data/lib/sso/client/passport.rb +25 -0
- data/lib/sso/client/warden/hooks/after_fetch.rb +179 -0
- data/lib/sso/logging.rb +36 -0
- data/lib/sso/server.rb +26 -0
- data/lib/sso/server/README.md +13 -0
- data/lib/sso/server/authentications/passport.rb +170 -0
- data/lib/sso/server/configuration.rb +80 -0
- data/lib/sso/server/configure.rb +15 -0
- data/lib/sso/server/doorkeeper/access_token_marker.rb +111 -0
- data/lib/sso/server/doorkeeper/grant_marker.rb +85 -0
- data/lib/sso/server/doorkeeper/resource_owner_authenticator.rb +44 -0
- data/lib/sso/server/engine.rb +16 -0
- data/lib/sso/server/errors.rb +11 -0
- data/lib/sso/server/geolocations.rb +10 -0
- data/lib/sso/server/middleware/passport_verification.rb +30 -0
- data/lib/sso/server/passport.rb +92 -0
- data/lib/sso/server/passports.rb +148 -0
- data/lib/sso/server/warden/hooks/after_authentication.rb +47 -0
- data/lib/sso/server/warden/hooks/before_logout.rb +38 -0
- data/lib/sso/server/warden/strategies/passport.rb +39 -0
- metadata +25 -2
- data/lib/sso.rb +0 -6
@@ -0,0 +1,39 @@
|
|
1
|
+
module SSO
|
2
|
+
module Server
|
3
|
+
module Warden
|
4
|
+
module Strategies
|
5
|
+
class Passport < ::Warden::Strategies::Base
|
6
|
+
include ::SSO::Logging
|
7
|
+
|
8
|
+
def valid?
|
9
|
+
params['auth_version'].to_s != '' && params['state'] != ''
|
10
|
+
end
|
11
|
+
|
12
|
+
def authenticate!
|
13
|
+
debug { 'Authenticating from Passport...' }
|
14
|
+
|
15
|
+
authentication = nil
|
16
|
+
time = Benchmark.realtime do
|
17
|
+
authentication = ::SSO::Server::Authentications::Passport.new(request).authenticate
|
18
|
+
end
|
19
|
+
|
20
|
+
info { "The Passport verification took #{(time * 1000).round}ms" }
|
21
|
+
|
22
|
+
if authentication.success?
|
23
|
+
debug { 'Authentication from Passport successful.' }
|
24
|
+
debug { "Responding with #{authentication.object}" }
|
25
|
+
custom! authentication.object
|
26
|
+
else
|
27
|
+
debug { 'Authentication from Passport failed.' }
|
28
|
+
fail authentication.code
|
29
|
+
end
|
30
|
+
|
31
|
+
rescue => exception
|
32
|
+
::SSO.config.exception_handler.call exception
|
33
|
+
end
|
34
|
+
|
35
|
+
end
|
36
|
+
end
|
37
|
+
end
|
38
|
+
end
|
39
|
+
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: sso
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.0.
|
4
|
+
version: 0.1.0.alpha2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- halo
|
@@ -255,7 +255,30 @@ executables: []
|
|
255
255
|
extensions: []
|
256
256
|
extra_rdoc_files: []
|
257
257
|
files:
|
258
|
-
- lib/sso.rb
|
258
|
+
- lib/sso/benchmarking.rb
|
259
|
+
- lib/sso/client.rb
|
260
|
+
- lib/sso/client/README.md
|
261
|
+
- lib/sso/client/omniauth/strategies/sso.rb
|
262
|
+
- lib/sso/client/passport.rb
|
263
|
+
- lib/sso/client/warden/hooks/after_fetch.rb
|
264
|
+
- lib/sso/logging.rb
|
265
|
+
- lib/sso/server.rb
|
266
|
+
- lib/sso/server/README.md
|
267
|
+
- lib/sso/server/authentications/passport.rb
|
268
|
+
- lib/sso/server/configuration.rb
|
269
|
+
- lib/sso/server/configure.rb
|
270
|
+
- lib/sso/server/doorkeeper/access_token_marker.rb
|
271
|
+
- lib/sso/server/doorkeeper/grant_marker.rb
|
272
|
+
- lib/sso/server/doorkeeper/resource_owner_authenticator.rb
|
273
|
+
- lib/sso/server/engine.rb
|
274
|
+
- lib/sso/server/errors.rb
|
275
|
+
- lib/sso/server/geolocations.rb
|
276
|
+
- lib/sso/server/middleware/passport_verification.rb
|
277
|
+
- lib/sso/server/passport.rb
|
278
|
+
- lib/sso/server/passports.rb
|
279
|
+
- lib/sso/server/warden/hooks/after_authentication.rb
|
280
|
+
- lib/sso/server/warden/hooks/before_logout.rb
|
281
|
+
- lib/sso/server/warden/strategies/passport.rb
|
259
282
|
- spec/dummy/Rakefile
|
260
283
|
- spec/dummy/app/assets/javascripts/application.js
|
261
284
|
- spec/dummy/app/assets/stylesheets/application.css
|