-
Notifications
You must be signed in to change notification settings - Fork 372
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1769 from DuendeSoftware/jmdc/json-serialization
Handle case-insensitive JSON claim value types.
- Loading branch information
Showing
5 changed files
with
38 additions
and
7 deletions.
There are no files selected for viewing
This file contains 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 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 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
29 changes: 29 additions & 0 deletions
29
identity-server/test/IdentityServer.UnitTests/Extensions/ClaimsExtensionsTests.cs
This file contains 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,29 @@ | ||
using System.Security.Claims; | ||
using System.Text.Json; | ||
using Duende.IdentityServer; | ||
using Duende.IdentityServer.Extensions; | ||
using FluentAssertions; | ||
|
||
namespace UnitTests.Extensions; | ||
|
||
public class ClaimsExtensionsTests | ||
{ | ||
|
||
[Theory] | ||
[InlineData(System.IdentityModel.Tokens.Jwt.JsonClaimValueTypes.Json)] | ||
[InlineData(IdentityServerConstants.ClaimValueTypes.Json)] | ||
public void TestName(string claimType) | ||
{ | ||
var payload = | ||
""" | ||
{ | ||
"test": "value" | ||
} | ||
"""; | ||
Claim[] claims = [new Claim("claim", payload, claimType)]; | ||
|
||
var result = claims.ToClaimsDictionary(); | ||
|
||
result["claim"].Should().BeOfType<JsonElement>(); | ||
} | ||
} |
This file contains 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