Class: CasrackTheAuthenticator::Simple
- Inherits:
-
Object
- Object
- CasrackTheAuthenticator::Simple
- Defined in:
- lib/casrack_the_authenticator/simple.rb
Overview
The most basic CAS client use-case: redirects to CAS if a middleware or endpoint beneath this one returns a 401 response. On successful redirection back from CAS, puts the username of the CAS user in the session under :cas_user
.
Instance Method Summary collapse
-
#call(env) ⇒ Array<Integer, Hash, #each>
Processes the CAS user if a “ticket” parameter is passed, then calls the underlying Rack application; if the result is a 401, redirects to CAS; otherwise, returns the response unchanged.
-
#initialize(app, options) ⇒ Simple
constructor
Create a new CAS middleware.
Constructor Details
#initialize(app, options) ⇒ Simple
Create a new CAS middleware.
19 20 21 22 |
# File 'lib/casrack_the_authenticator/simple.rb', line 19 def initialize(app, ) @app = app @configuration = CasrackTheAuthenticator::Configuration.new() end |
Instance Method Details
#call(env) ⇒ Array<Integer, Hash, #each>
Processes the CAS user if a “ticket” parameter is passed, then calls the underlying Rack application; if the result is a 401, redirects to CAS; otherwise, returns the response unchanged.
30 31 32 33 34 |
# File 'lib/casrack_the_authenticator/simple.rb', line 30 def call(env) request = Rack::Request.new(env) process_return_from_cas(request) redirect_on_401(request, @app.call(env)) end |