Skip to content

[FEATURE REQ] Implement TokenCredentialBuilder #38320

Closed

Description

Is your feature request related to a problem? Please describe.
I have a token string and I would like to create TokenCredential from it.
The proposed solution from the library is implementing a functional interface directly:

TokenCredential {
        Mono.just(AccessToken(token, OffsetDateTime.parse(tokenExpiresAt)))
    }

The problem is that we have to add Project Reactor to our dependencies. And we would like to avoid it.

Describe the solution you'd like
It will be good to utilize some builder to be consistent with other methods (e.g. ClientSecretCredentialBuilder).
The solution is adding TokenCredentialBuilder that we can import without importing Reactor directly. That can hide implementation details from client code.
TokenCredentialBuilder should just provide methods to set the token:

val token: TokenCredential = TokenCredentialBuilder()
       .token(token)
       .expiresAt(expiresAt)
       .build()

A similar request is described here: #7480 .
We don't need a TokenCredential we just need a convenient API that can encapsulate implementation details and don't force using Reactor lib in our services just to invoke Mono.just(AccessToken(token, OffsetDateTime.parse(tokenExpiresAt))) once.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Labels

Azure.IdentityClientThis issue points to a problem in the data-plane of the library.customer-reportedIssues that are reported by GitHub users external to the Azure organization.needs-team-attentionWorkflow: This issue needs attention from Azure service team or SDK teamquestionThe issue doesn't require a change to the product in order to be resolved. Most issues start as that

Type

No type

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions