class SSO::Server::Middleware::PassportVerification

Public Class Methods

new(app) click to toggle source
# File lib/sso/server/middleware/passport_verification.rb, line 7
def initialize(app)
  @app = app
end

Public Instance Methods

call(env) click to toggle source
# File lib/sso/server/middleware/passport_verification.rb, line 11
def call(env)
  request = Rack::Request.new(env)

  if request.get? && request.path == passports_path
    debug { 'Detected incoming Passport verification request.' }
    env['warden'].authenticate! :passport
  else
    debug { "I'm not interested in this #{request.request_method.inspect} request to #{request.path.inspect} I only care for GET #{passports_path.inspect}" }
    @app.call(env)
  end
end
passports_path() click to toggle source
# File lib/sso/server/middleware/passport_verification.rb, line 23
def passports_path
  ::OmniAuth::Strategies::SSO.passports_path
end