### 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:
- ""
inheritedClassMethods:
- classRef: "java.lang.Object"
methodsRef:
- "clone"
- "equals"
- "finalize"
- "getClass"
- "hashCode"
- "notify"
- "notifyAll"
- "toString"
- "wait"
- "wait"
- "wait"
syntax: "public class **OnBehalfOfCredential** implements "
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: ""
syntax: "public Mono getToken(TokenRequestContext request)"
returns:
type: "Mono<>"
- 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: ""
syntax: "public AccessToken getTokenSync(TokenRequestContext request)"
returns:
type: ""
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 , using the to configure it. The `tenantId`, `clientId` and `clientSecret` parameters are required to create . The `userAssertion` can be optionally specified on the . 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().clientId(\"\")\n .clientSecret(\"\")\n .tenantId(\"\")\n .userAssertion(\"\")\n .build();\n```"
implements:
- ""
metadata: {}
package: "com.azure.identity"
artifact: com.azure:azure-identity:1.14.1