AbstractClientApplicationBase Class

Implements

com.microsoft.aad.msal4j.IClientApplicationBase

public abstract class AbstractClientApplicationBase
extends AbstractApplicationBase
implements com.microsoft.aad.msal4j.IClientApplicationBase

Abstract class containing common methods and properties to both PublicClientApplication and ConfidentialClientApplication.

Field Summary

Modifier and Type Field and Description
protected java.lang.String azureRegion

Method Summary

Modifier and Type Method and Description
com.microsoft.aad.msal4j.AadInstanceDiscoveryResponse aadAadInstanceDiscoveryResponse()
java.util.concurrent.CompletableFuture<IAuthenticationResult> acquireToken(AuthorizationCodeParameters parameters)

Acquires security token from the authority using an authorization code previously received.

java.util.concurrent.CompletableFuture<IAuthenticationResult> acquireToken(RefreshTokenParameters parameters)

Acquires a security token from the authority using a refresh token previously received.

java.util.concurrent.CompletableFuture<IAuthenticationResult> acquireTokenSilently(SilentParameters parameters)

Returns tokens from cache if present and not expired or acquires new tokens from the authority by using the refresh token present in cache.

java.lang.String applicationName()
java.lang.String applicationVersion()
java.lang.String authority()

Gets the authority URL for this application.

boolean autoDetectRegion()
java.lang.String azureRegion()
java.lang.String clientCapabilities()
java.lang.String clientId()

Gets the client ID (application ID) for this application.

java.util.concurrent.CompletableFuture<java.util.Set<IAccount>> getAccounts()

Returns accounts in the cache

java.net.URL getAuthorizationRequestUrl(AuthorizationRequestUrlParameters parameters)

Computes the URL of the authorization request letting the user sign-in and consent to the application.

boolean instanceDiscovery()
java.util.concurrent.CompletableFuture<java.lang.Void> removeAccount(IAccount account)

Removes IAccount from the cache

TokenCache tokenCache()
boolean validateAuthority()

Gets whether the authority URL should be validated against a list of known authorities.

Methods inherited from AbstractApplicationBase

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

Field Details

azureRegion

protected String azureRegion

Method Details

aadAadInstanceDiscoveryResponse

public AadInstanceDiscoveryResponse aadAadInstanceDiscoveryResponse()

acquireToken

public CompletableFuture<IAuthenticationResult> acquireToken(AuthorizationCodeParameters parameters)

Acquires security token from the authority using an authorization code previously received.

This is typically used as the second step in an authorization code flow, after the user has authenticated and provided consent at the authorization endpoint, resulting in an authorization code.

Parameters:

parameters

acquireToken

public CompletableFuture<IAuthenticationResult> acquireToken(RefreshTokenParameters parameters)

Acquires a security token from the authority using a refresh token previously received. Can be used in migration to MSAL from ADAL, and in various integration scenarios where you have a refresh token available.

Parameters:

parameters

acquireTokenSilently

public CompletableFuture<IAuthenticationResult> acquireTokenSilently(SilentParameters parameters)

Returns tokens from cache if present and not expired or acquires new tokens from the authority by using the refresh token present in cache.

Parameters:

parameters

Throws:

java.net.MalformedURLException

applicationName

public String applicationName()

applicationVersion

public String applicationVersion()

authority

public String authority()

Gets the authority URL for this application.

autoDetectRegion

public boolean autoDetectRegion()

azureRegion

public String azureRegion()

clientCapabilities

public String clientCapabilities()

clientId

public String clientId()

Gets the client ID (application ID) for this application.

getAccounts

public CompletableFuture<Set<IAccount>> getAccounts()

Returns accounts in the cache

getAuthorizationRequestUrl

public URL getAuthorizationRequestUrl(AuthorizationRequestUrlParameters parameters)

Computes the URL of the authorization request letting the user sign-in and consent to the application. The URL target the /authorize endpoint of the authority configured in the application object.

Once the user successfully authenticates, the response should contain an authorization code, which can then be passed in to acquireToken(AuthorizationCodeParameters parameters) to be exchanged for a token.

Parameters:

parameters

instanceDiscovery

public boolean instanceDiscovery()

removeAccount

public CompletableFuture<Void> removeAccount(IAccount account)

Removes IAccount from the cache

Parameters:

account

tokenCache

public TokenCache tokenCache()

validateAuthority

public boolean validateAuthority()

Gets whether the authority URL should be validated against a list of known authorities.

Applies to