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.
@@ -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.alpha1
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
data/lib/sso.rb DELETED
@@ -1,6 +0,0 @@
1
- require 'sso/logging'
2
- require 'sso/benchmarking'
3
- require 'sso/client/omniauth/strategies/sso'
4
-
5
- module SSO
6
- end