Class: Doorkeeper::OAuth::PreAuthorization
- Inherits:
-
Object
- Object
- Doorkeeper::OAuth::PreAuthorization
- Includes:
- Validations
- Defined in:
- lib/doorkeeper/oauth/pre_authorization.rb
Instance Attribute Summary collapse
-
#authorization_response_flow ⇒ Object
readonly
Returns the value of attribute authorization_response_flow.
-
#client ⇒ Object
readonly
Returns the value of attribute client.
-
#code_challenge ⇒ Object
readonly
Returns the value of attribute code_challenge.
-
#code_challenge_method ⇒ Object
readonly
Returns the value of attribute code_challenge_method.
-
#custom_access_token_attributes ⇒ Object
readonly
Returns the value of attribute custom_access_token_attributes.
-
#invalid_request_reason ⇒ Object
readonly
Returns the value of attribute invalid_request_reason.
-
#missing_param ⇒ Object
readonly
Returns the value of attribute missing_param.
-
#redirect_uri ⇒ Object
readonly
Returns the value of attribute redirect_uri.
-
#resource_indicators ⇒ Object
readonly
Returns the value of attribute resource_indicators.
-
#resource_owner ⇒ Object
readonly
Returns the value of attribute resource_owner.
-
#response_mode ⇒ Object
readonly
Returns the value of attribute response_mode.
-
#response_type ⇒ Object
readonly
Returns the value of attribute response_type.
-
#state ⇒ Object
readonly
Returns the value of attribute state.
Attributes included from Validations
Instance Method Summary collapse
- #as_json(_options = nil) ⇒ Object
- #authorizable? ⇒ Boolean
- #error_response ⇒ Object
- #form_post_response? ⇒ Boolean
-
#initialize(server, parameters = {}, resource_owner = nil) ⇒ PreAuthorization
constructor
A new instance of PreAuthorization.
- #scope ⇒ Object
- #scopes ⇒ Object
Methods included from Validations
Constructor Details
#initialize(server, parameters = {}, resource_owner = nil) ⇒ PreAuthorization
Returns a new instance of PreAuthorization.
26 27 28 29 30 31 32 33 34 35 36 37 38 39 |
# File 'lib/doorkeeper/oauth/pre_authorization.rb', line 26 def initialize(server, parameters = {}, resource_owner = nil) @server = server @client_id = parameters[:client_id] @response_type = parameters[:response_type] @response_mode = parameters[:response_mode] @redirect_uri = parameters[:redirect_uri] @scope = parameters[:scope] @state = parameters[:state] @code_challenge = parameters[:code_challenge] @code_challenge_method = parameters[:code_challenge_method] @resource_owner = resource_owner @custom_access_token_attributes = parameters.slice(*Doorkeeper.config.custom_access_token_attributes).to_h @raw_resource_indicators = parameters[:resource] end |
Instance Attribute Details
#authorization_response_flow ⇒ Object (readonly)
Returns the value of attribute authorization_response_flow.
21 22 23 |
# File 'lib/doorkeeper/oauth/pre_authorization.rb', line 21 def @authorization_response_flow end |
#client ⇒ Object (readonly)
Returns the value of attribute client.
21 22 23 |
# File 'lib/doorkeeper/oauth/pre_authorization.rb', line 21 def client @client end |
#code_challenge ⇒ Object (readonly)
Returns the value of attribute code_challenge.
21 22 23 |
# File 'lib/doorkeeper/oauth/pre_authorization.rb', line 21 def code_challenge @code_challenge end |
#code_challenge_method ⇒ Object (readonly)
Returns the value of attribute code_challenge_method.
21 22 23 |
# File 'lib/doorkeeper/oauth/pre_authorization.rb', line 21 def code_challenge_method @code_challenge_method end |
#custom_access_token_attributes ⇒ Object (readonly)
Returns the value of attribute custom_access_token_attributes.
21 22 23 |
# File 'lib/doorkeeper/oauth/pre_authorization.rb', line 21 def custom_access_token_attributes @custom_access_token_attributes end |
#invalid_request_reason ⇒ Object (readonly)
Returns the value of attribute invalid_request_reason.
21 22 23 |
# File 'lib/doorkeeper/oauth/pre_authorization.rb', line 21 def invalid_request_reason @invalid_request_reason end |
#missing_param ⇒ Object (readonly)
Returns the value of attribute missing_param.
21 22 23 |
# File 'lib/doorkeeper/oauth/pre_authorization.rb', line 21 def missing_param @missing_param end |
#redirect_uri ⇒ Object (readonly)
Returns the value of attribute redirect_uri.
21 22 23 |
# File 'lib/doorkeeper/oauth/pre_authorization.rb', line 21 def redirect_uri @redirect_uri end |
#resource_indicators ⇒ Object (readonly)
Returns the value of attribute resource_indicators.
21 22 23 |
# File 'lib/doorkeeper/oauth/pre_authorization.rb', line 21 def resource_indicators @resource_indicators end |
#resource_owner ⇒ Object (readonly)
Returns the value of attribute resource_owner.
21 22 23 |
# File 'lib/doorkeeper/oauth/pre_authorization.rb', line 21 def resource_owner @resource_owner end |
#response_mode ⇒ Object (readonly)
Returns the value of attribute response_mode.
21 22 23 |
# File 'lib/doorkeeper/oauth/pre_authorization.rb', line 21 def response_mode @response_mode end |
#response_type ⇒ Object (readonly)
Returns the value of attribute response_type.
21 22 23 |
# File 'lib/doorkeeper/oauth/pre_authorization.rb', line 21 def response_type @response_type end |
#state ⇒ Object (readonly)
Returns the value of attribute state.
21 22 23 |
# File 'lib/doorkeeper/oauth/pre_authorization.rb', line 21 def state @state end |
Instance Method Details
#as_json(_options = nil) ⇒ Object
72 73 74 |
# File 'lib/doorkeeper/oauth/pre_authorization.rb', line 72 def as_json( = nil) pre_auth_hash end |
#authorizable? ⇒ Boolean
41 42 43 |
# File 'lib/doorkeeper/oauth/pre_authorization.rb', line 41 def valid? end |
#error_response ⇒ Object
53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 |
# File 'lib/doorkeeper/oauth/pre_authorization.rb', line 53 def error_response # RFC 9207: authorization error responses advertise the issuer. Passing # the configured issuer here (nil when unset) scopes the iss parameter # to the authorization endpoint only. if error == Errors::InvalidRequest OAuth::InvalidRequestResponse.from_request( self, response_on_fragment: response_on_fragment?, issuer: Doorkeeper.config.issuer, ) else OAuth::ErrorResponse.from_request( self, response_on_fragment: response_on_fragment?, issuer: Doorkeeper.config.issuer, ) end end |
#form_post_response? ⇒ Boolean
76 77 78 |
# File 'lib/doorkeeper/oauth/pre_authorization.rb', line 76 def form_post_response? response_mode == "form_post" end |
#scope ⇒ Object
49 50 51 |
# File 'lib/doorkeeper/oauth/pre_authorization.rb', line 49 def scope @scope.presence || (server.default_scopes.presence && build_scopes) end |
#scopes ⇒ Object
45 46 47 |
# File 'lib/doorkeeper/oauth/pre_authorization.rb', line 45 def scopes Scopes.from_string(scope) end |