SharedTokenCacheCredentialBuilder Class

public class SharedTokenCacheCredentialBuilder
extends AadCredentialBuilderBase<SharedTokenCacheCredentialBuilder>

Fluent credential builder for instantiating a SharedTokenCacheCredential.

This credential is a legacy mechanism for authenticating clients using credentials provided to Visual Studio Code. This mechanism for Visual Studio authentication has been replaced by the VisualStudioCodeCredential/>.

Constructor Summary

Constructor Description
SharedTokenCacheCredentialBuilder()

Constructs an instance of SharedTokenCacheCredentialBuilder.

Method Summary

Modifier and Type Method and Description
SharedTokenCacheCredentialBuilder authenticationRecord(AuthenticationRecord authenticationRecord)

Sets the AuthenticationRecord captured from a previous authentication.

SharedTokenCacheCredential build()

Creates a new SharedTokenCacheCredentialBuilder with the current configurations.

SharedTokenCacheCredentialBuilder tokenCachePersistenceOptions(TokenCachePersistenceOptions tokenCachePersistenceOptions)

Configures the persistent shared token cache options and enables the persistent token cache which is disabled by default.

SharedTokenCacheCredentialBuilder username(String username)

Sets the username for the account.

Methods inherited from AadCredentialBuilderBase

Methods inherited from CredentialBuilderBase

Methods inherited from java.lang.Object

Constructor Details

SharedTokenCacheCredentialBuilder

public SharedTokenCacheCredentialBuilder()

Constructs an instance of SharedTokenCacheCredentialBuilder.

Method Details

authenticationRecord

public SharedTokenCacheCredentialBuilder authenticationRecord(AuthenticationRecord authenticationRecord)

Sets the AuthenticationRecord 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.

build

public SharedTokenCacheCredential build()

Creates a new SharedTokenCacheCredentialBuilder with the current configurations.

Returns:

a SharedTokenCacheCredentialBuilder with the current configurations.

tokenCachePersistenceOptions

public SharedTokenCacheCredentialBuilder 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.

username

public SharedTokenCacheCredentialBuilder username(String username)

Sets the username for the account.

Parameters:

username - The username for the account.

Returns:

The updated SharedTokenCacheCredentialBuilder object.

Applies to