Class CommunicationIdentityClient

java.lang.Object
com.azure.communication.identity.CommunicationIdentityClient

public final class CommunicationIdentityClient extends Object
Synchronous client interface for Azure Communication Service Identity operations

Instantiating a synchronous Azure Communication Service Identity Client

 // You can find your endpoint and access key from your resource in the Azure Portal
 String endpoint = "https://<RESOURCE_NAME>.communication.azure.com";
 AzureKeyCredential keyCredential = new AzureKeyCredential("<access-key>");

 CommunicationIdentityClient communicationIdentityClient = new CommunicationIdentityClientBuilder()
     .endpoint(endpoint)
     .credential(keyCredential)
     .buildClient();
 

View this for additional ways to construct the client.

See Also:
  • Method Details

    • createUser

      public com.azure.communication.common.CommunicationUserIdentifier createUser()
      Creates a new CommunicationUserIdentifier.
      Returns:
      The created Communication User.
    • createUserWithResponse

      public com.azure.core.http.rest.Response<com.azure.communication.common.CommunicationUserIdentifier> createUserWithResponse(com.azure.core.util.Context context)
      Creates a new CommunicationUserIdentifier with response.
      Parameters:
      context - A Context representing the request context.
      Returns:
      The created Communication User.
    • createUserAndToken

      public CommunicationUserIdentifierAndToken createUserAndToken(Iterable<CommunicationTokenScope> scopes, Duration tokenExpiresIn)
      Creates a new CommunicationUserIdentifier with token.
      Parameters:
      scopes - The list of scopes for the token.
      tokenExpiresIn - Custom validity period of the Communication Identity access token within [1,24] hours range. If not provided, the default value of 24 hours will be used.
      Returns:
      The created communication user and token.
    • createUserAndToken

      Creates a new CommunicationUserIdentifier with token.
      Parameters:
      scopes - The list of scopes for the token.
      Returns:
      The created communication user and token.
    • createUserAndTokenWithResponse

      public com.azure.core.http.rest.Response<CommunicationUserIdentifierAndToken> createUserAndTokenWithResponse(Iterable<CommunicationTokenScope> scopes, Duration tokenExpiresIn, com.azure.core.util.Context context)
      Creates a new CommunicationUserIdentifier with token with response.
      Parameters:
      scopes - The list of scopes for the token.
      tokenExpiresIn - Custom validity period of the Communication Identity access token within [1,24] hours range. If not provided, the default value of 24 hours will be used.
      context - A Context representing the request context.
      Returns:
      The created communication user and token with response.
    • createUserAndTokenWithResponse

      public com.azure.core.http.rest.Response<CommunicationUserIdentifierAndToken> createUserAndTokenWithResponse(Iterable<CommunicationTokenScope> scopes, com.azure.core.util.Context context)
      Creates a new CommunicationUserIdentifier with token with response.
      Parameters:
      scopes - The list of scopes for the token.
      context - A Context representing the request context.
      Returns:
      The created communication user and token with response.
    • deleteUser

      public void deleteUser(com.azure.communication.common.CommunicationUserIdentifier communicationUser)
      Deletes a CommunicationUserIdentifier, revokes its tokens and deletes its data.
      Parameters:
      communicationUser - The user to be deleted.
    • deleteUserWithResponse

      public com.azure.core.http.rest.Response<Void> deleteUserWithResponse(com.azure.communication.common.CommunicationUserIdentifier communicationUser, com.azure.core.util.Context context)
      Deletes a CommunicationUserIdentifier, revokes its tokens and deletes its data with response.
      Parameters:
      communicationUser - The user to be deleted.
      context - A Context representing the request context.
      Returns:
      The response with void.
    • revokeTokens

      public void revokeTokens(com.azure.communication.common.CommunicationUserIdentifier communicationUser)
      Revokes all the tokens created for an identifier.
      Parameters:
      communicationUser - The user to be revoked token.
    • revokeTokensWithResponse

      public com.azure.core.http.rest.Response<Void> revokeTokensWithResponse(com.azure.communication.common.CommunicationUserIdentifier communicationUser, com.azure.core.util.Context context)
      Revokes all the tokens created for a user before a specific date.
      Parameters:
      communicationUser - The user to be revoked token.
      context - the context of the request. Can also be null or Context.NONE.
      Returns:
      The response with void.
    • getToken

      public com.azure.core.credential.AccessToken getToken(com.azure.communication.common.CommunicationUserIdentifier communicationUser, Iterable<CommunicationTokenScope> scopes, Duration tokenExpiresIn)
      Gets a Communication Identity access token for a CommunicationUserIdentifier.
      Parameters:
      communicationUser - A CommunicationUserIdentifier from whom to issue a Communication Identity access token.
      scopes - List of CommunicationTokenScope scopes for the Communication Identity access token.
      tokenExpiresIn - Custom validity period of the Communication Identity access token within [1,24] hours range. If not provided, the default value of 24 hours will be used.
      Returns:
      the Communication Identity access token.
    • getToken

      public com.azure.core.credential.AccessToken getToken(com.azure.communication.common.CommunicationUserIdentifier communicationUser, Iterable<CommunicationTokenScope> scopes)
      Gets a Communication Identity access token for a CommunicationUserIdentifier.
      Parameters:
      communicationUser - A CommunicationUserIdentifier from whom to issue a Communication Identity access token.
      scopes - List of CommunicationTokenScope scopes for the Communication Identity access token.
      Returns:
      the Communication Identity access token.
    • getTokenWithResponse

      public com.azure.core.http.rest.Response<com.azure.core.credential.AccessToken> getTokenWithResponse(com.azure.communication.common.CommunicationUserIdentifier communicationUser, Iterable<CommunicationTokenScope> scopes, Duration tokenExpiresIn, com.azure.core.util.Context context)
      Gets a Communication Identity access token for a CommunicationUserIdentifier.
      Parameters:
      communicationUser - A CommunicationUserIdentifier from whom to issue a Communication Identity access token.
      scopes - List of CommunicationTokenScope scopes for the Communication Identity access token.
      tokenExpiresIn - Custom validity period of the Communication Identity access token within [1,24] hours range. If not provided, the default value of 24 hours will be used.
      context - the context of the request. Can also be null or Context.NONE.
      Returns:
      the Communication Identity access token with response.
    • getTokenWithResponse

      public com.azure.core.http.rest.Response<com.azure.core.credential.AccessToken> getTokenWithResponse(com.azure.communication.common.CommunicationUserIdentifier communicationUser, Iterable<CommunicationTokenScope> scopes, com.azure.core.util.Context context)
      Gets a Communication Identity access token for a CommunicationUserIdentifier.
      Parameters:
      communicationUser - A CommunicationUserIdentifier from whom to issue a Communication Identity access token.
      scopes - List of CommunicationTokenScope scopes for the Communication Identity access token.
      context - the context of the request. Can also be null or Context.NONE.
      Returns:
      the Communication Identity access token with response.
    • getTokenForTeamsUser

      public com.azure.core.credential.AccessToken getTokenForTeamsUser(GetTokenForTeamsUserOptions options)
      Exchanges an Azure AD access token of a Teams User for a new Communication Identity access token.
      Parameters:
      options - GetTokenForTeamsUserOptions request options used to exchange an Azure AD access token of a Teams User for a new Communication Identity access token.
      Returns:
      Communication Identity access token.
    • getTokenForTeamsUserWithResponse

      public com.azure.core.http.rest.Response<com.azure.core.credential.AccessToken> getTokenForTeamsUserWithResponse(GetTokenForTeamsUserOptions options, com.azure.core.util.Context context)
      Exchanges an Azure AD access token of a Teams User for a new Communication Identity access token.
      Parameters:
      options - GetTokenForTeamsUserOptions request options used to exchange an Azure AD access token of a Teams User for a new Communication Identity access token.
      context - the context of the request. Can also be null or Context.NONE.
      Returns:
      Communication Identity access token with response.