Skip to content

Commit

Permalink
Don't add null org claim
Browse files Browse the repository at this point in the history
  • Loading branch information
elsand committed Feb 7, 2024
1 parent 650feda commit 343e075
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion TokenGenerator/Services/Token.cs
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,6 @@ public async Task<string> GetEnterpriseToken(string env, string[] scopes, string
{ "client_id", Guid.NewGuid().ToString() },
{ "jti", RandomString(43) },
{ "consumer", GetOrgNoObject(orgNo) },
{ "urn:altinn:org", org },
{ "urn:altinn:orgNumber", orgNo },
{ "urn:altinn:authenticatemethod", "maskinporten" },
{ "urn:altinn:authlevel", 3 },
Expand All @@ -58,6 +57,11 @@ public async Task<string> GetEnterpriseToken(string env, string[] scopes, string
{ "nbf", dateTimeOffset.ToUnixTimeSeconds() },
};

if (!string.IsNullOrEmpty(org))
{
payload.Add("urn:altinn:org", org);
}

if (!string.IsNullOrEmpty(supplierOrgNo))
{
payload.Add("supplier", GetOrgNoObject(supplierOrgNo));
Expand Down

0 comments on commit 343e075

Please sign in to comment.