Skip to content

Commit

Permalink
ISSUE-9: Changes requested in review
Browse files Browse the repository at this point in the history
  • Loading branch information
Svenskapojkarna committed Dec 4, 2023
1 parent e789e4c commit 4a6bda6
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 11 deletions.
2 changes: 1 addition & 1 deletion Frends.OAuth.CreateJWTToken/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -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.

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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));
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,12 @@ public class CustomHeader
/// <summary>
/// Key of the header.
/// </summary>
/// <example>kid</example>
public string Key { get; set; }

/// <summary>
/// Value for the header.
/// </summary>
/// <example>fsabijfbodsafadsfn</example>
public string Value { get; set; }
}
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
namespace Frends.OAuth.CreateJWTToken.Definitions;
using System.ComponentModel.DataAnnotations;

namespace Frends.OAuth.CreateJWTToken.Definitions;

/// <summary>
/// Class for describing of a single claim.
Expand All @@ -8,12 +10,14 @@ public class JwtClaim
/// <summary>
/// Claim key.
/// </summary>
/// <example>Name</example>
/// <example>Role</example>
[DisplayFormat(DataFormatString = "Text")]
public string ClaimKey { get; set; }

/// <summary>
/// Claim value.
/// </summary>
/// <example>Value</example>
/// <example>Administrator</example>
[DisplayFormat(DataFormatString = "Text")]
public string ClaimValue { get; set; }
}

0 comments on commit 4a6bda6

Please sign in to comment.