Class: SSO::Client::Warden::Strategies::Passport

Inherits:
Warden::Strategies::Base
  • Object
show all
Includes:
Benchmarking, Logging
Defined in:
lib/sso/client/warden/strategies/passport.rb

Overview

When the iPhone presents a Passport to Alpha, this is how Alpha verifies it with Bouncer.

Instance Method Summary collapse

Methods included from Benchmarking

#benchmark

Methods included from Logging

#debug, #error, #fatal, #info, #logger, #progname, #warn

Instance Method Details

#authenticate!Object



14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
# File 'lib/sso/client/warden/strategies/passport.rb', line 14

def authenticate!
  debug { 'Authenticating from Passport...' }

  authentication = passport_authentication

  if authentication.success?
    debug { 'Authentication on Client from Passport successful.' }
    debug { "Persisting trusted Passport #{authentication.object.inspect}" }
    success! authentication.object
  else
    debug { 'Authentication from Passport failed.' }
    debug { "Responding with #{authentication.object.inspect}" }
    custom! authentication.object
  end

rescue => exception
  ::SSO.config.exception_handler.call exception
end

#passport_authenticationObject



33
34
35
36
37
# File 'lib/sso/client/warden/strategies/passport.rb', line 33

def passport_authentication
  benchmark 'Passport proxy verification' do
    ::SSO::Client::Authentications::Passport.new(request).authenticate
  end
end

#valid?Boolean

Returns:

  • (Boolean)


10
11
12
# File 'lib/sso/client/warden/strategies/passport.rb', line 10

def valid?
  params['auth_version'].to_s != '' && params['state'] != ''
end