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

feat: remove maskinportenaux settings #86 #87

Merged
merged 3 commits into from
Aug 5, 2024
Merged
Show file tree
Hide file tree
Changes from all 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
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@
*.userosscache
*.sln.docstates

.vscode

# User-specific files (MonoDevelop/Xamarin Studio)
*.userprefs

Expand Down
10 changes: 0 additions & 10 deletions Dan.Core/Config/Settings.cs
Original file line number Diff line number Diff line change
Expand Up @@ -352,11 +352,6 @@ public static string GetConsentRedirectUrl(string accreditationId, string hmac)
/// </summary>
public static string MaskinportenUrl => GetSetting("MaskinportenUrl");

/// <summary>
/// Gets the Base URL to an auxiliary Maskinporten environment
/// </summary>
public static string MaskinportenAuxUrl => GetSetting("MaskinportenAuxUrl");

/// <summary>
/// Gets setting for whether or not to use altinn servers in test mode (for profiling and problem solving)
/// </summary>
Expand All @@ -369,11 +364,6 @@ public static string GetConsentRedirectUrl(string accreditationId, string hmac)
/// </summary>
public static string MaskinportenWellknownUrl => GetSetting("MaskinportenWellknownUrl");

/// <summary>
/// Gets the url to the wellknown endpoint for the auxiliary Maskinporten env
/// </summary>
public static string MaskinportenAuxWellknownUrl => GetSetting("MaskinportenAuxWellknownUrl");

public static string AltinnWellknownUrl => GetSetting("AltinnWellknownUrl");

public const int MaxReferenceLength = 50;
Expand Down
36 changes: 0 additions & 36 deletions Dan.Core/Middleware/AuthenticationMiddleware.cs
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fjerne private static volatile ConfigurationManager? _cmMaskinportenAux;

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fjernet

Original file line number Diff line number Diff line change
Expand Up @@ -22,10 +22,8 @@ public class AuthenticationMiddleware : IFunctionsWorkerMiddleware
public const string DefaultScope = "altinn:dataaltinnno";

private static readonly object CmLockMaskinporten = new();
private static readonly object CmLockMaskinportenAux = new();
private static readonly object CmLockAltinnPlatform = new();
private static volatile ConfigurationManager<OpenIdConnectConfiguration>? _cmMaskinporten;
private static volatile ConfigurationManager<OpenIdConnectConfiguration>? _cmMaskinportenAux;
private static volatile ConfigurationManager<OpenIdConnectConfiguration>? _cmAltinnPlatform;

/// <summary>
Expand Down Expand Up @@ -59,37 +57,6 @@ public static ConfigurationManager<OpenIdConnectConfiguration> CmMaskinporten
}
}

/// <summary>
/// Gets or sets maskinporten aux env ConfigManager in order to support ver2 and test for a period of time
/// </summary>
public static ConfigurationManager<OpenIdConnectConfiguration> CmMaskinportenAux
{
get
{
if (_cmMaskinportenAux != null) return _cmMaskinportenAux;
lock (CmLockMaskinportenAux)
{
if (_cmMaskinportenAux == null)
{
_cmMaskinportenAux = new ConfigurationManager<OpenIdConnectConfiguration>(
Settings.MaskinportenAuxWellknownUrl,
new OpenIdConnectConfigurationRetriever(),
new HttpClient { Timeout = TimeSpan.FromMilliseconds(10000) });
}
}

return _cmMaskinportenAux;
}

set
{
lock (CmLockMaskinportenAux)
{
_cmMaskinportenAux = value;
}
}
}

/// <summary>
/// Gets or sets Altinn3 ConfigManager
/// </summary>
Expand Down Expand Up @@ -208,9 +175,6 @@ private async Task<ClaimsPrincipal> ValidateJwt(string token)
if (jwt.Issuer == Settings.MaskinportenUrl)
{
discoveryDocument = await CmMaskinporten.GetConfigurationAsync();
} else if (!string.IsNullOrEmpty(Settings.MaskinportenAuxUrl) && jwt.Issuer == Settings.MaskinportenAuxUrl)
{
discoveryDocument = await CmMaskinportenAux.GetConfigurationAsync();
}
else
{
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ In order to run functions locally, you will need a Azure Storage Emulator, prefe
### 4. CosmosDB emulator
Download and install the CosmosDB emulator. For Windows, [click here to download](https://aka.ms/cosmosdb-emulator). See [this page](https://docs.microsoft.com/en-us/azure/cosmos-db/linux-emulator?tabs=ssl-netstd21) for information about running on Linux / MacOS.

After installation you will ned to create the default database. Go to https://localhost:8081/_explorer/index.html, select Explorer, Select "New Container". Name the container "Nadobe", and the container id "Accreditations". Supply "/owner" as partition key.
After installation you will ned to create the default database. Go to https://localhost:8081/_explorer/index.html, select Explorer, Select "New Container". Name the database "nadobe-dev", and the container id "Accreditations". Supply "/owner" as partition key.

### 5. Redis

Expand Down
Loading