Class DeveloperAuthenticationCallbackRequest

  • All Implemented Interfaces:
    Serializable

    public class DeveloperAuthenticationCallbackRequest
    extends Object
    implements Serializable
    Developer authentication request from Authlete to a service implementation.

    When a client application developer needs to be authenticated at the Client Application Developer Console (which Authlete provides for client application developers on behalf of the service), Authlete makes a developer authentication callback request to the developer authentication callback endpoint of the service. This class represents the format of the request.

    When the developer tried end-user authentication by inputting his/her credentials to the input fields of the form, id and password in this authentication callback request are the values that the developer has input.

    On the other hand, when the developer tried developer authentication by signing in an SNS such as Facebook, id represents the subject (unique identifier) of the developer in the SNS and password has no meaning. In this case, sns and accessToken are not null. accessToken in this request is the value of the access token issued by the SNS which your implementation of the developer authentication callback endpoint may use as necessary.

    Some notes specific to respective SNSes.

    Facebook

    The value of id is unique to each Facebook application and cannot be used across different applications. If you need the third party ID, make an API call to /me endpoint with fields=third_party_id and access_token={accessToken}. See the API document of Facebook for details.

    The value of rawTokenResponse is in the form of application/x-www-form-urlencoded (not application/json). This is a violation against RFC 6749 (OAuth 2.0).

    The value of refreshToken is empty.

    The value of expiresIn is the value of expires in the response from the token endpoint of Facebook.

    Since:
    1.9
    Author:
    Takahiko Kawasaki
    See Also:
    Serialized Form
    • Constructor Detail

      • DeveloperAuthenticationCallbackRequest

        public DeveloperAuthenticationCallbackRequest()
    • Method Detail

      • getServiceApiKey

        public long getServiceApiKey()
        Get the API key of the target service.

        This property is always set when Authlete makes a request.

        Returns:
        The API key of the target service.
      • setServiceApiKey

        public DeveloperAuthenticationCallbackRequest setServiceApiKey​(long apiKey)
        Set the API key of the target service.
        Parameters:
        apiKey - The API key of the target service.
        Returns:
        this object.
      • getId

        public String getId()
        Get the ID of the developer to authenticate.

        When the value of sns property is null, this property holds the value of the login ID that the developer has entered to the login ID field in the login form of the Client Application Developer Console (which Authlete provides for client application developers on behalf of the service).

        On the other hand, if sns property is not null, this property holds the subject (= unique identifier) of the developer in the SNS.

        This property is always set when Authlete makes a request.

        Returns:
        The ID of the developer to authenticate.
      • getPassword

        public String getPassword()
        Get the password of the developer to authenticate.

        This property holds the value of the password that the developer has entered to the password field in the login form of the Client Application Developer Console (which Authlete provides for client application developers on behalf of the service).

        If sns property is null, it is ensured that this property is not null. In such a case, authentication should be performed on the pair of id property and this password property. On the other hand, if sns property is not null, this property has no meaning, because authentication has been performed by the SNS.

        Returns:
        The password of the developer to authenticate.
      • setPassword

        public DeveloperAuthenticationCallbackRequest setPassword​(String password)
        Set the password of the developer to authenticate.
        Parameters:
        password - The password of the developer to authenticate.
        Returns:
        this object.
      • getSns

        public Sns getSns()
        Get the SNS that the developer used for social login.
        Returns:
        The SNS that the developer used for social login. null is returned if the developer did not use social login.
      • setSns

        public DeveloperAuthenticationCallbackRequest setSns​(Sns sns)
        Set the SNS that the developer used for social login.
        Parameters:
        sns - The SNS that the developer used for social login.
        Returns:
        this object.
      • getAccessToken

        public String getAccessToken()
        Get the access token returned by the SNS which the developer used for social login.
        Returns:
        The access token returned by the SNS. null is returned when social login was not used.
      • setAccessToken

        public DeveloperAuthenticationCallbackRequest setAccessToken​(String accessToken)
        Set the access token returned by the SNS which the developer used for social login.
        Parameters:
        accessToken - The access token returned by the SNS.
        Returns:
        this object.
      • getRefreshToken

        public String getRefreshToken()
        Get the refresh token returned by the SNS which the developer used for social login.
        Returns:
        The refresh token returned by the SNS. null is returned when social login was not used or if the SNS did not return a refresh token.
      • setRefreshToken

        public DeveloperAuthenticationCallbackRequest setRefreshToken​(String refreshToken)
        Set the refresh token returned by the SNS which the developer used for social login.
        Parameters:
        refreshToken - The refresh token returned by the SNS.
        Returns:
        this object.
      • getExpiresIn

        public long getExpiresIn()
        Get the lifetime of the access token in seconds.
        Returns:
        The lifetime of the access token in seconds. 0 is returned when social login was not used of if the SNS did not return information about lifetime of the access token.
      • setExpiresIn

        public DeveloperAuthenticationCallbackRequest setExpiresIn​(long expiresIn)
        Set the lifetime of the access token in seconds.
        Parameters:
        expiresIn - The lifetime of the access token in seconds.
        Returns:
        this object.
      • getRawTokenResponse

        public String getRawTokenResponse()
        Get the raw response from the token endpoint of the SNS.

        If the SNS complies with RFC 6749, the format is JSON. Note that Facebook returns application/x-www-form-urlencoded.

        Returns:
        The raw response from the token endpoint of the SNS.
      • setRawTokenResponse

        public DeveloperAuthenticationCallbackRequest setRawTokenResponse​(String response)
        Set the raw response from the token endpoint of the SNS.
        Parameters:
        response - The raw response from the token endpoint of the SNS.
        Returns:
        this object.