Class: Warden::OAuth2::FailureApp
- Inherits:
-
Object
- Object
- Warden::OAuth2::FailureApp
- Defined in:
- lib/warden/oauth2/failure_app.rb
Class Method Summary collapse
Instance Method Summary collapse
Class Method Details
.call(env) ⇒ Object
4 5 6 |
# File 'lib/warden/oauth2/failure_app.rb', line 4 def self.call(env) new.call(env) end |
Instance Method Details
#call(env) ⇒ Object
8 9 10 11 12 13 14 15 16 17 18 19 |
# File 'lib/warden/oauth2/failure_app.rb', line 8 def call(env) warden = env['warden'] strategy = warden.winning_strategy body = '{"error":"' + strategy..to_s + '"}' status = strategy.error_status rescue 401 headers = {'Content-Type' => 'application/json'} headers['X-Accepted-OAuth-Scopes'] = (strategy.scope || :public).to_s [status, headers, [body]] end |