Class: Doorkeeper::OAuth::TokenIntrospection
- Inherits:
-
Object
- Object
- Doorkeeper::OAuth::TokenIntrospection
- Defined in:
- lib/doorkeeper/oauth/token_introspection.rb
Overview
RFC7662 OAuth 2.0 Token Introspection
Instance Method Summary collapse
- #authorized? ⇒ Boolean
- #error_response ⇒ Object
-
#initialize(server, token) ⇒ TokenIntrospection
constructor
A new instance of TokenIntrospection.
- #to_json ⇒ Object
Constructor Details
#initialize(server, token) ⇒ TokenIntrospection
Returns a new instance of TokenIntrospection.
9 10 11 12 13 14 |
# File 'lib/doorkeeper/oauth/token_introspection.rb', line 9 def initialize(server, token) @server = server @token = token end |
Instance Method Details
#authorized? ⇒ Boolean
16 17 18 |
# File 'lib/doorkeeper/oauth/token_introspection.rb', line 16 def @error.blank? end |
#error_response ⇒ Object
20 21 22 23 24 25 26 27 28 29 30 |
# File 'lib/doorkeeper/oauth/token_introspection.rb', line 20 def error_response return if @error.blank? if @error == :invalid_token OAuth::InvalidTokenResponse.from_access_token() elsif @error == :invalid_request OAuth::InvalidRequestResponse.from_request(self) else OAuth::ErrorResponse.new(name: @error) end end |
#to_json ⇒ Object
32 33 34 |
# File 'lib/doorkeeper/oauth/token_introspection.rb', line 32 def to_json(*) active? ? success_response : failure_response end |