Class: Authlete::Model::Response::IntrospectionResponse
- Inherits:
-
Authlete::Model::Result
- Object
- Base
- Authlete::Model::Result
- Authlete::Model::Response::IntrospectionResponse
- Includes:
- Utility
- Defined in:
- lib/authlete/model/response/introspection-response.rb
Instance Attribute Summary collapse
-
#accessTokenResources ⇒ Object
(also: #access_token_resources)
Returns the value of attribute accessTokenResources.
-
#action ⇒ Object
Returns the value of attribute action.
-
#certificateThumbprint ⇒ Object
(also: #certificate_thumbprint)
Returns the value of attribute certificateThumbprint.
-
#clientId ⇒ Object
(also: #client_id)
Returns the value of attribute clientId.
-
#clientIdAlias ⇒ Object
(also: #client_id_alias)
Returns the value of attribute clientIdAlias.
-
#clientIdAliasUsed ⇒ Object
(also: #client_id_alias_used)
Returns the value of attribute clientIdAliasUsed.
-
#existent ⇒ Object
(also: #existent?, #exists, #exists?, #exist, #exist?)
Returns the value of attribute existent.
-
#expiresAt ⇒ Object
(also: #expires_at)
Returns the value of attribute expiresAt.
-
#properties ⇒ Object
Returns the value of attribute properties.
-
#refreshable ⇒ Object
(also: #refreshable?)
Returns the value of attribute refreshable.
-
#resources ⇒ Object
Returns the value of attribute resources.
-
#responseContent ⇒ Object
(also: #response_content)
Returns the value of attribute responseContent.
-
#scopes ⇒ Object
Returns the value of attribute scopes.
-
#subject ⇒ Object
Returns the value of attribute subject.
-
#sufficient ⇒ Object
(also: #sufficient?)
Returns the value of attribute sufficient.
-
#usable ⇒ Object
(also: #usable?)
Returns the value of attribute usable.
Attributes inherited from Authlete::Model::Result
Instance Method Summary collapse
-
#to_rack_response ⇒ Object
Generate an array which is usable as a Rack response from this instance.
Methods included from Utility
#extract_access_token, #get_parsed_array, #to_rack_response_json, #to_rack_response_www_authenticate
Methods inherited from Base
Instance Attribute Details
#accessTokenResources ⇒ Object Also known as: access_token_resources
Returns the value of attribute accessTokenResources.
74 75 76 |
# File 'lib/authlete/model/response/introspection-response.rb', line 74 def accessTokenResources @accessTokenResources end |
#action ⇒ Object
Returns the value of attribute action.
24 25 26 |
# File 'lib/authlete/model/response/introspection-response.rb', line 24 def action @action end |
#certificateThumbprint ⇒ Object Also known as: certificate_thumbprint
Returns the value of attribute certificateThumbprint.
68 69 70 |
# File 'lib/authlete/model/response/introspection-response.rb', line 68 def certificateThumbprint @certificateThumbprint end |
#clientId ⇒ Object Also known as: client_id
Returns the value of attribute clientId.
26 27 28 |
# File 'lib/authlete/model/response/introspection-response.rb', line 26 def clientId @clientId end |
#clientIdAlias ⇒ Object Also known as: client_id_alias
Returns the value of attribute clientIdAlias.
30 31 32 |
# File 'lib/authlete/model/response/introspection-response.rb', line 30 def clientIdAlias @clientIdAlias end |
#clientIdAliasUsed ⇒ Object Also known as: client_id_alias_used
Returns the value of attribute clientIdAliasUsed.
34 35 36 |
# File 'lib/authlete/model/response/introspection-response.rb', line 34 def clientIdAliasUsed @clientIdAliasUsed end |
#existent ⇒ Object Also known as: existent?, exists, exists?, exist, exist?
Returns the value of attribute existent.
46 47 48 |
# File 'lib/authlete/model/response/introspection-response.rb', line 46 def existent @existent end |
#expiresAt ⇒ Object Also known as: expires_at
Returns the value of attribute expiresAt.
38 39 40 |
# File 'lib/authlete/model/response/introspection-response.rb', line 38 def expiresAt @expiresAt end |
#properties ⇒ Object
Returns the value of attribute properties.
66 67 68 |
# File 'lib/authlete/model/response/introspection-response.rb', line 66 def properties @properties end |
#refreshable ⇒ Object Also known as: refreshable?
Returns the value of attribute refreshable.
59 60 61 |
# File 'lib/authlete/model/response/introspection-response.rb', line 59 def refreshable @refreshable end |
#resources ⇒ Object
Returns the value of attribute resources.
72 73 74 |
# File 'lib/authlete/model/response/introspection-response.rb', line 72 def resources @resources end |
#responseContent ⇒ Object Also known as: response_content
Returns the value of attribute responseContent.
62 63 64 |
# File 'lib/authlete/model/response/introspection-response.rb', line 62 def responseContent @responseContent end |
#scopes ⇒ Object
Returns the value of attribute scopes.
44 45 46 |
# File 'lib/authlete/model/response/introspection-response.rb', line 44 def scopes @scopes end |
#subject ⇒ Object
Returns the value of attribute subject.
42 43 44 |
# File 'lib/authlete/model/response/introspection-response.rb', line 42 def subject @subject end |
#sufficient ⇒ Object Also known as: sufficient?
Returns the value of attribute sufficient.
56 57 58 |
# File 'lib/authlete/model/response/introspection-response.rb', line 56 def sufficient @sufficient end |
#usable ⇒ Object Also known as: usable?
Returns the value of attribute usable.
53 54 55 |
# File 'lib/authlete/model/response/introspection-response.rb', line 53 def usable @usable end |
Instance Method Details
#to_rack_response ⇒ Object
Generate an array which is usable as a Rack response from this instance. When action
method returns other value than ‘OK’, the array returned from this method satisfies RFC 6750.
127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 |
# File 'lib/authlete/model/response/introspection-response.rb', line 127 def to_rack_response # 'action' denotes the next action. case @action when 'INTERNAL_SERVER_ERROR' # 500 Internal Server Error # The API request from this implementation was wrong # or an error occurred in Authlete. return to_rack_response_www_authenticate(500, @response_content) when 'BAD_REQUEST' # 400 Bad Request # The request from the client application does not # contain an access token. return to_rack_response_www_authenticate(400, @response_content) when 'UNAUTHORIZED' # 401 Unauthorized # The presented access token does not exist or has expired. return to_rack_response_www_authenticate(401, @response_content) when 'FORBIDDEN' # 403 Forbidden # The access token does not cover the required scopes # or the subject associated with the access token is # different. return to_rack_response_www_authenticate(403, @response_content) when 'OK' # The access token is valid (= exists and has not expired). # Basically, the caller won't use the array returned from here. # Instead, it will return the protected resource to the client # application which has presented the valid access token. return [ 200, nil, nil ] else # This should not happen. return to_rack_response_www_authenticate(500, 'Bearer error="server_error",error_description="Unknown action"') end end |