From 60a210a291b8cdda6ad3d944997fb5cf7df06b59 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jon=20Kjetil=20=C3=98ye?= Date: Fri, 27 Sep 2024 09:37:33 +0200 Subject: [PATCH] PlatformAccessToken | Added support for dash (-) character in app name - [#827](https://github.com/Altinn/altinn-access-management/issues/827) --- TokenGenerator/GetPlatformAccessToken.cs | 2 +- TokenGenerator/Services/Token.cs | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/TokenGenerator/GetPlatformAccessToken.cs b/TokenGenerator/GetPlatformAccessToken.cs index bda689b..c2a28c0 100644 --- a/TokenGenerator/GetPlatformAccessToken.cs +++ b/TokenGenerator/GetPlatformAccessToken.cs @@ -33,7 +33,7 @@ public async Task Run([HttpTrigger(AuthorizationLevel.Anonymous, " } requestValidator.ValidateQueryParam("env", true, tokenHelper.IsValidEnvironment, out string env); - requestValidator.ValidateQueryParam("app", true, tokenHelper.IsValidDottedIdentifier, out string appClaim); + requestValidator.ValidateQueryParam("app", true, tokenHelper.IsValidIdentifier, out string appClaim); requestValidator.ValidateQueryParam("org", false, tokenHelper.IsValidIdentifier, out string issuerOrg); requestValidator.ValidateQueryParam("ttl", false, uint.TryParse, out uint ttl, 1800); diff --git a/TokenGenerator/Services/Token.cs b/TokenGenerator/Services/Token.cs index b953bc8..1158dd7 100644 --- a/TokenGenerator/Services/Token.cs +++ b/TokenGenerator/Services/Token.cs @@ -334,7 +334,7 @@ public bool TryParseScopes(string input, out string[] scopes) public bool IsValidIdentifier(string identifier) { - return !string.IsNullOrEmpty(identifier) && identifier.Length <= 50 && Regex.IsMatch(identifier, "^[a-z0-9_]+$"); + return !string.IsNullOrEmpty(identifier) && identifier.Length <= 50 && Regex.IsMatch(identifier, "^[a-z0-9_-]+$"); } public bool IsValidDottedIdentifier(string identifier)