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 Attribute Summary collapse
-
#error ⇒ Object
readonly
Returns the value of attribute error.
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.
11 12 13 14 15 16 |
# File 'lib/doorkeeper/oauth/token_introspection.rb', line 11 def initialize(server, token) @server = server @token = token end |
Instance Attribute Details
#error ⇒ Object (readonly)
Returns the value of attribute error.
9 10 11 |
# File 'lib/doorkeeper/oauth/token_introspection.rb', line 9 def error @error end |
Instance Method Details
#authorized? ⇒ Boolean
18 19 20 |
# File 'lib/doorkeeper/oauth/token_introspection.rb', line 18 def @error.blank? end |
#error_response ⇒ Object
22 23 24 25 26 27 28 29 30 31 32 |
# File 'lib/doorkeeper/oauth/token_introspection.rb', line 22 def error_response return if @error.blank? if @error == Errors::InvalidToken OAuth::InvalidTokenResponse.from_access_token() elsif @error == Errors::InvalidRequest OAuth::InvalidRequestResponse.from_request(self) else OAuth::ErrorResponse.from_request(self) end end |
#to_json ⇒ Object
34 35 36 |
# File 'lib/doorkeeper/oauth/token_introspection.rb', line 34 def to_json(*) active? ? success_response : failure_response end |