Class ClientCertificateCredential

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

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

Sample: Construct a simple ClientCertificateCredential

 ClientCertificateCredential credential1 = new ClientCertificateCredentialBuilder()
     .tenantId(tenantId)
     .clientId(clientId)
     .pemCertificate("<PATH-TO-PEM-CERTIFICATE>")
     .build();
 

Sample: Construct a ClientCertificateCredential behind a proxy

 ClientCertificateCredential credential2 = new ClientCertificateCredentialBuilder()
     .tenantId(tenantId)
     .clientId(clientId)
     .pfxCertificate("<PATH-TO-PFX-CERTIFICATE>", "P@s$w0rd")
     .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
    • getTokenSync

      public com.azure.core.credential.AccessToken getTokenSync(com.azure.core.credential.TokenRequestContext request)
      Specified by:
      getTokenSync in interface com.azure.core.credential.TokenCredential