Skip to content

Commit

Permalink
Merge pull request #31 from Altinn/bug/removeVer2
Browse files Browse the repository at this point in the history
Remove Maskinporten ver2 environment
  • Loading branch information
jonkjetiloye authored Jun 11, 2024
2 parents 7e5a7f3 + 3274cee commit 21d9f56
Show file tree
Hide file tree
Showing 3 changed files with 1 addition and 28 deletions.
24 changes: 0 additions & 24 deletions TokenGenerator/Services/AuthorizationBearer.cs
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,7 @@ public class AuthorizationBearer : IAuthorizationBearer
{
private readonly Settings settings;
private readonly object cmLockMaskinporten = new object();
private readonly object cmLockMaskinportenAux = new object();
private ConfigurationManager<OpenIdConnectConfiguration> configurationManager;
private ConfigurationManager<OpenIdConnectConfiguration> configurationManagerAux;
private readonly HttpContext httpContext;

private ConfigurationManager<OpenIdConnectConfiguration> ConfigurationManager
Expand All @@ -44,23 +42,6 @@ private ConfigurationManager<OpenIdConnectConfiguration> ConfigurationManager
}
}

private ConfigurationManager<OpenIdConnectConfiguration> ConfigurationManagerAux
{
get
{
if (configurationManagerAux != null) return configurationManagerAux;
lock (cmLockMaskinportenAux)
{
configurationManagerAux ??= new ConfigurationManager<OpenIdConnectConfiguration>(
settings.TokenAuxiliaryAuthorizationWellKnownEndpoint,
new OpenIdConnectConfigurationRetriever(),
new HttpClient {Timeout = TimeSpan.FromMilliseconds(10000)});
}

return configurationManagerAux;
}
}

public AuthorizationBearer(IOptions<Settings> settings, IHttpContextAccessor contextAccessor)
{
this.settings = settings.Value;
Expand All @@ -83,11 +64,6 @@ public async Task<ActionResult> IsAuthorized(string authorizationString, string
OpenIdConnectConfiguration configuration = await ConfigurationManager.GetConfigurationAsync();
var signingKeys = new List<SecurityKey>();
signingKeys.AddRange(configuration.SigningKeys);
if (settings.TokenAuxiliaryAuthorizationWellKnownEndpoint != null)
{
OpenIdConnectConfiguration configurationAux = await ConfigurationManagerAux.GetConfigurationAsync();
signingKeys.AddRange(configurationAux.SigningKeys);
}

TokenValidationParameters parameters = new TokenValidationParameters()
{
Expand Down
2 changes: 0 additions & 2 deletions TokenGenerator/Settings.cs
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,6 @@ public class Settings
public string AuthorizedScopePersonal { get; set; }
public string AuthorizedScopePlatform { get; set; }
public string TokenAuthorizationWellKnownEndpoint { get; set; }

public string TokenAuxiliaryAuthorizationWellKnownEndpoint { get; set; }
public string EnvironmentsApiToken { get; set; }
public string EnvironmentsConsentToken { get; set; }
public Dictionary<string, string> EnvironmentsApiTokenDict => GetKeyValuePairs(EnvironmentsApiToken);
Expand Down
3 changes: 1 addition & 2 deletions TokenGenerator/local.settings.json.COPYME
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@
"ConsentTokenSigningCertNames": "dev:altinn-testtools-consent-token-signing-cert",
"EnvironmentsApiToken": "dev:altinn-testtools-kv",
"EnvironmentsConsentToken": "dev:altinn-testtools-kv",
"TokenAuthorizationWellKnownEndpoint": "https://test.maskinporten.no/.well-known/oauth-authorization-server",
"TokenAuxiliaryAuthorizationWellKnownEndpoint": "https://ver2.maskinporten.no/.well-known/oauth-authorization-server"
"TokenAuthorizationWellKnownEndpoint": "https://test.maskinporten.no/.well-known/oauth-authorization-server"
}
}

0 comments on commit 21d9f56

Please sign in to comment.