Package com.azure.communication.identity
Class CommunicationIdentityClient
java.lang.Object
com.azure.communication.identity.CommunicationIdentityClient
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 Summary
Modifier and TypeMethodDescriptionCreates a new CommunicationUserIdentifier.Creates a new CommunicationUserIdentifier with token.createUserAndTokenWithResponse
(Iterable<CommunicationTokenScope> scopes, Context context) Creates a new CommunicationUserIdentifier with token with response.createUserWithResponse
(Context context) Creates a new CommunicationUserIdentifier with response.void
deleteUser
(CommunicationUserIdentifier communicationUser) Deletes a CommunicationUserIdentifier, revokes its tokens and deletes its data.deleteUserWithResponse
(CommunicationUserIdentifier communicationUser, Context context) Deletes a CommunicationUserIdentifier, revokes its tokens and deletes its data with response.getToken
(CommunicationUserIdentifier communicationUser, Iterable<CommunicationTokenScope> scopes) Gets a token for an identity.Exchanges an Azure AD access token of a Teams User for a new Communication Identity access token.getTokenForTeamsUserWithResponse
(GetTokenForTeamsUserOptions options, Context context) Exchanges an Azure AD access token of a Teams User for a new Communication Identity access token.getTokenWithResponse
(CommunicationUserIdentifier communicationUser, Iterable<CommunicationTokenScope> scopes, Context context) Gets a token for an identity.void
revokeTokens
(CommunicationUserIdentifier communicationUser) Revokes all the tokens created for an identifier.revokeTokensWithResponse
(CommunicationUserIdentifier communicationUser, Context context) Revokes all the tokens created for a user before a specific date.
-
Method Details
-
createUser
Creates a new CommunicationUserIdentifier.- Returns:
- The created Communication User.
-
createUserWithResponse
Creates a new CommunicationUserIdentifier with response.- Parameters:
context
- AContext
representing the request context.- Returns:
- The created Communication User.
-
createUserAndToken
public CommunicationUserIdentifierAndToken createUserAndToken(Iterable<CommunicationTokenScope> scopes) Creates a new CommunicationUserIdentifier with token.- Parameters:
scopes
- The list of scopes for the token.- Returns:
- The created communication user and token.
-
createUserAndTokenWithResponse
public Response<CommunicationUserIdentifierAndToken> createUserAndTokenWithResponse(Iterable<CommunicationTokenScope> scopes, Context context) Creates a new CommunicationUserIdentifier with token with response.- Parameters:
scopes
- The list of scopes for the token.context
- AContext
representing the request context.- Returns:
- The created communication user and token with response.
-
deleteUser
Deletes a CommunicationUserIdentifier, revokes its tokens and deletes its data.- Parameters:
communicationUser
- The user to be deleted.
-
deleteUserWithResponse
public Response<Void> deleteUserWithResponse(CommunicationUserIdentifier communicationUser, Context context) Deletes a CommunicationUserIdentifier, revokes its tokens and deletes its data with response.- Parameters:
communicationUser
- The user to be deleted.context
- AContext
representing the request context.- Returns:
- The response with void.
-
revokeTokens
Revokes all the tokens created for an identifier.- Parameters:
communicationUser
- The user to be revoked token.
-
revokeTokensWithResponse
public Response<Void> revokeTokensWithResponse(CommunicationUserIdentifier communicationUser, 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 AccessToken getToken(CommunicationUserIdentifier communicationUser, Iterable<CommunicationTokenScope> scopes) Gets a token for an identity.- Parameters:
communicationUser
- The user to be issued tokens.scopes
- The scopes that the token should have.- Returns:
- the token.
-
getTokenWithResponse
public Response<AccessToken> getTokenWithResponse(CommunicationUserIdentifier communicationUser, Iterable<CommunicationTokenScope> scopes, Context context) Gets a token for an identity.- Parameters:
communicationUser
- The CommunicationUser from whom to issue a token.scopes
- The scopes that the token should have.context
- the context of the request. Can also be null or Context.NONE.- Returns:
- the token with response.
-
getTokenForTeamsUser
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 Response<AccessToken> getTokenForTeamsUserWithResponse(GetTokenForTeamsUserOptions options, 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.
-