Package com.azure.identity
Class InteractiveBrowserCredentialBuilder
java.lang.Object
com.azure.identity.CredentialBuilderBase<T>
com.azure.identity.AadCredentialBuilderBase<InteractiveBrowserCredentialBuilder>
com.azure.identity.InteractiveBrowserCredentialBuilder
public class InteractiveBrowserCredentialBuilder
extends AadCredentialBuilderBase<InteractiveBrowserCredentialBuilder>
Fluent credential builder for instantiating a
InteractiveBrowserCredential
.- See Also:
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionauthenticationRecord
(AuthenticationRecord authenticationRecord) Sets theAuthenticationRecord
captured from a previous authentication.build()
Creates a newInteractiveBrowserCredential
with the current configurations.Disables the automatic authentication and prevents theInteractiveBrowserCredential
from automatically prompting the user.Sets the username suggestion to pre-fill the login page's username/email address field.port
(int port) Deprecated.redirectUrl
(String redirectUrl) Sets the Redirect URL where STS will callback the application with the security code.tokenCachePersistenceOptions
(TokenCachePersistenceOptions tokenCachePersistenceOptions) Configures the persistent shared token cache options and enables the persistent token cache which is disabled by default.Methods inherited from class com.azure.identity.AadCredentialBuilderBase
authorityHost, clientId, executorService, tenantId
Methods inherited from class com.azure.identity.CredentialBuilderBase
configuration, enableAccountIdentifierLogging, httpClient, httpPipeline, maxRetry, proxyOptions, retryTimeout
-
Constructor Details
-
InteractiveBrowserCredentialBuilder
public InteractiveBrowserCredentialBuilder()
-
-
Method Details
-
port
Deprecated.Configure the redirect URL ashttp://localhost:{port}
viaredirectUrl(String)
instead.Sets the port for the local HTTP server, for whichhttp://localhost:{port}
must be registered as a valid reply URL on the application.- Parameters:
port
- the port on which the credential will listen for the browser authentication result- Returns:
- the InteractiveBrowserCredentialBuilder itself
-
authenticationRecord
public InteractiveBrowserCredentialBuilder authenticationRecord(AuthenticationRecord authenticationRecord) Sets theAuthenticationRecord
captured from a previous authentication.- Parameters:
authenticationRecord
- The Authentication record to be configured.- Returns:
- An updated instance of this builder with the configured authentication record.
-
tokenCachePersistenceOptions
public InteractiveBrowserCredentialBuilder tokenCachePersistenceOptions(TokenCachePersistenceOptions tokenCachePersistenceOptions) Configures the persistent shared token cache options and enables the persistent token cache which is disabled by default. If configured, the credential will store tokens in a cache persisted to the machine, protected to the current user, which can be shared by other credentials and processes.- Parameters:
tokenCachePersistenceOptions
- the token cache configuration options- Returns:
- An updated instance of this builder with the token cache options configured.
-
redirectUrl
Sets the Redirect URL where STS will callback the application with the security code. It is required if a custom client id is specified viaAadCredentialBuilderBase.clientId(String)
and must match the redirect URL specified during the application registration.- Parameters:
redirectUrl
- the redirect URL to listen on and receive security code.- Returns:
- An updated instance of this builder with the configured redirect URL.
-
disableAutomaticAuthentication
Disables the automatic authentication and prevents theInteractiveBrowserCredential
from automatically prompting the user. If automatic authentication is disabled aAuthenticationRequiredException
will be thrown fromInteractiveBrowserCredential.getToken(TokenRequestContext)
in the case that user interaction is necessary. The application is responsible for handling this exception, and callingInteractiveBrowserCredential.authenticate()
orInteractiveBrowserCredential.authenticate(TokenRequestContext)
to authenticate the user interactively.- Returns:
- An updated instance of this builder with automatic authentication disabled.
-
loginHint
Sets the username suggestion to pre-fill the login page's username/email address field. A user may still log in with a different username.- Parameters:
loginHint
- the username suggestion to pre-fill the login page's username/email address field.- Returns:
- An updated instance of this builder with login hint configured.
-
build
Creates a newInteractiveBrowserCredential
with the current configurations.- Returns:
- a
InteractiveBrowserCredential
with the current configurations.
-
http://localhost:{port}
viaredirectUrl(String)
instead.