diff --git a/Frends.OAuth.CreateJWTToken/CHANGELOG.md b/Frends.OAuth.CreateJWTToken/CHANGELOG.md index de90268..0def8f8 100644 --- a/Frends.OAuth.CreateJWTToken/CHANGELOG.md +++ b/Frends.OAuth.CreateJWTToken/CHANGELOG.md @@ -1,6 +1,6 @@ # Changelog -## [1.1.0] - 2023-11-XX +## [1.1.0] - 2023-12-04 ### Added - Not Before claim set to optional. Added feature to add customer headers to JWT header. diff --git a/Frends.OAuth.CreateJWTToken/Frends.OAuth.CreateJWTToken/CreateJWTToken.cs b/Frends.OAuth.CreateJWTToken/Frends.OAuth.CreateJWTToken/CreateJWTToken.cs index edf9817..346b6da 100644 --- a/Frends.OAuth.CreateJWTToken/Frends.OAuth.CreateJWTToken/CreateJWTToken.cs +++ b/Frends.OAuth.CreateJWTToken/Frends.OAuth.CreateJWTToken/CreateJWTToken.cs @@ -34,13 +34,13 @@ public static TokenResult CreateJWTToken(Input input) else // Default is to use stream and assume PEM format. { - var rsa = RSA.Create(); - rsa.ImportFromPem(input.PrivateKey); - - signingCredentials = new SigningCredentials(key: new RsaSecurityKey(rsa), algorithm: input.SigningAlgorithm.ToString()) - { - CryptoProviderFactory = new CryptoProviderFactory { CacheSignatureProviders = false } - }; + using var rsa = RSA.Create(); + rsa.ImportFromPem(input.PrivateKey); + + signingCredentials = new SigningCredentials(key: new RsaSecurityKey(rsa), algorithm: input.SigningAlgorithm.ToString()) + { + CryptoProviderFactory = new CryptoProviderFactory { CacheSignatureProviders = false } + }; } return new TokenResult(CreateToken(signingCredentials, input, isSymmetric)); } diff --git a/Frends.OAuth.CreateJWTToken/Frends.OAuth.CreateJWTToken/Definitions/CustomHeader.cs b/Frends.OAuth.CreateJWTToken/Frends.OAuth.CreateJWTToken/Definitions/CustomHeader.cs index 52cfe89..d5ff606 100644 --- a/Frends.OAuth.CreateJWTToken/Frends.OAuth.CreateJWTToken/Definitions/CustomHeader.cs +++ b/Frends.OAuth.CreateJWTToken/Frends.OAuth.CreateJWTToken/Definitions/CustomHeader.cs @@ -8,10 +8,12 @@ public class CustomHeader /// /// Key of the header. /// + /// kid public string Key { get; set; } /// /// Value for the header. /// + /// fsabijfbodsafadsfn public string Value { get; set; } } diff --git a/Frends.OAuth.CreateJWTToken/Frends.OAuth.CreateJWTToken/Definitions/JwtClaim.cs b/Frends.OAuth.CreateJWTToken/Frends.OAuth.CreateJWTToken/Definitions/JwtClaim.cs index 4e01cae..d86cfba 100644 --- a/Frends.OAuth.CreateJWTToken/Frends.OAuth.CreateJWTToken/Definitions/JwtClaim.cs +++ b/Frends.OAuth.CreateJWTToken/Frends.OAuth.CreateJWTToken/Definitions/JwtClaim.cs @@ -1,4 +1,6 @@ -namespace Frends.OAuth.CreateJWTToken.Definitions; +using System.ComponentModel.DataAnnotations; + +namespace Frends.OAuth.CreateJWTToken.Definitions; /// /// Class for describing of a single claim. @@ -8,12 +10,14 @@ public class JwtClaim /// /// Claim key. /// - /// Name + /// Role + [DisplayFormat(DataFormatString = "Text")] public string ClaimKey { get; set; } /// /// Claim value. /// - /// Value + /// Administrator + [DisplayFormat(DataFormatString = "Text")] public string ClaimValue { get; set; } }