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

Make MaskinportenSettingsconfiguration path configurable #755

Closed
danielskovli opened this issue Sep 9, 2024 · 0 comments · Fixed by #756
Closed

Make MaskinportenSettingsconfiguration path configurable #755

danielskovli opened this issue Sep 9, 2024 · 0 comments · Fixed by #756
Assignees

Comments

@danielskovli
Copy link
Contributor

danielskovli commented Sep 9, 2024

Description

The configuration name for the MaskinportenSettings object is currently hardcoded at "MaskinportenSettings" in AddMaskinportenClient. Vi have the ability to override this via the ConfigureMaskinportenClient method, but this is perhaps a bit heavy handed in some situations.

Some service owners have many apps running in the same cluster, with the same KeyVault, but require each app to have their own Maskinporten client setup. Which means that the KeyVault entries and appsettings.json configurations are typically prefixed with a unique string (often the app name).

Eg:

appsettings.json

"appname-MaskinportenSettings": {
    "authority": "https://test.maskinporten.no/",
    "clientId": "",
    "jwkBase64": ""
}

keyvault

appname-MaskinportenSettings--ClientId = xxx
appname-MaskinportenSettings--EncodedJwk = xxx

It would be optimal if we could support an app binding to appname-MaskinportenSettings instead of the default hardcoded value.

The manual config done through ConfigureMaskinportenClient can possibly service this purpose, but moves a lot of the configuration out of appsettings.json and in to the codebase itself. Unless there are clever patterns available there to inject values as needed.

Proposed implementation

Create a public method ServiceCollectionExtensions.ConfigureMaskinportenClient that takes a string parameter to pass to IServiceCollection.BindConfiguration.

Calling this method before services.AddAltinnAppServices in Program.cs will result in ServiceCollectionExtensions.AddMaskinportenClient using the newly provided configuration binding instead of the default MaskinportenSettings.

@danielskovli danielskovli self-assigned this Sep 9, 2024
@danielskovli danielskovli moved this to 👷 In Progress in Team Apps Sep 10, 2024
@danielskovli danielskovli changed the title Make MaskinportenSettingsconfiguration name configurable Make MaskinportenSettingsconfiguration path configurable Sep 10, 2024
@danielskovli danielskovli moved this from 🔎 Review to ✅ Done in Team Apps Sep 10, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Archived in project
Development

Successfully merging a pull request may close this issue.

1 participant