-
Notifications
You must be signed in to change notification settings - Fork 469
Added support for JSON Web key sets #489
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
CADBIMDeveloper
wants to merge
49
commits into
jwt-dotnet:main
Choose a base branch
from
CADBIMDeveloper:jwks
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
49 commits
Select commit
Hold shift + click to select a range
9c40aa9
add JSON Web Key definitions
CADBIMDeveloper 79ea39a
add Json Web keys collection
CADBIMDeveloper 923f90c
add a new algorithm factory
CADBIMDeveloper 72613d2
add JWKS support on .net framework
CADBIMDeveloper 0f1d3bb
add a test
CADBIMDeveloper bcade65
add a test
CADBIMDeveloper 9a76799
incapsulate creating algorithm from specific JWK
CADBIMDeveloper 3b6b542
add EC algorithm specific properties
CADBIMDeveloper c64bd7b
implement elliptic curve algorithms creation
CADBIMDeveloper 06be06c
add a test
CADBIMDeveloper fc30b3f
add symmetric key property of the JWK
CADBIMDeveloper 20e3d51
add ISymmetircAlgorithm interface
CADBIMDeveloper 528bc73
move symmetric algorithm validation
CADBIMDeveloper 31ea350
hmacs sha algorithms could have built-in key
CADBIMDeveloper f74489f
algorithm factory reads the key from Json Web Key
CADBIMDeveloper e8d36db
add a property to symetrical algorithm interface
CADBIMDeveloper 173a5aa
use symmetric key from the JWKS
CADBIMDeveloper 28afdb6
add new Jwt Builder methods
CADBIMDeveloper be352ca
cleanup the test
CADBIMDeveloper 4ad94e9
extend Jwt Builder with an ability to set
CADBIMDeveloper 61cfe50
JWT can encode with symmetrical key from the JWKS
CADBIMDeveloper 25ce0e1
add JwtWebKey properies summaries
CADBIMDeveloper ab3b341
add elliptic curve private key property of the JWK
CADBIMDeveloper 67a88fa
allow to encode with a key from Json Web Key set
CADBIMDeveloper de808ee
adjust the test and found a bug
CADBIMDeveloper 5b3c309
rename the property
CADBIMDeveloper eac7e11
extend JWK definition
CADBIMDeveloper 564d4e1
allow to encode with a key from Json Web Key set with RSA algorithm
CADBIMDeveloper ea878af
polish - remove code duplications
CADBIMDeveloper 8848445
add a note to the changelog
CADBIMDeveloper 3f08528
bump version
CADBIMDeveloper 47e9234
Merge branch 'main' into jwks
abatishchev 7e09d4b
fix build
CADBIMDeveloper 1e8cd93
Merge branch 'main' into jwks
CADBIMDeveloper e5f9f61
Update JwtWebKeyPropertyValuesEncoder.cs
abatishchev a8c1651
Update JwtBuilderEncodeTests.cs
abatishchev 90f02d8
Update JwtDecoderTests.cs
abatishchev 80eb529
Update JwtValidator.cs
abatishchev d48dee1
Update JwtWebKeySet.cs
abatishchev 1a3a717
Update JwtWebKeySet.cs
abatishchev 89cc32f
Update JwtValidator.cs
abatishchev 37aafbb
Update JwtWebKeySet.cs
abatishchev a66322b
explicit namespace
CADBIMDeveloper 6dd5743
to expression body
CADBIMDeveloper e7189c1
remove blank lines
CADBIMDeveloper c57a9a0
pattern matching switch/case
CADBIMDeveloper 58e9a99
formatting
CADBIMDeveloper a80e41e
seal the class
CADBIMDeveloper 0112fef
rename method
CADBIMDeveloper File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,10 @@ | ||
| namespace JWT.Algorithms | ||
| { | ||
| /// <summary> | ||
| /// Represents a symmetric algorithm to generate or validate JWT signature. | ||
| /// </summary> | ||
| public interface ISymmetricAlgorithm : IJwtAlgorithm | ||
| { | ||
| byte[] Key { get; } | ||
| } | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
12 changes: 12 additions & 0 deletions
12
src/JWT/Exceptions/InvalidJsonWebKeyEllipticCurveTypeException.cs
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,12 @@ | ||
| using System; | ||
|
|
||
| namespace JWT.Exceptions | ||
| { | ||
| public class InvalidJsonWebKeyEllipticCurveTypeException : ArgumentOutOfRangeException | ||
| { | ||
| public InvalidJsonWebKeyEllipticCurveTypeException(string ellipticCurveType) | ||
| : base($"{ellipticCurveType} is not defined in RFC751") | ||
| { | ||
| } | ||
| } | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,12 @@ | ||
| using System; | ||
|
|
||
| namespace JWT.Exceptions | ||
| { | ||
| public class InvalidJsonWebKeyTypeException : ArgumentOutOfRangeException | ||
| { | ||
| public InvalidJsonWebKeyTypeException(string keyType) | ||
| : base($"{keyType} is not defined in RFC7518") | ||
| { | ||
| } | ||
| } | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,7 @@ | ||
| namespace JWT.Jwk | ||
| { | ||
| public interface IJwtWebKeysCollection | ||
| { | ||
| JwtWebKey Find(string keyId); | ||
| } | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,7 @@ | ||
| namespace JWT.Jwk | ||
| { | ||
| public interface IJwtWebKeysCollectionFactory | ||
| { | ||
| JwtWebKeysCollection CreateKeys(); | ||
| } | ||
| } |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why do all classes need an empty ctor? Both the algos and the factories?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I didn't want to introduce breaking changes for the user code like:
I can remove empty ctors if you want to