com.azure.core.credential.TokenCredential Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of azure-core Show documentation
Show all versions of azure-core Show documentation
This package contains core types for Azure Java clients.
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License.
package com.azure.core.credential;
import reactor.core.publisher.Mono;
/**
* The interface for credentials that can provide a token.
*/
@FunctionalInterface
public interface TokenCredential {
/**
* Asynchronously get a token for a given resource/audience.
*
* This method is called automatically by Azure SDK client libraries.
* You may call this method directly, but you must also handle token
* caching and token refreshing.
*
* @param request the details of the token request
* @return a Publisher that emits a single access token
*/
Mono getToken(TokenRequestContext request);
/**
* Synchronously get a token for a given resource/audience.
*
* This method is called automatically by Azure SDK client libraries.
* You may call this method directly, but you must also handle token
* caching and token refreshing.
*
* @param request the details of the token request
* @return The Access Token
*/
default AccessToken getTokenSync(TokenRequestContext request) {
return getToken(request).block();
}
}
© 2015 - 2024 Weber Informatics LLC | Privacy Policy