com.azure.identity.ManagedIdentityMsalCredential Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of azure-identity Show documentation
Show all versions of azure-identity Show documentation
This module contains client library for Microsoft Azure Identity.
The newest version!
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License.
package com.azure.identity;
import com.azure.core.annotation.Immutable;
import com.azure.core.credential.AccessToken;
import com.azure.core.credential.TokenRequestContext;
import com.azure.identity.implementation.IdentityClient;
import reactor.core.publisher.Mono;
/**
* The Managed Service Identity credential for Virtual Machines.
*/
@Immutable
class ManagedIdentityMsalCredential extends ManagedIdentityServiceCredential {
private final IdentityClient identityClient;
/**
* Creates an instance of VirtualMachineMSICredential.
* @param clientId the client id of user assigned or system assigned identity
* @param identityClient the identity client to acquire a token with.
*/
ManagedIdentityMsalCredential(String clientId, IdentityClient identityClient) {
super(clientId, identityClient, "Managed Identity");
this.identityClient = identityClient;
}
/**
* Gets an access token for the token request.
*
* @param request The details of the token request.
* @return A publisher that emits an {@link AccessToken}.
*/
public Mono authenticate(TokenRequestContext request) {
return identityClient.authenticateWithManagedIdentityMsalClient(request);
}
}
© 2015 - 2024 Weber Informatics LLC | Privacy Policy