AbstractClientApplicationBase.Builder<T> Class
- java.
lang. Object - com.
microsoft. aad. msal4j. AbstractApplicationBase. Builder<T> - com.
microsoft. aad. msal4j. AbstractClientApplicationBase. Builder<T>
- com.
- com.
Type Parameters
- T
public abstract static class AbstractClientApplicationBase.Builder
extends Builder<T>
Field Summary
Modifier and Type | Field and Description |
---|---|
protected boolean | isInstanceDiscoveryEnabled |
Constructor Summary
Constructor | Description |
---|---|
Builder(String clientId) |
Constructor to create instance of Builder of client application |
Method Summary
Modifier and Type | Method and Description |
---|---|
T |
aadInstanceDiscoveryResponse(String val)
Sets instance discovery response data which will be used for determining tenant discovery endpoint and authority aliases. |
T |
applicationName(String val)
Sets application name for telemetry purposes |
T |
applicationVersion(String val)
Sets application version for telemetry purposes |
T |
authority(String val)
Set URL of the authenticating authority or security token service (STS) from which MSAL will acquire security tokens. |
T |
autoDetectRegion(boolean val)
Indicates that the library should attempt to discover the Azure region the application is running in when fetching the instance discovery metadata. |
T |
azureRegion(String val)
Set the region that the library will use to format authorities in token requests. |
T |
b2cAuthority(String val)
Set URL of the authenticating B2C authority from which MSAL will acquire tokens Valid B2C authorities should look like: https://<something. |
T | clientCapabilities(Set<String> capabilities) |
T |
connectTimeoutForDefaultHttpClient(Integer val)
Sets the connect timeout value used in Https |
T |
correlationId(String val)
Set optional correlation id to be used by the API. |
T |
executorService(ExecutorService val)
Sets Executor |
T |
httpClient(IHttpClient val)
Sets HTTP client to be used by the client application for all HTTP requests. |
T |
instanceDiscovery(boolean val)
Historically, MSAL would connect to a central endpoint located at ``https://login. |
T |
logPii(boolean val)
Set log |
T |
oidcAuthority(String val)
Set a known authority corresponding to a generic Open |
T |
proxy(Proxy val)
Sets Proxy configuration to be used by the client application (MSAL4J by default uses javax.net.ssl.HttpsURLConnection) for all network communication. |
T |
readTimeoutForDefaultHttpClient(Integer val)
Sets the read timeout value used in Https |
T |
setTokenCacheAccessAspect(ITokenCacheAccessAspect val)
Sets IToken |
T |
sslSocketFactory(SSLSocketFactory val)
Sets SSLSocket |
T |
validateAuthority(boolean val)
Set a boolean value telling the application if the authority needs to be verified against a list of known authorities. |
Methods inherited from Builder
Methods inherited from java.lang.Object
Field Details
isInstanceDiscoveryEnabled
protected boolean isInstanceDiscoveryEnabled
Constructor Details
Builder
public Builder(String clientId)
Constructor to create instance of Builder of client application
Parameters:
in the application registration portal (portal.azure.com)
Method Details
aadInstanceDiscoveryResponse
public T aadInstanceDiscoveryResponse(String val)
Sets instance discovery response data which will be used for determining tenant discovery endpoint and authority aliases.
Note that authority validation is not done even if AbstractClientApplicationBase#validateAuthority is set to true.
For more information, see https://aka.ms/msal4j-instance-discovery
Parameters:
Returns:
applicationName
public T applicationName(String val)
Sets application name for telemetry purposes
Parameters:
Returns:
applicationVersion
public T applicationVersion(String val)
Sets application version for telemetry purposes
Parameters:
Returns:
authority
public T authority(String val)
Set URL of the authenticating authority or security token service (STS) from which MSAL will acquire security tokens. The default value is AbstractClientApplicationBase#DEFAULT_AUTHORITY
Parameters:
Returns:
Throws:
autoDetectRegion
public T autoDetectRegion(boolean val)
Indicates that the library should attempt to discover the Azure region the application is running in when fetching the instance discovery metadata. Regions can only be detected when running in an Azure environment, such as an Azure VM or other service, or if the environment has environment variable named REGION_NAME configured. Although you can enable both autodetection here and a specific region with AbstractClientApplicationBase#azureRegion at the same time, the region set with AbstractClientApplicationBase#azureRegion will take priority if there is a mismatch. See here for more information about supported scenarios: https://aka.ms/msal4j-azure-regions
Parameters:
Returns:
azureRegion
public T azureRegion(String val)
Set the region that the library will use to format authorities in token requests. If given a valid Azure region, the library will attempt to make token requests at a regional ESTS-R endpoint rather than the global ESTS endpoint. Regions must be valid Azure regions and their short names should be used, such as 'westus' for the West US Azure region, 'centralus' for the Central US Azure region, etc. Although you can set a specific region here and enable autodetection with AbstractClientApplicationBase#autoDetectRegion at the same time the specific region set here will take priority over the autodetected region if there is a mismatch. See here for more information about supported scenarios: https://aka.ms/msal4j-azure-regions
Parameters:
Returns:
b2cAuthority
public T b2cAuthority(String val)
Set URL of the authenticating B2C authority from which MSAL will acquire tokens Valid B2C authorities should look like: https://<something.b2clogin.com// MSAL Java also supports a legacy B2C authority format, which looks like: https:///tfp// However, MSAL Java will eventually stop supporting the legacy format. See here for information on how to migrate to the new format: https://aka.ms/msal4j-b2c
Parameters:
Returns:
Throws:
clientCapabilities
public T clientCapabilities(Set
Parameters:
connectTimeoutForDefaultHttpClient
public T connectTimeoutForDefaultHttpClient(Integer val)
Sets the connect timeout value used in HttpsURLConnection connections made by DefaultHttpClient, and is not needed if using a custom HTTP client
Overrides:
AbstractClientApplicationBase.Builder<T>.connectTimeoutForDefaultHttpClient(Integer val)Parameters:
Returns:
correlationId
public T correlationId(String val)
Set optional correlation id to be used by the API. If not provided, the API generates a random UUID.
Overrides:
AbstractClientApplicationBase.Builder<T>.correlationId(String val)Parameters:
Returns:
executorService
public T executorService(ExecutorService val)
Sets ExecutorService to be used to execute the requests. Developer is responsible for maintaining the lifecycle of the ExecutorService.
Overrides:
AbstractClientApplicationBase.Builder<T>.executorService(ExecutorService val)Parameters:
Returns:
httpClient
public T httpClient(IHttpClient val)
Sets HTTP client to be used by the client application for all HTTP requests. Allows for fine grained configuration of HTTP client.
Overrides:
AbstractClientApplicationBase.Builder<T>.httpClient(IHttpClient val)Parameters:
Returns:
instanceDiscovery
public T instanceDiscovery(boolean val)
Historically, MSAL would connect to a central endpoint located at ``https://login.microsoftonline.com`` to acquire some metadata, especially when using an unfamiliar authority. This behavior is known as Instance Discovery. This parameter defaults to true, which enables the Instance Discovery. If you do not know some authorities beforehand, yet still want MSAL to accept any authority that you will provide, you can use a ``False`` to unconditionally disable Instance Discovery.
Parameters:
logPii
public T logPii(boolean val)
Set logPii - boolean value, which determines whether Pii (personally identifiable information) will be logged in. The default value is false.
Overrides:
AbstractClientApplicationBase.Builder<T>.logPii(boolean val)Parameters:
Returns:
oidcAuthority
public T oidcAuthority(String val)
Set a known authority corresponding to a generic OpenIdConnect Identity Provider. MSAL will append ".well-known/openid-configuration" to the authority to retrieve the OIDC metadata and determine the endpoints.
Parameters:
Returns:
Throws:
proxy
public T proxy(Proxy val)
Sets Proxy configuration to be used by the client application (MSAL4J by default uses javax.net.ssl.HttpsURLConnection) for all network communication. If no proxy value is passed in, system defined properties are used. If HTTP client is set on the client application (via ClientApplication.builder().httpClient()), proxy configuration should be done on the HTTP client object being passed in, and not through this method.
Overrides:
AbstractClientApplicationBase.Builder<T>.proxy(Proxy val)Parameters:
Returns:
readTimeoutForDefaultHttpClient
public T readTimeoutForDefaultHttpClient(Integer val)
Sets the read timeout value used in HttpsURLConnection connections made by DefaultHttpClient, and is not needed if using a custom HTTP client
Overrides:
AbstractClientApplicationBase.Builder<T>.readTimeoutForDefaultHttpClient(Integer val)Parameters:
Returns:
setTokenCacheAccessAspect
public T setTokenCacheAccessAspect(ITokenCacheAccessAspect val)
Sets ITokenCacheAccessAspect to be used for cache_data persistence.
Parameters:
Returns:
sslSocketFactory
public T sslSocketFactory(SSLSocketFactory val)
Sets SSLSocketFactory to be used by the client application for all network communication. If HTTP client is set on the client application (via ClientApplication.builder().httpClient()), any configuration of SSL should be done on the HTTP client and not through this method.
Overrides:
AbstractClientApplicationBase.Builder<T>.sslSocketFactory(SSLSocketFactory val)Parameters:
Returns:
validateAuthority
public T validateAuthority(boolean val)
Set a boolean value telling the application if the authority needs to be verified against a list of known authorities. Authority is only validated when: 1 - It is an Azure Active Directory authority (not B2C or ADFS) 2 - Instance discovery metadata is not set via AbstractClientApplicationBase#aadAadInstanceDiscoveryResponse
The default value is true.
Parameters:
Returns: