Module: Doorkeeper::Request
- Defined in:
- lib/doorkeeper.rb,
lib/doorkeeper/request.rb,
lib/doorkeeper/request/code.rb,
lib/doorkeeper/request/token.rb,
lib/doorkeeper/request/password.rb,
lib/doorkeeper/request/strategy.rb,
lib/doorkeeper/request/refresh_token.rb,
lib/doorkeeper/request/authorization_code.rb,
lib/doorkeeper/request/client_credentials.rb
Defined Under Namespace
Classes: AuthorizationCode, ClientCredentials, Code, Password, RefreshToken, Strategy, Token
Class Method Summary
collapse
Class Method Details
.authorization_strategy(response_type) ⇒ Object
6
7
8
9
10
11
12
13
14
15
16
17
18
|
# File 'lib/doorkeeper/request.rb', line 6
def authorization_strategy(response_type)
grant_flow = authorization_flows.detect do |flow|
flow.matches_response_type?(response_type)
end
if grant_flow
grant_flow.response_type_strategy
else
build_fallback_strategy_class(response_type)
end
end
|
.token_strategy(grant_type) ⇒ Object
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
|
# File 'lib/doorkeeper/request.rb', line 20
def token_strategy(grant_type)
raise Errors::MissingRequiredParameter, :grant_type if grant_type.blank?
grant_flow = token_flows.detect do |flow|
flow.matches_grant_type?(grant_type)
end
if grant_flow
grant_flow.grant_type_strategy
else
raise Errors::InvalidTokenStrategy unless available.include?(grant_type.to_s)
strategy_class = build_fallback_strategy_class(grant_type)
raise Errors::InvalidTokenStrategy unless strategy_class
strategy_class
end
end
|