Class: Authlete::Response::AuthenticationCallbackResponse
- Inherits:
-
Object
- Object
- Authlete::Response::AuthenticationCallbackResponse
- Includes:
- Utility
- Defined in:
- lib/authlete/response/authentication-callback-response.rb
Overview
Authlete::Response::AuthenticationCallbackResponse class
This class represents a response from an authentication callback endpoint.
Instance Attribute Summary collapse
-
#authenticated ⇒ Object
True when the end-user has been authenticated (= is a valid user).
-
#claims ⇒ Object
Pieces of information about the end-user in JSON format.
-
#subject ⇒ Object
The unique identifier of the end-user.
Instance Method Summary collapse
-
#initialize(hash = {}) ⇒ AuthenticationCallbackResponse
constructor
The constructor which takes a hash that represents a JSON response from an authentication callback endpoint.
-
#to_rack_response ⇒ Object
Generate an array which is usable as a Rack response from this instance.
Methods included from Utility
#extract_access_token, #extract_boolean_value, #extract_integer_value, #extract_value, #to_rack_response_json, #to_rack_response_www_authenticate
Constructor Details
#initialize(hash = {}) ⇒ AuthenticationCallbackResponse
The constructor which takes a hash that represents a JSON response from an authentication callback endpoint.
37 38 39 40 41 |
# File 'lib/authlete/response/authentication-callback-response.rb', line 37 def initialize(hash = {}) @authenticated = extract_boolean_value(hash, :authenticated) @subject = extract_value(hash, :subject) @claims = extract_value(hash, :claims) end |
Instance Attribute Details
#authenticated ⇒ Object
True when the end-user has been authenticated (= is a valid user).
27 28 29 |
# File 'lib/authlete/response/authentication-callback-response.rb', line 27 def authenticated @authenticated end |
#claims ⇒ Object
Pieces of information about the end-user in JSON format.
33 34 35 |
# File 'lib/authlete/response/authentication-callback-response.rb', line 33 def claims @claims end |
#subject ⇒ Object
The unique identifier of the end-user.
30 31 32 |
# File 'lib/authlete/response/authentication-callback-response.rb', line 30 def subject @subject end |
Instance Method Details
#to_rack_response ⇒ Object
Generate an array which is usable as a Rack response from this instance.
44 45 46 47 48 49 50 |
# File 'lib/authlete/response/authentication-callback-response.rb', line 44 def to_rack_response to_rack_response_json(200, JSON.generate( :authenticated => @authenticated, :subject => @subject, :claims => @claims )) end |