Class: Doorkeeper::OAuth::TokenRequest
- Inherits:
-
Object
- Object
- Doorkeeper::OAuth::TokenRequest
- Defined in:
- lib/doorkeeper/oauth/token_request.rb
Instance Attribute Summary collapse
-
#client ⇒ Object
Returns the value of attribute client.
-
#pre_auth ⇒ Object
Returns the value of attribute pre_auth.
-
#resource_owner ⇒ Object
Returns the value of attribute resource_owner.
Instance Method Summary collapse
- #authorize ⇒ Object
- #deny ⇒ Object
-
#initialize(pre_auth, resource_owner) ⇒ TokenRequest
constructor
A new instance of TokenRequest.
Constructor Details
#initialize(pre_auth, resource_owner) ⇒ TokenRequest
Returns a new instance of TokenRequest.
6 7 8 9 10 |
# File 'lib/doorkeeper/oauth/token_request.rb', line 6 def initialize(pre_auth, resource_owner) @pre_auth = pre_auth @client = pre_auth.client @resource_owner = resource_owner end |
Instance Attribute Details
#client ⇒ Object
Returns the value of attribute client.
4 5 6 |
# File 'lib/doorkeeper/oauth/token_request.rb', line 4 def client @client end |
#pre_auth ⇒ Object
Returns the value of attribute pre_auth.
4 5 6 |
# File 'lib/doorkeeper/oauth/token_request.rb', line 4 def pre_auth @pre_auth end |
#resource_owner ⇒ Object
Returns the value of attribute resource_owner.
4 5 6 |
# File 'lib/doorkeeper/oauth/token_request.rb', line 4 def resource_owner @resource_owner end |
Instance Method Details
#authorize ⇒ Object
12 13 14 15 16 17 18 19 20 |
# File 'lib/doorkeeper/oauth/token_request.rb', line 12 def @response = if pre_auth. auth = Authorization::Token.new(pre_auth, resource_owner) auth.issue_token CodeResponse.new pre_auth, auth, :response_on_fragment => true else ErrorResponse.from_request pre_auth, :redirect_uri => pre_auth.redirect_uri, :response_on_fragment => true end end |
#deny ⇒ Object
22 23 24 25 |
# File 'lib/doorkeeper/oauth/token_request.rb', line 22 def deny pre_auth.error = :access_denied ErrorResponse.from_request(pre_auth, :redirect_uri => pre_auth.redirect_uri, :response_on_fragment => true) end |