Dela via


ClientCredentialFactory Class

  • java.lang.Object
    • com.microsoft.aad.msal4j.ClientCredentialFactory

public class ClientCredentialFactory

Factory for creating client credentials used in confidential client flows. For more details, see https://aka.ms/msal4j-client-credentials

Constructor Summary

Constructor Description
ClientCredentialFactory()

Method Summary

Modifier and Type Method and Description
static IClientAssertion createFromCallback(Callable<String> callable)

Static method to create a ClientAssertion instance from a provided Callable.

static IClientCertificate createFromCertificate(InputStream pkcs12Certificate, String password)

Static method to create a ClientCertificate instance from a password-protected certificate.

static IClientCertificate createFromCertificate(PrivateKey key, X509Certificate publicKeyCertificate)

Static method to create a ClientCertificate instance from a private key/public certificate pair.

static IClientCertificate createFromCertificateChain(PrivateKey key, List<X509Certificate> publicKeyCertificateChain)

Static method to create a ClientCertificate instance from a certificate chain.

static IClientAssertion createFromClientAssertion(String clientAssertion)

Static method to create a ClientAssertion instance from a JWT token encoded as a base64 URL encoded string.

static IClientSecret createFromSecret(String secret)

Static method to create a ClientSecret instance from a client secret

Methods inherited from java.lang.Object

java.lang.Object.clone java.lang.Object.equals java.lang.Object.finalize java.lang.Object.getClass java.lang.Object.hashCode java.lang.Object.notify java.lang.Object.notifyAll java.lang.Object.toString java.lang.Object.wait java.lang.Object.wait java.lang.Object.wait

Constructor Details

ClientCredentialFactory

public ClientCredentialFactory()

Method Details

createFromCallback

public static IClientAssertion createFromCallback(Callable callable)

Static method to create a ClientAssertion instance from a provided Callable.

Parameters:

callable - Callable that produces a JWT token encoded as a base64 URL encoded string

Returns:

ClientAssertion

Throws:

java.util.concurrent.ExecutionException
java.lang.InterruptedException

createFromCertificate

public static IClientCertificate createFromCertificate(InputStream pkcs12Certificate, String password)

Static method to create a ClientCertificate instance from a password-protected certificate.

Parameters:

pkcs12Certificate - InputStream containing PCKS12 formatted certificate
password - certificate password

Returns:

ClientCertificate

Throws:

java.security.cert.CertificateException
java.security.UnrecoverableKeyException
java.security.NoSuchAlgorithmException
java.security.KeyStoreException
java.security.NoSuchProviderException
java.io.IOException

createFromCertificate

public static IClientCertificate createFromCertificate(PrivateKey key, X509Certificate publicKeyCertificate)

Static method to create a ClientCertificate instance from a private key/public certificate pair.

Parameters:

key - RSA private key to sign the assertion.
publicKeyCertificate - x509 public certificate used for thumbprint

Returns:

ClientCertificate

createFromCertificateChain

public static IClientCertificate createFromCertificateChain(PrivateKey key, List publicKeyCertificateChain)

Static method to create a ClientCertificate instance from a certificate chain.

Parameters:

key - RSA private key to sign the assertion.
publicKeyCertificateChain - ordered with the user's certificate first followed by zero or more certificate authorities

Returns:

ClientCertificate

createFromClientAssertion

public static IClientAssertion createFromClientAssertion(String clientAssertion)

Static method to create a ClientAssertion instance from a JWT token encoded as a base64 URL encoded string.

Parameters:

clientAssertion - JWT token encoded as a base64 URL encoded string

Returns:

ClientAssertion

createFromSecret

public static IClientSecret createFromSecret(String secret)

Static method to create a ClientSecret instance from a client secret

Parameters:

secret - secret of application requesting a token

Returns:

ClientSecret

Applies to