class Authlete::Model::Response::IntrospectionResponse
Attributes
accessTokenResources[RW]
access_token_resources[RW]
access_token_resources=[RW]
action[RW]
certificateThumbprint[RW]
certificate_thumbprint[RW]
certificate_thumbprint=[RW]
clientId[RW]
clientIdAlias[RW]
clientIdAliasUsed[RW]
client_id[RW]
client_id=[RW]
client_id_alias[RW]
client_id_alias=[RW]
client_id_alias_used[RW]
client_id_alias_used=[RW]
exist[RW]
exist?[RW]
existent[RW]
existent?[RW]
exists[RW]
exists?[RW]
expiresAt[RW]
expires_at[RW]
expires_at=[RW]
properties[RW]
refreshable[RW]
refreshable?[RW]
resources[RW]
responseContent[RW]
response_content[RW]
response_content=[RW]
scopes[RW]
subject[RW]
sufficient[RW]
sufficient?[RW]
usable[RW]
usable?[RW]
Public Instance Methods
to_rack_response()
click to toggle source
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.
# 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
Private Instance Methods
defaults()
click to toggle source
Calls superclass method
Authlete::Model::Result#defaults
# File lib/authlete/model/response/introspection-response.rb, line 80 def defaults super.merge( action: nil, clientId: 0, clientIdAlias: nil, clientIdAliasUsed: false, expiresAt: 0, subject: nil, scopes: nil, existent: false, usable: false, sufficient: false, refreshable: false, responseContent: nil, properties: nil, certificateThumbprint: nil, resources: nil, accessTokenResources: nil ) end
set_params(hash)
click to toggle source
Calls superclass method
Authlete::Model::Result#set_params
# File lib/authlete/model/response/introspection-response.rb, line 101 def set_params(hash) super(hash) @action = hash[:action] @clientId = hash[:clientId] @clientIdAlias = hash[:clientIdAlias] @clientIdAliasUsed = hash[:clientIdAliasUsed] @expiresAt = hash[:expiresAt] @subject = hash[:subject] @scopes = hash[:scopes] @existent = hash[:existent] @usable = hash[:usable] @sufficient = hash[:sufficient] @refreshable = hash[:refreshable] @responseContent = hash[:responseContent] @properties = get_parsed_array(hash[:properties]) { |e| Authlete::Model::Property.parse(e) } @certificateThumbprint = hash[:certificateThumbprint] @resources = hash[:resources] @accessTokenResources = hash[:accessTokenResources] end