Package com.azure.identity
Class UsernamePasswordCredential
- java.lang.Object
-
- com.azure.identity.UsernamePasswordCredential
-
- All Implemented Interfaces:
com.azure.core.credential.TokenCredential
public class UsernamePasswordCredential extends Object implements com.azure.core.credential.TokenCredential
An AAD credential that acquires a token with a username and a password. Users with 2FA/MFA (Multi-factored auth) turned on will not be able to use this credential. Please useDeviceCodeCredential
orInteractiveBrowserCredential
instead, or create a service principal if you want to authenticate silently.
-
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description Mono<AuthenticationRecord>
authenticate()
Authenticates the user using the specified username and password.Mono<AuthenticationRecord>
authenticate(com.azure.core.credential.TokenRequestContext request)
Authenticates the user using the specified username and password.Mono<com.azure.core.credential.AccessToken>
getToken(com.azure.core.credential.TokenRequestContext request)
-
-
-
Method Detail
-
getToken
public Mono<com.azure.core.credential.AccessToken> getToken(com.azure.core.credential.TokenRequestContext request)
- Specified by:
getToken
in interfacecom.azure.core.credential.TokenCredential
-
authenticate
public Mono<AuthenticationRecord> authenticate(com.azure.core.credential.TokenRequestContext request)
Authenticates the user using the specified username and password.- Parameters:
request
- The details of the authentication request.- Returns:
- The
AuthenticationRecord
of the authenticated account.
-
authenticate
public Mono<AuthenticationRecord> authenticate()
Authenticates the user using the specified username and password.- Returns:
- The
AuthenticationRecord
of the authenticated account.
-
-