Class: CasrackTheAuthenticator::RequireCAS

Inherits:
Object
  • Object
show all
Defined in:
lib/casrack_the_authenticator/require_cas.rb

Instance Method Summary collapse

Constructor Details

#initialize(app) ⇒ RequireCAS

Create a new RequireCAS middleware, which requires users to log in via CAS for all requests, and returns a 401 Unauthorized if they aren’t signed in.

Parameters:

  • app

    the underlying Rack app.



10
11
12
# File 'lib/casrack_the_authenticator/require_cas.rb', line 10

def initialize(app)
  @app = app
end

Instance Method Details

#call(env) ⇒ Object



14
15
16
17
18
19
20
# File 'lib/casrack_the_authenticator/require_cas.rb', line 14

def call(env)
  if signed_in?(env)
    @app.call(env)
  else
    unauthorized
  end
end