Class ClientSecretCredential

java.lang.Object
com.azure.identity.ClientSecretCredential
All Implemented Interfaces:
com.azure.core.credential.TokenCredential

public class ClientSecretCredential extends Object implements com.azure.core.credential.TokenCredential
An AAD credential that acquires a token with a client secret for an AAD application.

Sample: Construct a simple ClientSecretCredential

 ClientSecretCredential credential1 = new ClientSecretCredentialBuilder()
     .tenantId(tenantId)
     .clientId(clientId)
     .clientSecret(clientSecret)
     .build();
 

Sample: Construct a ClientSecretCredential behind a proxy

 ClientSecretCredential credential2 = new ClientSecretCredentialBuilder()
     .tenantId(tenantId)
     .clientId(clientId)
     .clientSecret(clientSecret)
     .proxyOptions(new ProxyOptions(Type.HTTP, new InetSocketAddress("10.21.32.43", 5465)))
     .build();
 
  • Method Details

    • getToken

      public Mono<com.azure.core.credential.AccessToken> getToken(com.azure.core.credential.TokenRequestContext request)
      Specified by:
      getToken in interface com.azure.core.credential.TokenCredential