public class ChainedTokenCredential extends Object implements com.azure.core.credential.TokenCredential
Sample: Construct a ChainedTokenCredential with silent username+password login tried first, then interactive browser login as needed (e.g. when 2FA is turned on in the directory).
UsernamePasswordCredential usernamePasswordCredential = new UsernamePasswordCredentialBuilder()
.clientId(clientId)
.username(username)
.password(password)
.build();
InteractiveBrowserCredential interactiveBrowserCredential = new InteractiveBrowserCredentialBuilder()
.clientId(clientId)
.port(8765)
.build();
ChainedTokenCredential credential = new ChainedTokenCredentialBuilder()
.addLast(usernamePasswordCredential)
.addLast(interactiveBrowserCredential)
.build();
| Modifier and Type | Method and Description |
|---|---|
Mono<com.azure.core.credential.AccessToken> |
getToken(com.azure.core.credential.TokenRequestContext request) |
public Mono<com.azure.core.credential.AccessToken> getToken(com.azure.core.credential.TokenRequestContext request)
getToken in interface com.azure.core.credential.TokenCredentialCopyright © 2020 Microsoft Corporation. All rights reserved.