Class: Doorkeeper::TokensController
- Inherits:
-
ApplicationMetalController
- Object
- ApplicationMetalController
- Doorkeeper::TokensController
- Defined in:
- app/controllers/doorkeeper/tokens_controller.rb
Instance Method Summary collapse
- #create ⇒ Object
-
#introspect ⇒ Object
OAuth 2.0 Token Introspection - datatracker.ietf.org/doc/html/rfc7662.
-
#revoke ⇒ Object
OAuth 2.0 Token Revocation - datatracker.ietf.org/doc/html/rfc7009.
Instance Method Details
#create ⇒ Object
7 8 9 10 11 12 13 |
# File 'app/controllers/doorkeeper/tokens_controller.rb', line 7 def create headers.merge!(.headers) render json: .body, status: .status rescue Errors::DoorkeeperError => e handle_token_exception(e) end |
#introspect ⇒ Object
OAuth 2.0 Token Introspection - datatracker.ietf.org/doc/html/rfc7662
34 35 36 37 38 39 40 41 42 43 44 |
# File 'app/controllers/doorkeeper/tokens_controller.rb', line 34 def introspect introspection = OAuth::TokenIntrospection.new(server, token) if introspection. render json: introspection.to_json, status: 200 else error = introspection.error_response headers.merge!(error.headers) render json: error.body, status: error.status end end |
#revoke ⇒ Object
OAuth 2.0 Token Revocation - datatracker.ietf.org/doc/html/rfc7009
16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 |
# File 'app/controllers/doorkeeper/tokens_controller.rb', line 16 def revoke # The authorization server responds with HTTP status code 200 if the client # submitted an invalid token or the token has been revoked successfully. if token.blank? render json: {}, status: 200 # The authorization server validates [...] and whether the token # was issued to the client making the revocation request. If this # validation fails, the request is refused and the client is informed # of the error by the authorization server as described below. elsif revoke_token render json: {}, status: 200 else render json: revocation_error_response, status: :forbidden end end |