76 строки
8.5 KiB
YAML
76 строки
8.5 KiB
YAML
### YamlMime:JavaType
|
|
uid: "com.azure.identity.UsernamePasswordCredential"
|
|
fullName: "com.azure.identity.UsernamePasswordCredential"
|
|
name: "UsernamePasswordCredential"
|
|
nameWithType: "UsernamePasswordCredential"
|
|
summary: "Username password authentication is a common type of authentication flow used by many applications and services, including [Microsoft Entra ID][].\n\n\n[Microsoft Entra ID]: https://learn.microsoft.com/entra/fundamentals/"
|
|
inheritances:
|
|
- "<xref href=\"java.lang.Object?displayProperty=fullName\" data-throw-if-not-resolved=\"False\" />"
|
|
inheritedClassMethods:
|
|
- classRef: "java.lang.<a href=\"https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html\">Object</a>"
|
|
methodsRef:
|
|
- "<a href=\"https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html#clone--\">clone</a>"
|
|
- "<a href=\"https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html#equals-java.lang.Object-\">equals</a>"
|
|
- "<a href=\"https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html#finalize--\">finalize</a>"
|
|
- "<a href=\"https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html#getClass--\">getClass</a>"
|
|
- "<a href=\"https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html#hashCode--\">hashCode</a>"
|
|
- "<a href=\"https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html#notify--\">notify</a>"
|
|
- "<a href=\"https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html#notifyAll--\">notifyAll</a>"
|
|
- "<a href=\"https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html#toString--\">toString</a>"
|
|
- "<a href=\"https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html#wait--\">wait</a>"
|
|
- "<a href=\"https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html#wait-long-\">wait</a>"
|
|
- "<a href=\"https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html#wait-long-int-\">wait</a>"
|
|
syntax: "public class **UsernamePasswordCredential**</br> implements <xref href=\"com.azure.core.credential.TokenCredential?alt=com.azure.core.credential.TokenCredential&text=TokenCredential\" data-throw-if-not-resolved=\"False\" />"
|
|
methods:
|
|
- uid: "com.azure.identity.UsernamePasswordCredential.authenticate()"
|
|
fullName: "com.azure.identity.UsernamePasswordCredential.authenticate()"
|
|
name: "authenticate()"
|
|
nameWithType: "UsernamePasswordCredential.authenticate()"
|
|
summary: "Authenticates the user using the specified username and password."
|
|
syntax: "public Mono<AuthenticationRecord> authenticate()"
|
|
desc: "Authenticates the user using the specified username and password."
|
|
returns:
|
|
description: "The <xref uid=\"com.azure.identity.AuthenticationRecord\" data-throw-if-not-resolved=\"false\" data-raw-source=\"AuthenticationRecord\"></xref> of the authenticated account."
|
|
type: "<a href=\"https://projectreactor.io/docs/core/release/api/reactor/core/publisher/Mono.html\">Mono</a><<xref href=\"com.azure.identity.AuthenticationRecord?alt=com.azure.identity.AuthenticationRecord&text=AuthenticationRecord\" data-throw-if-not-resolved=\"False\" />>"
|
|
- uid: "com.azure.identity.UsernamePasswordCredential.authenticate(com.azure.core.credential.TokenRequestContext)"
|
|
fullName: "com.azure.identity.UsernamePasswordCredential.authenticate(TokenRequestContext request)"
|
|
name: "authenticate(TokenRequestContext request)"
|
|
nameWithType: "UsernamePasswordCredential.authenticate(TokenRequestContext request)"
|
|
summary: "Authenticates the user using the specified username and password."
|
|
parameters:
|
|
- description: "The details of the authentication request."
|
|
name: "request"
|
|
type: "<xref href=\"com.azure.core.credential.TokenRequestContext?alt=com.azure.core.credential.TokenRequestContext&text=TokenRequestContext\" data-throw-if-not-resolved=\"False\" />"
|
|
syntax: "public Mono<AuthenticationRecord> authenticate(TokenRequestContext request)"
|
|
desc: "Authenticates the user using the specified username and password."
|
|
returns:
|
|
description: "The <xref uid=\"com.azure.identity.AuthenticationRecord\" data-throw-if-not-resolved=\"false\" data-raw-source=\"AuthenticationRecord\"></xref> of the authenticated account."
|
|
type: "<a href=\"https://projectreactor.io/docs/core/release/api/reactor/core/publisher/Mono.html\">Mono</a><<xref href=\"com.azure.identity.AuthenticationRecord?alt=com.azure.identity.AuthenticationRecord&text=AuthenticationRecord\" data-throw-if-not-resolved=\"False\" />>"
|
|
- uid: "com.azure.identity.UsernamePasswordCredential.getToken(com.azure.core.credential.TokenRequestContext)"
|
|
fullName: "com.azure.identity.UsernamePasswordCredential.getToken(TokenRequestContext request)"
|
|
name: "getToken(TokenRequestContext request)"
|
|
nameWithType: "UsernamePasswordCredential.getToken(TokenRequestContext request)"
|
|
parameters:
|
|
- name: "request"
|
|
type: "<xref href=\"com.azure.core.credential.TokenRequestContext?alt=com.azure.core.credential.TokenRequestContext&text=TokenRequestContext\" data-throw-if-not-resolved=\"False\" />"
|
|
syntax: "public Mono<AccessToken> getToken(TokenRequestContext request)"
|
|
returns:
|
|
type: "<a href=\"https://projectreactor.io/docs/core/release/api/reactor/core/publisher/Mono.html\">Mono</a><<xref href=\"com.azure.core.credential.AccessToken?alt=com.azure.core.credential.AccessToken&text=AccessToken\" data-throw-if-not-resolved=\"False\" />>"
|
|
- uid: "com.azure.identity.UsernamePasswordCredential.getTokenSync(com.azure.core.credential.TokenRequestContext)"
|
|
fullName: "com.azure.identity.UsernamePasswordCredential.getTokenSync(TokenRequestContext request)"
|
|
name: "getTokenSync(TokenRequestContext request)"
|
|
nameWithType: "UsernamePasswordCredential.getTokenSync(TokenRequestContext request)"
|
|
parameters:
|
|
- name: "request"
|
|
type: "<xref href=\"com.azure.core.credential.TokenRequestContext?alt=com.azure.core.credential.TokenRequestContext&text=TokenRequestContext\" data-throw-if-not-resolved=\"False\" />"
|
|
syntax: "public AccessToken getTokenSync(TokenRequestContext request)"
|
|
returns:
|
|
type: "<xref href=\"com.azure.core.credential.AccessToken?alt=com.azure.core.credential.AccessToken&text=AccessToken\" data-throw-if-not-resolved=\"False\" />"
|
|
type: "class"
|
|
desc: "Username password authentication is a common type of authentication flow used by many applications and services, including [Microsoft Entra ID][]. With username password authentication, users enter their username and password credentials to sign in to an application or service. The UsernamePasswordCredential authenticates a public client application and acquires a token using the user credentials that don't require 2FA/MFA (Multi-factored) authentication. For more information refer to the [conceptual knowledge and configuration details][].\n\nIn the scenario where 2FA/MFA (Multi-factored) authentication is turned on, please use <xref uid=\"com.azure.identity.DeviceCodeCredential\" data-throw-if-not-resolved=\"false\" data-raw-source=\"DeviceCodeCredential\"></xref> or <xref uid=\"com.azure.identity.InteractiveBrowserCredential\" data-throw-if-not-resolved=\"false\" data-raw-source=\"InteractiveBrowserCredential\"></xref> instead.\n\n**Sample: Construct UsernamePasswordCredential**\n\nThe following code sample demonstrates the creation of a <xref uid=\"com.azure.identity.UsernamePasswordCredential\" data-throw-if-not-resolved=\"false\" data-raw-source=\"UsernamePasswordCredential\"></xref>, using the <xref uid=\"com.azure.identity.UsernamePasswordCredentialBuilder\" data-throw-if-not-resolved=\"false\" data-raw-source=\"UsernamePasswordCredentialBuilder\"></xref> to configure it. The `clientId`, `username` and `password` parameters are required to create <xref uid=\"com.azure.identity.UsernamePasswordCredential\" data-throw-if-not-resolved=\"false\" data-raw-source=\"UsernamePasswordCredential\"></xref>. Once this credential is created, it may be passed into the builder of many of the Azure SDK for Java client builders as the 'credential' parameter.\n\n```java\nTokenCredential usernamePasswordCredential = new UsernamePasswordCredentialBuilder()\n .clientId(\"<your app client ID>\")\n .username(\"<your username>\")\n .password(\"<your password>\")\n .build();\n```\n\n\n[Microsoft Entra ID]: https://learn.microsoft.com/entra/fundamentals/\n[conceptual knowledge and configuration details]: https://aka.ms/azsdk/java/identity/usernamepasswordcredential/docs"
|
|
implements:
|
|
- "<xref href=\"com.azure.core.credential.TokenCredential?alt=com.azure.core.credential.TokenCredential&text=TokenCredential\" data-throw-if-not-resolved=\"False\" />"
|
|
metadata: {}
|
|
package: "com.azure.identity"
|
|
artifact: com.azure:azure-identity:1.13.3
|