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

Add support for JSON claim value type #62

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
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
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,10 @@ public static IEnumerable<Claim> ToClaims(this JsonElement json, string? issuer
claims.Add(new Claim(x.Name, Stringify(item), ClaimValueTypes.String, issuer));
}
}
else if (x.Value.ValueKind == JsonValueKind.Object)
{
claims.Add(new Claim(x.Name, Stringify(x.Value), "JSON", issuer));
}
else
{
claims.Add(new Claim(x.Name, Stringify(x.Value), ClaimValueTypes.String, issuer));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,7 @@ public async Task Success_protocol_response_should_be_handled_correctly()
new Claim("active", "true", ClaimValueTypes.String, "https://idsvr4"),
new Claim("scope", "api1", ClaimValueTypes.String, "https://idsvr4"),
new Claim("scope", "api2", ClaimValueTypes.String, "https://idsvr4"),
new Claim("realm_access", "{ \"roles\": [ \"uma_authorization\" ] }", "JSON", "https://idsvr4"),
});
}

Expand Down Expand Up @@ -120,6 +121,7 @@ public async Task Success_protocol_response_without_issuer_should_be_handled_cor
new Claim("active", "true", ClaimValueTypes.String, "LOCAL AUTHORITY"),
new Claim("scope", "api1", ClaimValueTypes.String, "LOCAL AUTHORITY"),
new Claim("scope", "api2", ClaimValueTypes.String, "LOCAL AUTHORITY"),
new Claim("realm_access", "{ \"roles\": [ \"uma_authorization\" ] }", "JSON", "LOCAL AUTHORITY"),
});
}

Expand Down Expand Up @@ -160,6 +162,7 @@ public async Task Repeating_a_request_should_succeed()
new Claim("active", "true", ClaimValueTypes.String, "https://idsvr4"),
new Claim("scope", "api1", ClaimValueTypes.String, "https://idsvr4"),
new Claim("scope", "api2", ClaimValueTypes.String, "https://idsvr4"),
new Claim("realm_access", "{ \"roles\": [ \"uma_authorization\" ] }", "JSON", "https://idsvr4"),
});

// repeat
Expand All @@ -184,6 +187,7 @@ public async Task Repeating_a_request_should_succeed()
new Claim("active", "true", ClaimValueTypes.String, "https://idsvr4"),
new Claim("scope", "api1", ClaimValueTypes.String, "https://idsvr4"),
new Claim("scope", "api2", ClaimValueTypes.String, "https://idsvr4"),
new Claim("realm_access", "{ \"roles\": [ \"uma_authorization\" ] }", "JSON", "https://idsvr4"),
});
}

Expand Down Expand Up @@ -291,6 +295,7 @@ public async Task Legacy_protocol_response_should_be_handled_correctly()
new Claim("active", "true", ClaimValueTypes.String, "https://idsvr4"),
new Claim("scope", "api1", ClaimValueTypes.String, "https://idsvr4"),
new Claim("scope", "api2", ClaimValueTypes.String, "https://idsvr4"),
new Claim("realm_access", "{ \"roles\": [ \"uma_authorization\" ] }", "JSON", "https://idsvr4"),
});
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,5 +9,6 @@
"idp": "local",
"amr": "password",
"active": true,
"scope": [ "api1", "api2" ]
"scope": [ "api1", "api2" ],
"realm_access": { "roles": [ "uma_authorization" ] }
}
Original file line number Diff line number Diff line change
Expand Up @@ -9,5 +9,6 @@
"idp": "local",
"amr": "password",
"active": true,
"scope": "api1 api2"
"scope": "api1 api2",
"realm_access": { "roles": [ "uma_authorization" ] }
}
Original file line number Diff line number Diff line change
Expand Up @@ -8,5 +8,6 @@
"idp": "local",
"amr": "password",
"active": true,
"scope": "api1 api2"
"scope": "api1 api2",
"realm_access": { "roles": [ "uma_authorization" ] }
}