Class: ShibRack::DevelopmentHandler
- Inherits:
-
Handler
- Object
- Handler
- ShibRack::DevelopmentHandler
show all
- Defined in:
- lib/shib_rack/development_handler.rb
Overview
Handler for authenticating to an application in development mode, using sample identities for local testing.
Class Attribute Summary collapse
Attributes inherited from Handler
#error_handler
Class Method Summary
collapse
Instance Method Summary
collapse
Methods inherited from Handler
#handle, #initialize
Class Attribute Details
.identities ⇒ Object
13
14
15
|
# File 'lib/shib_rack/development_handler.rb', line 13
def identities
@identities ||= load_identities
end
|
.login_redirect(env) ⇒ Object
17
18
19
|
# File 'lib/shib_rack/development_handler.rb', line 17
def login_redirect(env)
@login_redirect ||= "#{env['SCRIPT_NAME']}/development"
end
|
Class Method Details
.load_identities ⇒ Object
25
26
27
28
29
30
31
32
|
# File 'lib/shib_rack/development_handler.rb', line 25
def load_identities
require 'yaml'
yaml = File.read(File.expand_path('identities.yml', __dir__))
YAML.safe_load(yaml)['identities'].map do |identity|
identity.reduce({}) { |a, (k, v)| a.merge("HTTP_#{k.upcase}" => v) }
end
end
|
.resolve_identity(shared_token) ⇒ Object
21
22
23
|
# File 'lib/shib_rack/development_handler.rb', line 21
def resolve_identity(shared_token)
identities.find { |i| i['HTTP_AUEDUPERSONSHAREDTOKEN'] == shared_token }
end
|
Instance Method Details
#call(env) ⇒ Object
35
36
37
38
39
40
41
42
43
44
|
# File 'lib/shib_rack/development_handler.rb', line 35
def call(env)
case env['PATH_INFO']
when '/login'
login(env)
when '/development'
development
else
super
end
end
|