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

fix: when setting isOidcEnabled is false override env variable #4403

Merged
merged 6 commits into from
Nov 21, 2024
Merged
Changes from 1 commit
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
Original file line number Diff line number Diff line change
Expand Up @@ -52,8 +52,7 @@ public class SqlDatabase extends HasSettings<Database> implements Database {
private String initialAdminPassword =
(String)
EnvironmentProperty.getParameter(Constants.MOLGENIS_ADMIN_PW, ADMIN_PW_DEFAULT, STRING);
private final Boolean isOidcEnabled =
EnvironmentProperty.getParameter(Constants.MOLGENIS_OIDC_CLIENT_ID, null, STRING) != null;
private Boolean isOidcEnabled = false;
private static String postgresUser =
(String)
EnvironmentProperty.getParameter(
Expand Down Expand Up @@ -179,9 +178,16 @@ public void init() { // setup default stuff
// get the settings
clearCache();

if (getSetting(Constants.IS_OIDC_ENABLED) == null) {
// use environment property unless overridden in settings
this.setSetting(Constants.IS_OIDC_ENABLED, String.valueOf(isOidcEnabled));
String isOidcEnabledSetting = getSetting(Constants.IS_OIDC_ENABLED);
if (isOidcEnabledSetting != null) {
this.isOidcEnabled = Boolean.parseBoolean(isOidcEnabledSetting);
} else {
Object envSetting =
EnvironmentProperty.getParameter(Constants.MOLGENIS_OIDC_CLIENT_ID, null, STRING);
if (envSetting != null) {
this.setSetting(Constants.IS_OIDC_ENABLED, "true");
this.isOidcEnabled = true;
}
}

String instanceId = getSetting(Constants.MOLGENIS_INSTANCE_ID);
Expand Down