Skip to content

Commit 75fdd40

Browse files
authored
Add more info to getToken() method (Azure#15788)
* Add more info to getToken() method * Fix javadocs * Improve doc wording on ChainedTokenCredential
1 parent 5672b86 commit 75fdd40

File tree

2 files changed

+16
-0
lines changed

2 files changed

+16
-0
lines changed

sdk/core/azure-core/src/main/java/com/azure/core/credential/TokenCredential.java

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,11 @@
1212
public interface TokenCredential {
1313
/**
1414
* Asynchronously get a token for a given resource/audience.
15+
*
16+
* This method is called automatically by Azure SDK client libraries.
17+
* You may call this method directly, but you must also handle token
18+
* caching and token refreshing.
19+
*
1520
* @param request the details of the token request
1621
* @return a Publisher that emits a single access token
1722
*/

sdk/identity/azure-identity/src/main/java/com/azure/identity/ChainedTokenCredential.java

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,17 @@ public class ChainedTokenCredential implements TokenCredential {
3737
this.credentials = Collections.unmodifiableList(credentials);
3838
}
3939

40+
/**
41+
* Sequentially calls {@link TokenCredential#getToken(TokenRequestContext)} on all the specified credentials,
42+
* returning the first successfully obtained {@link AccessToken}.
43+
*
44+
* This method is called automatically by Azure SDK client libraries.
45+
* You may call this method directly, but you must also handle token
46+
* caching and token refreshing.
47+
*
48+
* @param request the details of the token request
49+
* @return a Publisher that emits a single access token
50+
*/
4051
@Override
4152
public Mono<AccessToken> getToken(TokenRequestContext request) {
4253
List<CredentialUnavailableException> exceptions = new ArrayList<>(4);

0 commit comments

Comments
 (0)