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