public class PublicClientApplication extends AbstractClientApplicationBase implements IPublicClientApplication
IPublicClientApplication
Conditionally thread-safe
Modifier and Type | Class and Description |
---|---|
static class |
PublicClientApplication.Builder |
Modifier and Type | Field and Description |
---|---|
static String |
DEFAULT_AUTHORITY |
azureRegion
authenticationAuthority, log, tokenCache
Modifier and Type | Method and Description |
---|---|
CompletableFuture<IAuthenticationResult> |
acquireToken(AuthorizationCodeParameters parameters)
Acquires security token from the authority using an authorization code previously received.
|
CompletableFuture<IAuthenticationResult> |
acquireToken(DeviceCodeFlowParameters parameters)
Acquires security token from the authority using an device code flow.
|
CompletableFuture<IAuthenticationResult> |
acquireToken(IntegratedWindowsAuthenticationParameters parameters)
Acquires tokens from the authority configured in the application via Integrated Windows Authentication.
|
CompletableFuture<IAuthenticationResult> |
acquireToken(InteractiveRequestParameters parameters)
Acquires tokens from the authority using authorization code grant.
|
CompletableFuture<IAuthenticationResult> |
acquireToken(RefreshTokenParameters parameters)
Acquires a security token from the authority using a refresh token previously received.
|
CompletableFuture<IAuthenticationResult> |
acquireToken(UserNamePasswordParameters parameters)
Acquires tokens from the authority configured in the application via Username/Password authentication.
|
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.
|
String |
authority() |
static PublicClientApplication.Builder |
builder(String clientId) |
protected com.nimbusds.oauth2.sdk.auth.ClientAuthentication |
clientAuthentication() |
String |
clientId() |
String |
correlationId() |
CompletableFuture<Set<IAccount>> |
getAccounts()
Returns accounts in the cache
|
URL |
getAuthorizationRequestUrl(AuthorizationRequestUrlParameters parameters)
Computes the URL of the authorization request letting the user sign-in and consent to the
application.
|
IHttpClient |
httpClient()
Sets HTTP client to be used by the client application for all HTTP requests.
|
boolean |
logPii() |
Proxy |
proxy() |
CompletableFuture<Void> |
removeAccount(IAccount account)
Removes IAccount from the cache
|
SSLSocketFactory |
sslSocketFactory() |
boolean |
validateAuthority() |
aadAadInstanceDiscoveryResponse, acquireToken, acquireToken, applicationName, applicationVersion, authority, autoDetectRegion, azureRegion, clientCapabilities, clientId, getAccounts, getAuthorizationRequestUrl, instanceDiscovery, tokenCache, validateAuthority
connectTimeoutForDefaultHttpClient, correlationId, httpClient, logPii, proxy, readTimeoutForDefaultHttpClient, sslSocketFactory
public static final String DEFAULT_AUTHORITY
public CompletableFuture<IAuthenticationResult> acquireToken(UserNamePasswordParameters parameters)
IPublicClientApplication
acquireToken
in interface IPublicClientApplication
parameters
- instance of UserNamePasswordParameters
CompletableFuture
containing an IAuthenticationResult
public CompletableFuture<IAuthenticationResult> acquireToken(IntegratedWindowsAuthenticationParameters parameters)
IPublicClientApplication
acquireToken
in interface IPublicClientApplication
parameters
- instance of IntegratedWindowsAuthenticationParameters
CompletableFuture
containing an IAuthenticationResult
public CompletableFuture<IAuthenticationResult> acquireToken(DeviceCodeFlowParameters parameters)
IPublicClientApplication
acquireToken
in interface IPublicClientApplication
parameters
- instance of DeviceCodeFlowParameters
CompletableFuture
containing an IAuthenticationResult
public CompletableFuture<IAuthenticationResult> acquireToken(InteractiveRequestParameters parameters)
IPublicClientApplication
InteractiveRequestParameters.systemBrowserOptions
.
For more information, see https://aka.ms/msal4j-interactive-requestacquireToken
in interface IPublicClientApplication
parameters
- instance of InteractiveRequestParameters
CompletableFuture
containing an IAuthenticationResult
public CompletableFuture<IAuthenticationResult> acquireTokenSilently(SilentParameters parameters) throws MalformedURLException
acquireTokenSilently
in class AbstractClientApplicationBase
parameters
- instance of SilentParametersCompletableFuture
object representing the IAuthenticationResult
of the call.MalformedURLException
- if authorityUrl from parameters is malformed URLpublic CompletableFuture<Void> removeAccount(IAccount account)
removeAccount
in class AbstractClientApplicationBase
account
- instance of Account to be removed from cacheCompletableFuture
object representing account removal task.protected com.nimbusds.oauth2.sdk.auth.ClientAuthentication clientAuthentication()
clientAuthentication
in class AbstractClientApplicationBase
public static PublicClientApplication.Builder builder(String clientId)
clientId
- Client ID (Application ID) of the application as registered
in the application registration portal (portal.azure.com)public String clientId()
public String authority()
IApplicationBase.DEFAULT_AUTHORITY
public boolean validateAuthority()
public URL getAuthorizationRequestUrl(AuthorizationRequestUrlParameters parameters)
Once the user successfully authenticates, the response should contain an authorization code,
which can then be passed in toAbstractClientApplicationBase.acquireToken(AuthorizationCodeParameters)
to be exchanged for a token
parameters
- AuthorizationRequestUrlParameters
public CompletableFuture<IAuthenticationResult> acquireToken(AuthorizationCodeParameters parameters)
parameters
- AuthorizationCodeParameters
CompletableFuture
object representing the IAuthenticationResult
of the call.public CompletableFuture<IAuthenticationResult> acquireToken(RefreshTokenParameters parameters)
parameters
- RefreshTokenParameters
CompletableFuture
object representing the IAuthenticationResult
of the call.public CompletableFuture<Set<IAccount>> getAccounts()
public boolean logPii()
public String correlationId()
public IHttpClient httpClient()
public Proxy proxy()
public SSLSocketFactory sslSocketFactory()
Copyright © 2013–2024. All rights reserved.