Class: Authlete::Request::AuthenticationCallbackRequest
- Inherits:
-
Object
- Object
- Authlete::Request::AuthenticationCallbackRequest
- Includes:
- Utility
- Defined in:
- lib/authlete/request/authentication-callback-request.rb
Overview
Authlete::Request::AuthenticationCallbackRequest class
This class represents a request to an authentication callback endpoint.
Instance Attribute Summary collapse
-
#access_token ⇒ Object
The access token issued at the token endpoint of the SNS.
-
#claims ⇒ Object
Names of requested claims (string array).
-
#claims_locales ⇒ Object
Names of requested claim locales (string array).
-
#client_id ⇒ Object
The ID of the client application which has triggered the authentication callback request.
-
#expires_in ⇒ Object
The duration of the access token.
-
#id ⇒ Object
The login ID that the end-user input to the login ID field.
-
#password ⇒ Object
The password that the end-user input to the password field.
-
#raw_token_response ⇒ Object
The raw content of the response from the token endpoint of the SNS.
-
#refresh_token ⇒ Object
The refresh token issued along with the access token.
-
#service_api_key ⇒ Object
The API key of the service.
-
#sns ⇒ Object
The SNS which the end-user used for social login.
Class Method Summary collapse
-
.parse(json) ⇒ Object
Parse a JSON string which represents a request to an authentication callback endpoint and generate an instance of AuthenticationCallbackRequest.
Instance Method Summary collapse
-
#initialize(hash = {}) ⇒ AuthenticationCallbackRequest
constructor
The constructor which takes a hash that represents a JSON request to an authentication callback endpoint.
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 = {}) ⇒ AuthenticationCallbackRequest
The constructor which takes a hash that represents a JSON request to an authentication callback endpoint.
69 70 71 72 73 74 75 76 77 78 79 80 81 |
# File 'lib/authlete/request/authentication-callback-request.rb', line 69 def initialize(hash = {}) @service_api_key = extract_value(hash, :serviceApiKey) @client_id = extract_value(hash, :clientId) @id = extract_value(hash, :id) @password = extract_value(hash, :password) @claims = extract_value(hash, :claims) @claims_locales = extract_value(hash, :claimsLocales) @sns = extract_value(hash, :sns) @access_token = extract_value(hash, :accessToken) @refresh_token = extract_value(hash, :refreshToken) @expires_in = extract_integer_value(hash, :expiresIn) @raw_token_response = extract_value(hash, :rawTokenResponse) end |
Instance Attribute Details
#access_token ⇒ Object
The access token issued at the token endpoint of the SNS.
54 55 56 |
# File 'lib/authlete/request/authentication-callback-request.rb', line 54 def access_token @access_token end |
#claims ⇒ Object
Names of requested claims (string array).
43 44 45 |
# File 'lib/authlete/request/authentication-callback-request.rb', line 43 def claims @claims end |
#claims_locales ⇒ Object
Names of requested claim locales (string array). The values come from ‘claims_locales’ request parameter of an authorization request.
47 48 49 |
# File 'lib/authlete/request/authentication-callback-request.rb', line 47 def claims_locales @claims_locales end |
#client_id ⇒ Object
The ID of the client application which has triggered the authentication callback request.
34 35 36 |
# File 'lib/authlete/request/authentication-callback-request.rb', line 34 def client_id @client_id end |
#expires_in ⇒ Object
The duration of the access token.
60 61 62 |
# File 'lib/authlete/request/authentication-callback-request.rb', line 60 def expires_in @expires_in end |
#id ⇒ Object
The login ID that the end-user input to the login ID field.
37 38 39 |
# File 'lib/authlete/request/authentication-callback-request.rb', line 37 def id @id end |
#password ⇒ Object
The password that the end-user input to the password field.
40 41 42 |
# File 'lib/authlete/request/authentication-callback-request.rb', line 40 def password @password end |
#raw_token_response ⇒ Object
The raw content of the response from the token endpoint of the SNS. Correct OAuth 2.0 implementations return ‘application/json’, but Facebook returns ‘application/x-www-form-url-encoded’.
65 66 67 |
# File 'lib/authlete/request/authentication-callback-request.rb', line 65 def raw_token_response @raw_token_response end |
#refresh_token ⇒ Object
The refresh token issued along with the access token.
57 58 59 |
# File 'lib/authlete/request/authentication-callback-request.rb', line 57 def refresh_token @refresh_token end |
#service_api_key ⇒ Object
The API key of the service.
30 31 32 |
# File 'lib/authlete/request/authentication-callback-request.rb', line 30 def service_api_key @service_api_key end |
#sns ⇒ Object
The SNS which the end-user used for social login. For example, ‘FACEBOOK’.
51 52 53 |
# File 'lib/authlete/request/authentication-callback-request.rb', line 51 def sns @sns end |
Class Method Details
.parse(json) ⇒ Object
Parse a JSON string which represents a request to an authentication callback endpoint and generate an instance of AuthenticationCallbackRequest.
85 86 87 |
# File 'lib/authlete/request/authentication-callback-request.rb', line 85 def self.parse(json) AuthenticationCallbackRequest.new(JSON.parse(json)) end |