azure-docs-sdk-java/docs-ref-autogen/com.azure.identity.OnBehalf...

52 строки
6.1 KiB
YAML

### YamlMime:JavaType
uid: "com.azure.identity.OnBehalfOfCredential"
fullName: "com.azure.identity.OnBehalfOfCredential"
name: "OnBehalfOfCredential"
nameWithType: "OnBehalfOfCredential"
summary: "On Behalf of authentication in Azure is a way for a user or application to authenticate to a service or resource using credentials from another identity provider."
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 **OnBehalfOfCredential**</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.OnBehalfOfCredential.getToken(com.azure.core.credential.TokenRequestContext)"
fullName: "com.azure.identity.OnBehalfOfCredential.getToken(TokenRequestContext request)"
name: "getToken(TokenRequestContext request)"
nameWithType: "OnBehalfOfCredential.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>&lt;<xref href=\"com.azure.core.credential.AccessToken?alt=com.azure.core.credential.AccessToken&text=AccessToken\" data-throw-if-not-resolved=\"False\" />&gt;"
- uid: "com.azure.identity.OnBehalfOfCredential.getTokenSync(com.azure.core.credential.TokenRequestContext)"
fullName: "com.azure.identity.OnBehalfOfCredential.getTokenSync(TokenRequestContext request)"
name: "getTokenSync(TokenRequestContext request)"
nameWithType: "OnBehalfOfCredential.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: "On Behalf of authentication in Azure is a way for a user or application to authenticate to a service or resource using credentials from another identity provider. This type of authentication is typically used when a user or application wants to access a resource in Azure, but their credentials are managed by a different identity provider, such as an on-premises Active Directory or a third-party identity provider. To use \"On Behalf of\" authentication in Azure, the user must first authenticate to the identity provider using their credentials. The identity provider then issues a security token that contains information about the user and their permissions. This security token is then passed to Azure, which uses it to authenticate the user or application and grant them access to the requested resource. The OnBehalfOfCredential acquires a token with a client secret/certificate and user assertion for a Microsoft Entra application on behalf of a user principal.\n\nThe following code sample demonstrates the creation of a <xref uid=\"com.azure.identity.OnBehalfOfCredential\" data-throw-if-not-resolved=\"false\" data-raw-source=\"OnBehalfOfCredential\"></xref>, using the <xref uid=\"com.azure.identity.OnBehalfOfCredentialBuilder\" data-throw-if-not-resolved=\"false\" data-raw-source=\"OnBehalfOfCredentialBuilder\"></xref> to configure it. The `tenantId`, `clientId` and `clientSecret` parameters are required to create <xref uid=\"com.azure.identity.OnBehalfOfCredential\" data-throw-if-not-resolved=\"false\" data-raw-source=\"com.azure.identity.OnBehalfOfCredential\"></xref>. The `userAssertion` can be optionally specified on the <xref uid=\"com.azure.identity.OnBehalfOfCredentialBuilder\" data-throw-if-not-resolved=\"false\" data-raw-source=\"OnBehalfOfCredentialBuilder\"></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 onBehalfOfCredential = new OnBehalfOfCredentialBuilder()\n .clientId(\"<app-client-ID>\")\n .clientSecret(\"<app-Client-Secret>\")\n .tenantId(\"<app-tenant-ID>\")\n .userAssertion(\"<user-assertion>\")\n .build();\n```"
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