Skip to content

JsonSerializer should round trip AuthenticationProperties #20722

Closed
@brockallen

Description

@brockallen

JsonSerializer doesn't seem to seralize/deseralize the AuthenticationProperties class properly.

This test:

[Fact]
public void JsonSerializer_should_round_trip_AuthenticationProperties()
{
    var props = new AuthenticationProperties();
    props.Items.Add("foo", "bar");
            
    var json = JsonSerializer.Serialize(props);
    props = JsonSerializer.Deserialize<AuthenticationProperties>(json);

    props.Items.ContainsKey("foo").Should().BeTrue();
    props.Items["foo"].Should().Be("bar");
}

Fails with:

Message: 
    Expected props.Items.ContainsKey("foo") to be true, but found False.

Using ASP.NET Core 3.1.3.

Please advise.

Metadata

Metadata

Assignees

Labels

area-authIncludes: Authn, Authz, OAuth, OIDC, BearerenhancementThis issue represents an ask for new feature or an enhancement to an existing onehelp wantedUp for grabs. We would accept a PR to help resolve this issue

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions