Sha256: 3801360608d114a45b3275b0bdb8c855652a28654e56de3ffa089568ffb5f0d8
Contents?: true
Size: 1.1 KB
Versions: 17
Compression:
Stored size: 1.1 KB
Contents
require "action_controller/metal" require 'rails' # Failure application that will be called every time :warden is thrown from # any strategy or hook. module GDS module SSO class FailureApp < ActionController::Metal include ActionController::RackDelegation include ActionController::UrlFor include ActionController::Redirecting include Rails.application.routes.url_helpers def self.call(env) if ! ::GDS::SSO::ApiAccess.api_call?(env) action(:redirect).call(env) end end def redirect store_location! redirect_to '/auth/gds' end # Stores requested uri to redirect the user after signing in. We cannot use # scoped session provided by warden here, since the user is not authenticated # yet, but we still need to store the uri based on scope, so different scopes # would never use the same uri to redirect. # TOTALLY NOT DOING THE SCOPE THING. PROBABLY SHOULD. def store_location! session["return_to"] = env['warden.options'][:attempted_path] if request.get? end end end end
Version data entries
17 entries across 17 versions & 1 rubygems