9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
|
# File 'lib/warden/oauth2/failure_app.rb', line 9
def call(env)
warden = env['warden']
strategy = warden.winning_strategy
= {'Content-Type' => 'application/json'}
body = {}
if strategy
error_description = strategy.respond_to?(:error_description) ? strategy.error_description : ''
body[:error] = strategy.message
body[:error_description] = error_description
status = strategy.error_status
['X-Accepted-OAuth-Scopes'] = (strategy.scope || :public).to_s
else
status = 400
body[:error] = 'invalid_request'
body[:error_description] = 'cannot determine authentication method'
end
[status, , [JSON.dump(body)]]
end
|