How are you extending Duende.AccessTokenManagement? #140
Replies: 5 comments 11 replies
|
We're extending it today in order to encrypt the token before caching, and then decrypting after reading. For our purposes (and maybe others), it would be useful to expose the value serialization/deserialization as well as choice of key. Maybe someone wants to encrypt the value, or use protobuf rather than json. |
|
Related: https://github.com/orgs/DuendeSoftware/discussions/143 |
|
We are extending Duende.AccessTokenManagement in a few ways. I've just tried to upgrade our implementation to 4.0.0-RC1.5. It was straight forward for client credentials, we add mandatory custom token parameters. We added an in memory cache option, although with named key support we could remove this. One thing we are also doing is extending Duende.AccessTokenManagement for token exchange, using We also extend the So really with this new model we will struggle to extend it and will have to write more of our own code, or forego Duende.AccessTokenManagement entirely unless we get access to some more public classes to extend. |
|
As a follow up, we just released Duende.AccessTokenManagement 4 preview 2. |
|
@Erwinvandervalk we have some use cases that work in v3 where we use some ambient context to dynamically determine which credential flow to use (client creds vs user-based flow) - this is helpful when using some libraries that don't natively support multiple named / typed HttpClients and we cannot feasibly define two separate http request pipelines. This was possible & somewhat clean in v3 where we did not have to copy any business logic (do some derivation of the respective handlers to expose the GetAccessTokenAsync logic) However, this is not possible in v4 as the handlers' access token logic have now become internalized in the Token Retrievers and we cannot use a wrapping handler to dynamically instantiate and select them, having to result to some naughty logic to instantiate the internal Token Retriever. Is it possible / advisable to publicize the implemented |
Uh oh!
There was an error while loading. Please reload this page.
As we work on adding new features to AccessTokenManagement, we've encountered some challenges with its current design, particularly regarding extensibility. The existing approach leans towards inheritance rather than composition, which comes with certain drawbacks. For instance, adding a constructor parameter can immediately introduce a breaking change.
For example, one area where this poses a problem is our caching strategy. To customize the cache key, you currently have to inherit from the cache and override the GenerateCacheKey method. In the next version of Duende.AccessTokenManagement (V4), this inheritance-based approach will be deprecated in favor of injecting a cache key generator.
Looking ahead, our plan is to:
This maximizes the flexibility of the library while minimizing the chances for introducing breaking changes.
To make these improvements as effective as possible, we’d love to hear from you—how are you using and extending Duende.AccessTokenManagement? Your feedback will help shape the future of the library.
All reactions