Class: Intra::OmniAuthFailureApp

Inherits:
Object
  • Object
show all
Defined in:
lib/intra/omniauth_failure_app.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(env) ⇒ OmniAuthFailureApp

Returns a new instance of OmniAuthFailureApp.



5
6
7
# File 'lib/intra/omniauth_failure_app.rb', line 5

def initialize(env)
  @env = env
end

Instance Attribute Details

#envObject (readonly)

Returns the value of attribute env.



3
4
5
# File 'lib/intra/omniauth_failure_app.rb', line 3

def env
  @env
end

Instance Method Details

#callObject



9
10
11
12
# File 'lib/intra/omniauth_failure_app.rb', line 9

def call
  Logger.logger.info "OmniAuthFailureApp #{message_key}=#{error_description}"
  Rack::Response.new(['302 Moved'], 302, 'Location' => new_path).finish
end

#error_descriptionObject



23
24
25
# File 'lib/intra/omniauth_failure_app.rb', line 23

def error_description
  Rack::Utils.escape(env['omniauth.error'].error_reason)
end

#message_keyObject



19
20
21
# File 'lib/intra/omniauth_failure_app.rb', line 19

def message_key
  env['omniauth.error.type']
end

#new_pathObject



14
15
16
17
# File 'lib/intra/omniauth_failure_app.rb', line 14

def new_path
  "#{env['SCRIPT_NAME']}#{OmniAuth.config.path_prefix}/failure?" \
    "message=#{message_key}&error_description=#{error_description}"
end