diff --git a/bff/src/Altinn.Authentication.UI/Altinn.Authentication.UI.Integration/Configuration/PlatformSettings.cs b/bff/src/Altinn.Authentication.UI/Altinn.Authentication.UI.Integration/Configuration/PlatformSettings.cs index 098c5298..f3e12327 100644 --- a/bff/src/Altinn.Authentication.UI/Altinn.Authentication.UI.Integration/Configuration/PlatformSettings.cs +++ b/bff/src/Altinn.Authentication.UI/Altinn.Authentication.UI.Integration/Configuration/PlatformSettings.cs @@ -30,4 +30,14 @@ public class PlatformSettings /// public string? OpenIdWellKnownEndpoint { get; set; } + /// + /// Gets or sets the subscriptionkey. + /// + public string SubscriptionKey { get; set; } + + /// + /// Gets or sets the SubscriptionKeyHeaderName + /// + public string SubscriptionKeyHeaderName { get; set; } + } diff --git a/bff/src/Altinn.Authentication.UI/Altinn.Authentication.UI.Integration/UserProfiles/UserProfileClient.cs b/bff/src/Altinn.Authentication.UI/Altinn.Authentication.UI.Integration/UserProfiles/UserProfileClient.cs index 645dcb7a..e2141c4f 100644 --- a/bff/src/Altinn.Authentication.UI/Altinn.Authentication.UI.Integration/UserProfiles/UserProfileClient.cs +++ b/bff/src/Altinn.Authentication.UI/Altinn.Authentication.UI.Integration/UserProfiles/UserProfileClient.cs @@ -43,6 +43,7 @@ public UserProfileClient( _httpContextAccessor = httpContextAccessor; _accessTokenProvider = accessTokenProvider; httpClient.BaseAddress = new Uri(_platformSettings!.ApiProfileEndpoint!); + httpClient.DefaultRequestHeaders.Add(_platformSettings.SubscriptionKeyHeaderName, _platformSettings.SubscriptionKey); _httpClient = httpClient; } diff --git a/bff/src/Altinn.Authentication.UI/Altinn.Authentication.UI/appsettings.json b/bff/src/Altinn.Authentication.UI/Altinn.Authentication.UI/appsettings.json index 3205620d..e88cf0eb 100644 --- a/bff/src/Altinn.Authentication.UI/Altinn.Authentication.UI/appsettings.json +++ b/bff/src/Altinn.Authentication.UI/Altinn.Authentication.UI/appsettings.json @@ -4,7 +4,8 @@ "ApiAuthenticationEndpoint": "http://localhost:5101/authentication/api/v1/", "ApiProfileEndpoint": "http://localhost:5101/profile/api/v1/", "JwtCookieName": "AltinnStudioRuntime", - "OpenIdWellKnownEndpoint": "http://localhost:5101/authentication/api/v1/" + "OpenIdWellKnownEndpoint": "http://localhost:5101/authentication/api/v1/", + "SubscriptionKeyHeaderName": "Ocp-Apim-Subscription-Key" }, "CacheConfig": { "PartyCacheTimeout": 10,