Class: SSO::Server::Warden::Strategies::Passport

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

Instance Method Summary collapse

Methods included from Benchmarking

#benchmark

Methods included from Meter

#caller_name, #metric, #timing, #track

Methods included from Logging

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

Instance Method Details

#authenticate!Object



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

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

  authentication = passport_authentication
  track key: 'server.warden.strategies.passport.authentication'

  if authentication.success?
    debug { 'Authentication on Server from Passport successful.' }
    debug { "Responding with #{authentication.object}" }
    track key: "server.warden.strategies.passport.#{authentication.code}"
    custom! authentication.object
  else
    debug { 'Authentication from Passport on Server failed.' }
    track key: "server.warden.strategies.passport.#{authentication.code}"
    custom! authentication.object
  end

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

#passport_authenticationObject



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

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

#valid?Boolean

Returns:

  • (Boolean)


9
10
11
# File 'lib/sso/server/warden/strategies/passport.rb', line 9

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