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: Authentication level claim is 0 in dialog token #1654

Merged
merged 5 commits into from
Jan 9, 2025
Merged
Changes from 3 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 @@ -20,7 +20,8 @@ public static class ClaimsPrincipalExtensions
private const char IdDelimiter = ':';
private const string IdPrefix = "0192";
private const string AltinnClaimPrefix = "urn:altinn:";
private const string IdportenAuthLevelClaim = "acr";
private const string IdportenAuthLevelClaim = "acr"; // acr
Fargekritt marked this conversation as resolved.
Show resolved Hide resolved
private const string IdportenAuthLevelClaimUrl = "http://schemas.microsoft.com/claims/authnclassreference"; // acr
private const string AuthorizationDetailsClaim = "authorization_details";
private const string AuthorizationDetailsType = "urn:altinn:systemuser";
private const string AltinnAuthLevelClaim = "urn:altinn:authlevel";
Expand Down Expand Up @@ -188,7 +189,9 @@ public static bool TryGetAuthenticationLevel(this ClaimsPrincipal claimsPrincipa
return true;
}

if (claimsPrincipal.TryGetClaimValue(IdportenAuthLevelClaim, out claimValue))
// Something is converting "acr" to "http://schemas.microsoft.com/claims/authnclassreference"
Fargekritt marked this conversation as resolved.
Show resolved Hide resolved
// https://github.com/IdentityServer/IdentityServer3/blob/master/source/Core/Configuration/Hosting/ClaimMap.cs also maps "acr" to "http://schemas.microsoft.com/claims/authnclassreference"
if (claimsPrincipal.TryGetClaimValue(IdportenAuthLevelClaimUrl, out claimValue) || claimsPrincipal.TryGetClaimValue(IdportenAuthLevelClaim, out claimValue))
{
// The acr claim value is either "idporten-loa-substantial" (previously "Level3") or "idporten-loa-high" (previously "Level4")
// https://docs.digdir.no/docs/idporten/oidc/oidc_protocol_new_idporten#new-acr-values
Expand Down
Loading