Skip to content

Commit

Permalink
Marked Branca and PASETO handlers as obsolete
Browse files Browse the repository at this point in the history
  • Loading branch information
scottbrady91 committed Mar 29, 2024
1 parent 4f010f2 commit feda0f2
Show file tree
Hide file tree
Showing 11 changed files with 16 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ public IActionResult Paseto(string version)
if (version == PasetoConstants.Versions.V1)
signingCredentials = new SigningCredentials(options.PasetoV1PrivateKey, SecurityAlgorithms.RsaSsaPssSha384);
else if (version == PasetoConstants.Versions.V2)
signingCredentials = new SigningCredentials(options.PasetoV2PrivateKey, ExtendedSecurityAlgorithms.EdDsa);
signingCredentials = new SigningCredentials(options.EdDsaPrivateKey, ExtendedSecurityAlgorithms.EdDsa);
else
throw new NotSupportedException("Unsupported version");

Expand Down Expand Up @@ -94,7 +94,7 @@ public IActionResult EdDsaJwt()
{
Issuer = "me",
Audience = "you",
SigningCredentials = new SigningCredentials(options.PasetoV2PrivateKey, ExtendedSecurityAlgorithms.EdDsa)
SigningCredentials = new SigningCredentials(options.EdDsaPrivateKey, ExtendedSecurityAlgorithms.EdDsa)
};

var token = handler.CreateToken(descriptor);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,10 +31,10 @@ public EncryptingCredentials BrancaEncryptingCredentials
public RsaSecurityKey PasetoV1PrivateKey = new RsaSecurityKey(RSA.Create());
public RsaSecurityKey PasetoV1PublicKey => new RsaSecurityKey(RSA.Create(PasetoV1PrivateKey.Rsa.ExportParameters(false)));

public readonly EdDsaSecurityKey PasetoV2PublicKey = new EdDsaSecurityKey(
public readonly EdDsaSecurityKey EdDsaPublicKey = new EdDsaSecurityKey(
EdDsa.Create(new EdDsaParameters(ExtendedSecurityAlgorithms.Curves.Ed25519) {X =Convert.FromBase64String("doaS7QILHBdnPULlgs1fX0MWpd1wak14r1yT6ae/b4M=")}));

public readonly EdDsaSecurityKey PasetoV2PrivateKey= new EdDsaSecurityKey(
public readonly EdDsaSecurityKey EdDsaPrivateKey= new EdDsaSecurityKey(
EdDsa.Create(new EdDsaParameters(ExtendedSecurityAlgorithms.Curves.Ed25519) {D =Convert.FromBase64String("TYXei5+8Qd2ZqKIlEuJJ3S50WYuocFTrqK+3/gHVH9B2hpLtAgscF2c9QuWCzV9fQxal3XBqTXivXJPpp79vgw==")}));
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -48,13 +48,13 @@ public void ConfigureServices(IServiceCollection services)
options.SecurityTokenValidators.Add(new PasetoTokenHandler(
new Dictionary<string, PasetoVersionStrategy> {{PasetoConstants.Versions.V2, new PasetoVersion2()}}));

options.TokenValidationParameters.IssuerSigningKey = sampleOptions.PasetoV2PublicKey;
options.TokenValidationParameters.IssuerSigningKey = sampleOptions.EdDsaPublicKey;
options.TokenValidationParameters.ValidIssuer = "me";
options.TokenValidationParameters.ValidAudience = "you";
})
.AddJwtBearer("eddsa", options =>
{
options.TokenValidationParameters.IssuerSigningKey = sampleOptions.PasetoV2PublicKey;
options.TokenValidationParameters.IssuerSigningKey = sampleOptions.EdDsaPublicKey;
options.TokenValidationParameters.ValidIssuer = "me";
options.TokenValidationParameters.ValidAudience = "you";
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@

namespace ScottBrady.IdentityModel.Tokens.Branca
{
[Obsolete("Branca support is now deprecated. Please reach out via GitHub if you would like to see this feature maintained.")]
public class BrancaSecurityToken : JwtPayloadSecurityToken
{
public BrancaSecurityToken(BrancaToken token) : base(Encoding.UTF8.GetString(token.Payload))
Expand Down
1 change: 1 addition & 0 deletions src/ScottBrady.IdentityModel.Tokens.Branca/BrancaToken.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

namespace ScottBrady.IdentityModel.Tokens.Branca
{
[Obsolete("Branca support is now deprecated. Please reach out via GitHub if you would like to see this feature maintained.")]
public class BrancaToken
{
private static readonly DateTime MinDateTime = new DateTime(1970, 01, 01, 0, 0, 0, DateTimeKind.Utc);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@

namespace ScottBrady.IdentityModel.Tokens.Branca
{
[Obsolete("Branca support is now deprecated. Please reach out via GitHub if you would like to see this feature maintained.")]
public class BrancaTokenHandler : JwtPayloadTokenHandler
{
private const int TagLength = 16;
Expand Down
3 changes: 3 additions & 0 deletions src/ScottBrady.IdentityModel.Tokens.Paseto/PasetoConstants.cs
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
using System;

namespace ScottBrady.IdentityModel.Tokens.Paseto
{
[Obsolete("PASETO support is now deprecated. Please reach out via GitHub if you would like to see this feature maintained.")]
public class PasetoConstants
{
public const int MaxPasetoSegmentCount = 4;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@

namespace ScottBrady.IdentityModel.Tokens.Paseto
{
[Obsolete("PASETO support is now deprecated. Please reach out via GitHub if you would like to see this feature maintained.")]
public class PasetoSecurityToken : JwtPayloadSecurityToken
{
protected PasetoSecurityToken() { }
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@

namespace ScottBrady.IdentityModel.Tokens.Paseto
{
[Obsolete("PASETO support is now deprecated. Please reach out via GitHub if you would like to see this feature maintained.")]
public class PasetoSecurityTokenDescriptor : SecurityTokenDescriptor
{
public PasetoSecurityTokenDescriptor(string version, string purpose)
Expand Down
1 change: 1 addition & 0 deletions src/ScottBrady.IdentityModel.Tokens.Paseto/PasetoToken.cs
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@

namespace ScottBrady.IdentityModel.Tokens.Paseto
{
[Obsolete("PASETO support is now deprecated. Please reach out via GitHub if you would like to see this feature maintained.")]
public class PasetoToken
{
protected PasetoToken() { }
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@

namespace ScottBrady.IdentityModel.Tokens.Paseto
{
[Obsolete("PASETO support is now deprecated. Please reach out via GitHub if you would like to see this feature maintained.")]
public class PasetoTokenHandler : JwtPayloadTokenHandler
{
private readonly Dictionary<string, PasetoVersionStrategy> supportedVersions;
Expand Down

0 comments on commit feda0f2

Please sign in to comment.