Comments (5)
Hi @AliKhalili, thanks for reaching out and proposing an improve to the library!
Overall I don't mind and welcome it. Just needs some discussion first. I see two options:
- Change the interface to make all methods async
Pros:
- only 1 method to call, no confusion
Cons:
- 99,9..9% of scenarios are sync, this is the first every request to make it async. What adds a small but overhead, probably can be eased by leveraging a value task
- a breaking change, constitutes bumping major version to 11.0
- Add a method to the interface
Pros:
- tailored method signature to this scenario
- isn't a breaking change, constitutes only minor version bump to 11.1
Cons:
- introduces confusion (which method to call and when) and complexity (what would be the default implementation's behavior - wrap the sync result with a (value) task or throw an exception?)
What would be your take?
from jwt.
Hi @abatishchev,
Thank you for your response. I appreciate your openness to discussing this matter further.
While it is true that the majority of scenarios may be synchronous, it is becoming increasingly common for developers to expect asynchronous interfaces, especially in scenarios where cloud services(Cloud key management, Cloud HSM) are involved.
On the other hand, as you mentioned, the majority of the consumers are not expected to use the asynchronous methods, so it does not make sense to update the interface to make all methods asynchronous(in some cases it would be nearly impossible to change a legacy code base to be async and works without any problem).
Therefore, I would recommend providing both synchronous and asynchronous versions of each method. This allows consumers to choose which version they want to use based on their needs.
However, this approach can lead to code duplication and may make the interface more difficult to maintain.
from jwt.
Hi @AliKhalili,
I was sick past 2 months so couldn't come back to this.
You haven't followed up either. Is this something you're still interested in? If yes, can you contribute at least a draft of the proposed change?
from jwt.
Certainly, I hope you are feeling well.
Yes, I am interested in your request. Thank you for reaching out to me. Please allow me some time to work on it and I will be happy to provide you with a draft PR as soon as possible.
from jwt.
Hello Everyone. Would just like to add that I would love to see IAlgorithmFactory.Create
be made async as well. This may not be the best approach, but I've currently implemented a custom IAlgorithmFactory
that looks up certificates in AWS SSM. Since this is a web request having support for async would be nice. :)
from jwt.
Related Issues (20)
- "Illegal base64url string" when try to decode token HOT 20
- Not properly serilized object in fluent version of Decode HOT 9
- Why has the HMAC SHA algorithm become obsolete? HOT 2
- InvalidOperationException occurs in Decode() after DecodeHeader(). HOT 2
- Support JWT authentication with public key using ES256 algorithm on .NET Compact Framework 3.5 HOT 2
- Decode does not break on wrong signature HOT 5
- How to enable MODERN_DOTNET? HOT 5
- Dotnet 8.0 AOT Issues
- Where is `RS256Algorirhm`? HOT 1
- Expiry Time is added to claims when decoding HOT 3
- Having trouble with first example Encode() HOT 2
- Expired token not throwing TokenExpiredException HOT 7
- Null reference error when trying to Decode HOT 2
- How to use IJwtValidator.Validate / TryValidate? HOT 5
- jwt is missing NuGet package README file HOT 2
- System.Text.Json should only be a dependency for .NET standard HOT 3
- Authorization throwing an exception: IDX10503 HOT 3
- nbf validation cannot be disabled HOT 5
- But in documentation in SystemTextSerializer says it uses System.Text instead of Newtonsoft.Json HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from jwt.