Class: SesDashboard::Auth::Base
- Inherits:
-
Object
- Object
- SesDashboard::Auth::Base
show all
- Defined in:
- lib/ses_dashboard/auth/base.rb
Instance Method Summary
collapse
Constructor Details
#initialize(app = nil) ⇒ Base
Returns a new instance of Base.
7
8
9
|
# File 'lib/ses_dashboard/auth/base.rb', line 7
def initialize(app = nil)
@app = app
end
|
Instance Method Details
#authenticate(request = nil) ⇒ Object
11
12
13
|
# File 'lib/ses_dashboard/auth/base.rb', line 11
def authenticate(request = nil)
raise NotImplementedError, "Auth adapter must implement authenticate(request)"
end
|
#call(env) ⇒ Object
15
16
17
18
19
20
21
22
|
# File 'lib/ses_dashboard/auth/base.rb', line 15
def call(env)
request = Rack::Request.new(env)
if authenticate(request)
@app.call(env)
else
unauthorized_response
end
end
|