Class: ShibRack::Handler
- Inherits:
-
Object
- Object
- ShibRack::Handler
- Defined in:
- lib/shib_rack/handler.rb
Overview
Rack application which handles incoming sessions authenticated by Shibboleth SP.
Direct Known Subclasses
Instance Attribute Summary collapse
-
#error_handler ⇒ Object
readonly
Returns the value of attribute error_handler.
Instance Method Summary collapse
- #call(env) ⇒ Object
- #handle(_env, _exception) ⇒ Object
-
#initialize(opts) ⇒ Handler
constructor
A new instance of Handler.
Constructor Details
#initialize(opts) ⇒ Handler
Returns a new instance of Handler.
9 10 11 12 |
# File 'lib/shib_rack/handler.rb', line 9 def initialize(opts) @receiver = constantize(opts[:receiver]) @error_handler = constantize(opts[:error_handler])&.new || self end |
Instance Attribute Details
#error_handler ⇒ Object (readonly)
Returns the value of attribute error_handler.
7 8 9 |
# File 'lib/shib_rack/handler.rb', line 7 def error_handler @error_handler end |
Instance Method Details
#call(env) ⇒ Object
14 15 16 17 18 19 |
# File 'lib/shib_rack/handler.rb', line 14 def call(env) return login(env) if env['PATH_INFO'] == '/login' return logout(env) if env['PATH_INFO'] == '/logout' [404, {}, ["Not found: #{env['PATH_INFO']}"]] end |
#handle(_env, _exception) ⇒ Object
21 22 23 24 25 26 27 28 29 |
# File 'lib/shib_rack/handler.rb', line 21 def handle(_env, _exception) [ 400, { 'content-type' => 'text/plain' }, [ 'Sorry, your attempt to log in to this service was not successful. ', 'Please contact the service owner for assistance, and include the ', 'link you used to access this service.' ] ] end |