Skip to content
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

Fix system serializer settings dependend deserialization of JsonWebKey #55

Merged
merged 2 commits into from
Apr 19, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion src/NetDevPack.Security.Jwt.Core/Model/Key.cs
Original file line number Diff line number Diff line change
Expand Up @@ -22,13 +22,16 @@
public string Type { get; set; }
public string Parameters { get; set; }
public bool IsRevoked { get; set; }
public string? RevokedReason { get; set; }

Check warning on line 25 in src/NetDevPack.Security.Jwt.Core/Model/Key.cs

View workflow job for this annotation

GitHub Actions / pull-request

The annotation for nullable reference types should only be used in code within a '#nullable' annotations context.

Check warning on line 25 in src/NetDevPack.Security.Jwt.Core/Model/Key.cs

View workflow job for this annotation

GitHub Actions / pull-request

The annotation for nullable reference types should only be used in code within a '#nullable' annotations context.

Check warning on line 25 in src/NetDevPack.Security.Jwt.Core/Model/Key.cs

View workflow job for this annotation

GitHub Actions / pull-request

The annotation for nullable reference types should only be used in code within a '#nullable' annotations context.

Check warning on line 25 in src/NetDevPack.Security.Jwt.Core/Model/Key.cs

View workflow job for this annotation

GitHub Actions / pull-request

The annotation for nullable reference types should only be used in code within a '#nullable' annotations context.
public DateTime CreationDate { get; set; }
public DateTime? ExpiredAt { get; set; }

public JsonWebKey GetSecurityKey()
{
return JsonSerializer.Deserialize<JsonWebKey>(Parameters);
//problem here are default Serializer options. If these options don't have the property PropertyNameCaseInsensitive = true, the deserialization will fail.
//var jsonWebKey = JsonSerializer.Deserialize<JsonWebKey>(Parameters);
var jsonWebKey = JsonWebKey.Create(Parameters);
return jsonWebKey;
}

public void Revoke(string reason=default)
Expand Down
Loading