Class AuthleteApiImplV3

    • Method Detail

      • tokenDelete

        public void tokenDelete​(String token,
                                Options options)
                         throws AuthleteApiException
        Call /api/{serviceId}/auth/token/delete/{token} API.
        Parameters:
        token - An access token or its hash value.
        options - Request options.
        Throws:
        AuthleteApiException
      • getTokenList

        public TokenListResponse getTokenList​(String clientIdentifier,
                                              String subject,
                                              Options options)
                                       throws AuthleteApiException
        Description copied from interface: AuthleteApi
        Get the list of access tokens (= call Authlete's /auth/token/get/list API with clientIdentifier and subject).

        When both clientIdentifier and subject are null, the list of access tokens that are associated with the service is returned.

        When clientIdentifier is null but the subject is not null, the list of access tokens that are associated with the subject is returned.

        When clientIdentifier is not null but the subject is null, the list of access tokens that are associated with the client application is returned.

        When neither clientIdentifier nor subject is null, the list of access tokens that are associated with the client application and the subject is returned.

        This method uses the default range to limit the result set of the query. Use AuthleteApi.getTokenList(String, String, int, int, TokenStatus) to specify the range explicitly.

        Parameters:
        clientIdentifier - The identifier of the client (client ID or client ID alias) associated with the targeted access tokens, or null.
        subject - The subject of the targeted access tokens, or null.
        options - Request options.
        Returns:
        The list of access tokens.
        Throws:
        AuthleteApiException
      • getTokenList

        public TokenListResponse getTokenList​(String clientIdentifier,
                                              String subject,
                                              TokenStatus tokenStatus,
                                              Options options)
                                       throws AuthleteApiException
        Description copied from interface: AuthleteApi
        Get the list of access tokens (= call Authlete's /auth/token/get/list API with clientIdentifier and subject).

        When both clientIdentifier and subject are null, the list of access tokens that are associated with the service is returned.

        When clientIdentifier is null but the subject is not null, the list of access tokens that are associated with the subject is returned.

        When clientIdentifier is not null but the subject is null, the list of access tokens that are associated with the client application is returned.

        When neither clientIdentifier nor subject is null, the list of access tokens that are associated with the client application and the subject is returned.

        This method uses the default range to limit the result set of the query. Use AuthleteApi.getTokenList(String, String, int, int, TokenStatus) to specify the range explicitly.

        Parameters:
        clientIdentifier - The identifier of the client (client ID or client ID alias) associated with the targeted access tokens, or null.
        subject - The subject of the targeted access tokens, or null.
        tokenStatus - The status of the targeted access tokens, or null.
        options - Request options.
        Returns:
        The list of access tokens.
        Throws:
        AuthleteApiException
      • getTokenList

        public TokenListResponse getTokenList​(int start,
                                              int end,
                                              Options options)
                                       throws AuthleteApiException
        Description copied from interface: AuthleteApi
        Get the list of access tokens that are associated with the service (= call Authlete's /auth/token/get/list API with start and end parameters).

        The pair of start and end parameters denotes the range of the result set of the query. For example, if start is 5 and end is 7, the pair makes a range from 5 (inclusive) to 7 (exclusive) and the response will contain (at most) 2 pieces of access token information, i.e., information about the 6th and the 7th access tokens (the index starts from 0).

        If end - start is equal to or less than 0, getAccessTokens() method of the response returns null. But even in such a case, getTotalCount() method returns the total count. In other words, if you want to get just the total count, you can write the code as shown below.

         int totalCount = api.getTokenList(0, 0).getTotalCount();
         
        Parameters:
        start - The start index (inclusive) of the result set of the query. Must not be negative.
        end - The end index (exclusive) of the result set of the query. Must not be negative.
        options - Request options.
        Returns:
        The list of access tokens.
        Throws:
        AuthleteApiException
      • getTokenList

        public TokenListResponse getTokenList​(int start,
                                              int end,
                                              TokenStatus tokenStatus,
                                              Options options)
                                       throws AuthleteApiException
        Description copied from interface: AuthleteApi
        Get the list of access tokens that are associated with the service (= call Authlete's /auth/token/get/list API with start and end parameters).

        The pair of start and end parameters denotes the range of the result set of the query. For example, if start is 5 and end is 7, the pair makes a range from 5 (inclusive) to 7 (exclusive) and the response will contain (at most) 2 pieces of access token information, i.e., information about the 6th and the 7th access tokens (the index starts from 0).

        If end - start is equal to or less than 0, getAccessTokens() method of the response returns null. But even in such a case, getTotalCount() method returns the total count. In other words, if you want to get just the total count, you can write the code as shown below.

         int totalCount = api.getTokenList(0, 0, TokenStatus.ALL).getTotalCount();
         
        Parameters:
        start - The start index (inclusive) of the result set of the query. Must not be negative.
        end - The end index (exclusive) of the result set of the query. Must not be negative.
        tokenStatus - The status of the targeted access tokens, or null.
        options - Request options.
        Returns:
        The list of access tokens.
        Throws:
        AuthleteApiException
      • getTokenList

        public TokenListResponse getTokenList​(String clientIdentifier,
                                              String subject,
                                              int start,
                                              int end,
                                              Options options)
                                       throws AuthleteApiException
        Description copied from interface: AuthleteApi
        Get the list of access tokens (= call Authlete's /auth/token/get/list API with clientIdentifier, subject, start and end parameters).

        When both clientIdentifier and subject are null, the list of access tokens that are associated with the service is returned.

        When clientIdentifier is null but the subject is not null, the list of access tokens that are associated with the subject is returned.

        When clientIdentifier is not null but the subject is null, the list of access tokens that are associated with the client application is returned.

        When neither clientIdentifier nor subject is null, the list of access tokens that are associated with the client application and the subject is returned.

        The pair of start and end parameters denotes the range of the result set of the query. For example, if start is 5 and end is 7, the pair makes a range from 5 (inclusive) to 7 (exclusive) and the response will contain (at most) 2 pieces of access token information, i.e., information about the 6th and the 7th access tokens (the index starts from 0).

        If end - start is equal to or less than 0, getAccessTokens() method of the response returns null. But even in such a case, getTotalCount() method returns the total count. In other words, if you want to get just the total count, you can write the code as shown below.

         int totalCount = api.getTokenList(clientIdentifier, subject, 0, 0).getTotalCount();
         
        Parameters:
        clientIdentifier - The identifier of the client (client ID or client ID alias) associated with the targeted access tokens, or null.
        subject - The subject of the targeted access tokens, or null.
        start - The start index (inclusive) of the result set of the query. Must not be negative.
        end - The end index (exclusive) of the result set of the query. Must not be negative.
        options - Request options.
        Returns:
        The list of access tokens.
        Throws:
        AuthleteApiException
      • getTokenList

        public TokenListResponse getTokenList​(String clientIdentifier,
                                              String subject,
                                              int start,
                                              int end,
                                              TokenStatus tokenStatus,
                                              Options options)
                                       throws AuthleteApiException
        Description copied from interface: AuthleteApi
        Get the list of access tokens (= call Authlete's /auth/token/get/list API with clientIdentifier, subject, start and end parameters).

        When both clientIdentifier and subject are null, the list of access tokens that are associated with the service is returned.

        When clientIdentifier is null but the subject is not null, the list of access tokens that are associated with the subject is returned.

        When clientIdentifier is not null but the subject is null, the list of access tokens that are associated with the client application is returned.

        When neither clientIdentifier nor subject is null, the list of access tokens that are associated with the client application and the subject is returned.

        The pair of start and end parameters denotes the range of the result set of the query. For example, if start is 5 and end is 7, the pair makes a range from 5 (inclusive) to 7 (exclusive) and the response will contain (at most) 2 pieces of access token information, i.e., information about the 6th and the 7th access tokens (the index starts from 0).

        If end - start is equal to or less than 0, getAccessTokens() method of the response returns null. But even in such a case, getTotalCount() method returns the total count. In other words, if you want to get just the total count, you can write the code as shown below.

         int totalCount = api.getTokenList(clientIdentifier, subject, 0, 0, TokenStatus.ALL).getTotalCount();
         
        Parameters:
        clientIdentifier - The identifier of the client (client ID or client ID alias) associated with the targeted access tokens, or null.
        subject - The subject of the targeted access tokens, or null.
        start - The start index (inclusive) of the result set of the query. Must not be negative.
        end - The end index (exclusive) of the result set of the query. Must not be negative.
        tokenStatus - The status of the targeted access tokens, or null.
        options - Request options.
        Returns:
        The list of access tokens.
        Throws:
        AuthleteApiException
      • deleteService

        public void deleteService​(long apiKey,
                                  Options options)
                           throws AuthleteApiException
        Call /api/{serviceId}/service/delete/ API.
        Parameters:
        apiKey - The API key of the service.
        options - Request options.
        Throws:
        AuthleteApiException
      • getService

        public Service getService​(long apiKey,
                                  Options options)
                           throws AuthleteApiException
        Call /api/{serviceId}/service/get API.
        Parameters:
        apiKey - The API key of the service.
        options - Request options.
        Returns:
        Information about the service.
        Throws:
        AuthleteApiException
      • getServiceList

        public ServiceListResponse getServiceList​(int start,
                                                  int end,
                                                  Options options)
                                           throws AuthleteApiException
        Description copied from interface: AuthleteApi
        Get the list of services that belong to the service owner (= call Authlete's /service/get/list API with start and end parameters).

        The pair of start and end parameters denotes the range of the result set of the query. For example, if start is 5 and end is 7, the pair makes a range from 5 (inclusive) to 7 (exclusive) and the response will contain (at most) 2 pieces of service information, i.e., information about the 6th and the 7th services (the index starts from 0).

        If end - start is equal to or less than 0, getServices() method of the response returns null. But even in such a case, getTotalCount() method returns the total count. In other words, if you want to get just the total count, you can write the code as shown below.

         int totalCount = api.getServiceList(0, 0).getTotalCount();
         
        Parameters:
        start - The start index (inclusive) of the result set of the query. Must not be negative.
        end - The end index (exclusive) of the result set of the query. Must not be negative.
        options - Request options.
        Returns:
        The list of services.
        Throws:
        AuthleteApiException
      • updateService

        public Service updateService​(Service service,
                                     Options options)
                              throws AuthleteApiException
        Call /api/{serviceId}/service/update/ API.
        Parameters:
        service - Information about a service to update.
        options - Request options.
        Returns:
        Information about the updated service.
        Throws:
        AuthleteApiException
      • getServiceJwks

        public String getServiceJwks​(boolean pretty,
                                     boolean includePrivateKeys,
                                     Options options)
                              throws AuthleteApiException
        Call /api/{serviceId}/service/jwks/get API
        Parameters:
        pretty - true to get the JSON in pretty format.
        includePrivateKeys - true to keep private keys in the JSON. false to remove private keys.
        options - Request options.
        Returns:
        JSON representation of the JWK Set of the service. null is returned when the service has registered neither content or URI of its JWK Set.
        Throws:
        AuthleteApiException
        See Also:
        RFC 7517: JSON Web Key (JWK)
      • createClient

        public Client createClient​(Client client,
                                   Options options)
                            throws AuthleteApiException
        Call /api/{serviceId}/client/create API.
        Parameters:
        client - Information about a client to create.
        options - Request options.
        Returns:
        Information about a newly created client.
        Throws:
        AuthleteApiException
      • deleteClient

        public void deleteClient​(long clientId,
                                 Options options)
                          throws AuthleteApiException
        Call /api/{serviceId}/client/delete/{clientId} API.
        Parameters:
        clientId - Client ID.
        options - Request options.
        Throws:
        AuthleteApiException
      • getClient

        public Client getClient​(long clientId,
                                Options options)
                         throws AuthleteApiException
        Call /api/{serviceId}/client/get/{clientId} API.
        Parameters:
        clientId - The client ID.
        options - Request options.
        Returns:
        Information about the client.
        Throws:
        AuthleteApiException
      • getClientList

        public ClientListResponse getClientList​(String developer,
                                                Options options)
                                         throws AuthleteApiException
        Description copied from interface: AuthleteApi
        Get the list of client applications that belong to the developer (= call Authlete's /client/get/list API with developer parameter).

        When developer is null, the list of client applications that belong to the service is returned.

        This method uses the default range to limit the result set of the query. Use AuthleteApi.getClientList(String, int, int) to specify the range explicitly.

        Parameters:
        developer - The developer of the targeted client applications.
        options - Request options.
        Returns:
        The list of clients.
        Throws:
        AuthleteApiException
      • getClientList

        public ClientListResponse getClientList​(int start,
                                                int end,
                                                Options options)
                                         throws AuthleteApiException
        Description copied from interface: AuthleteApi
        Get the list of client applications that belong to the service (= call Authlete's /client/get/list API with start and end parameters).
        Parameters:
        start - The start index (inclusive) of the result set of the query. Must not be negative.
        end - The end index (exclusive) of the result set of the query. Must not be negative.
        options - Request options.
        Returns:
        The list of clients.
        Throws:
        AuthleteApiException
      • getClientList

        public ClientListResponse getClientList​(String developer,
                                                int start,
                                                int end,
                                                Options options)
                                         throws AuthleteApiException
        Description copied from interface: AuthleteApi
        Get the list of client applications (= call Authlete's /client/get/list API with developer, start and end parameters).

        When developer is null, the list of client applications that belong to the service is returned. Otherwise, when developer is not null, the list of client applications that belong to the developer is returned.

        The pair of start and end parameters denotes the range of the result set of the query. For example, if start is 5 and end is 7, the pair makes a range from 5 (inclusive) to 7 (exclusive) and the response will contain (at most) 2 pieces of client information, i.e., information about the 6th and the 7th applications (the index starts from 0).

        If end - start is equal to or less than 0, getClients() method of the response returns null. But even in such a case, getTotalCount() method returns the total count. In other words, if you want to get just the total count, you can write the code as shown below.

         int totalCount = api.getClientList(developer, 0, 0).getTotalCount();
         
        Parameters:
        developer - The developer of the targeted client applications, or null to get the list of client applications of the entire service.
        start - The start index (inclusive) of the result set of the query. Must not be negative.
        end - The end index (exclusive) of the result set of the query. Must not be negative.
        options - Request options.
        Returns:
        The list of clients.
        Throws:
        AuthleteApiException
      • updateClient

        public Client updateClient​(Client client,
                                   Options options)
                            throws AuthleteApiException
        Call /api/{serviceId}/client/update/{clientId} API.
        Parameters:
        client - Information about a client to update.
        options - Request options.
        Returns:
        Information about the updated client.
        Throws:
        AuthleteApiException
      • getRequestableScopes

        public String[] getRequestableScopes​(long clientId,
                                             Options options)
                                      throws AuthleteApiException
        Call /api/{serviceId}/client/extension/requestable_scopes/get/{clientId} API.
        Parameters:
        clientId - A client ID.
        options - Request options.
        Returns:
        null
        Requestable scopes are not assigned to the client, meaning that the client can request any scopes supported by the service.
        An empty array
        The client cannot request any scopes, meaning that values included in the scope request parameter in authorization requests and token requests are all ignored.
        An array of scope names
        The array represents the set of scopes that the client is allowed to request.
        Throws:
        AuthleteApiException
      • setRequestableScopes

        public String[] setRequestableScopes​(long clientId,
                                             String[] scopes,
                                             Options options)
                                      throws AuthleteApiException
        Description copied from interface: AuthleteApi
        Set the requestable scopes assigned to a client (= call Authlete's /client/extension/requestable_scopes/update/{clientId} API).

        Calling this method with scopes=null has the same effect as calling deleteRequestableScopes(clientId).

        Since the version 1.39, the Client class has extension property and information about "Requestable Scopes per Client" is included in the property. So, calling /client/update/{clientId} API is enough and recommended. In other words, calling /client/extension/requestable_scopes/update/{clientId} API is no longer recommended.

        Known issue: The JSON parser used by the implementation of /client/extension/requestable_scopes/update/{clientId} API treats an empty array as null and it does not provide any configuration method to change the behavior. Until the JSON parser is replaced, passing an empty array to the API leads to the same result as passing null to the API.

        Parameters:
        clientId - A client ID.
        scopes -
        null
        Requestable scopes assigned to the client are cleared. This results in that the client can request any scopes supported by the service.
        An empty array
        The client cannot request any scopes, meaning that values included in the scope request parameter in authorization requests and token requests are all ignored.
        An array of scope names
        The given array is used as the set of scopes that the client is allowed to request.
        options - Request options.
        Returns:
        The resultant set of requestable scopes. The value may be different from the one given to this method.
        Throws:
        AuthleteApiException
      • deleteRequestableScopes

        public void deleteRequestableScopes​(long clientId,
                                            Options options)
                                     throws AuthleteApiException
        Call /api/{serviceId}/client/extension/requestable_scopes/delete/{clientId} API.
        Parameters:
        clientId - A client ID.
        options - Request options.
        Throws:
        AuthleteApiException
      • getGrantedScopes

        public GrantedScopesGetResponse getGrantedScopes​(long clientId,
                                                         String subject,
                                                         Options options)
        Description copied from interface: AuthleteApi
        Get the set of scopes that a user has granted to a client application (call Authlete's /client/granted_scopes/get/{clientId} API).

        A dedicated Authlete server provides a functionality to remember the set of scopes that a user has granted to a client application. A remembered set is NOT removed from the database even after all existing access tokens associated with the combination of the client application and the subject have expired. Note that this functionality is not provided by the shared Authlete server.

        Parameters:
        clientId - A client ID.
        subject - A unique user identifier.
        options - Request options.
        Returns:
        Information about scopes granted to a client application by a user.
      • deleteGrantedScopes

        public void deleteGrantedScopes​(long clientId,
                                        String subject,
                                        Options options)
        Description copied from interface: AuthleteApi
        Delete DB records about the set of scopes that a user has granted to a client application (call Authlete's /client/granted_scopes/delete/{clientId} API).

        Even if you delete records about granted scopes by calling this API, existing access tokens are not deleted and scopes of existing access tokens are not changed.

        Please call this method if the user identified by the subject is deleted from your system. Otherwise, garbage data continue to exist in the database.

        Parameters:
        clientId - A client ID.
        subject - A unique user identifier.
        options - Request options.
      • deleteClientAuthorization

        public void deleteClientAuthorization​(long clientId,
                                              String subject,
                                              Options options)
                                       throws AuthleteApiException
        Description copied from interface: AuthleteApi
        Delete all existing access tokens issued to the client application by the end-user.
        Parameters:
        clientId - The ID of the target client application.
        subject - The subject (= unique identifier) of the end-user. Must not be null.
        options - Request options.
        Throws:
        AuthleteApiException
      • updateClientAuthorization

        public void updateClientAuthorization​(long clientId,
                                              ClientAuthorizationUpdateRequest request,
                                              Options options)
                                       throws AuthleteApiException
        Description copied from interface: AuthleteApi
        Update attributes of all existing access tokens issued to the client application by the end-user.
        Parameters:
        clientId - The ID of the target client application.
        request - The subject (= unique identifier) of the end-user and new attribute values of access tokens. The subject property in the request must not be null.
        options - Request options.
        Throws:
        AuthleteApiException
      • refreshClientSecret

        public ClientSecretRefreshResponse refreshClientSecret​(long clientId,
                                                               Options options)
                                                        throws AuthleteApiException
        Description copied from interface: AuthleteApi
        Refresh the client secret of a client. A new value of the client secret will be generated by the Authlete server. If you want to specify a new value, use updateClientSecret method.
        Parameters:
        clientId - The client ID of a client.
        options - Request options.
        Returns:
        A response from Authlete's /api/client/secret/refresh API.
        Throws:
        AuthleteApiException
      • refreshClientSecret

        public ClientSecretRefreshResponse refreshClientSecret​(String clientIdentifier,
                                                               Options options)
                                                        throws AuthleteApiException
        Description copied from interface: AuthleteApi
        Refresh the client secret of a client. A new value of the client secret will be generated by the Authlete server. If you want to specify a new value, use updateClientSecret method.
        Parameters:
        clientIdentifier - The client ID or the client ID alias of a client.
        options - Request options.
        Returns:
        A response from Authlete's /api/client/secret/refresh API.
        Throws:
        AuthleteApiException
      • updateClientSecret

        public ClientSecretUpdateResponse updateClientSecret​(long clientId,
                                                             String clientSecret,
                                                             Options options)
                                                      throws AuthleteApiException
        Description copied from interface: AuthleteApi
        Update the client secret of a client. If you want to have the Authlete server generate a new value of the client secret, use refreshClientSecret method.

        Valid characters for a client secret are A-Z, a-z, 0-9, -, and _. The maximum length of a client secret is 86.

        Parameters:
        clientId - The client ID of a client.
        clientSecret - The new value of the client secret.
        options - Request options.
        Returns:
        A response from Authlete's /api/client/secret/update API.
        Throws:
        AuthleteApiException
      • updateClientSecret

        public ClientSecretUpdateResponse updateClientSecret​(String clientIdentifier,
                                                             String clientSecret,
                                                             Options options)
                                                      throws AuthleteApiException
        Description copied from interface: AuthleteApi
        Update the client secret of a client. If you want to have the Authlete server generate a new value of the client secret, use refreshClientSecret method.

        Valid characters for a client secret are A-Z, a-z, 0-9, -, and _. The maximum length of a client secret is 86.

        Parameters:
        clientIdentifier - The client ID or the client ID alias of a client.
        clientSecret - The new value of the client secret.
        options - Request options.
        Returns:
        A response from Authlete's /api/client/secret/update API.
        Throws:
        AuthleteApiException
      • updateClientLockFlag

        public void updateClientLockFlag​(String clientIdentifier,
                                         boolean clientLocked,
                                         Options options)
                                  throws AuthleteApiException
        Description copied from interface: AuthleteApi
        Update the lock flag of a client application.
        Parameters:
        clientIdentifier - The client ID or the client ID alias of a client application.
        clientLocked - The value to which this request updates the lock flag of a client application.
        options - Request options.
        Throws:
        AuthleteApiException