Skip to content

Commit

Permalink
Merge pull request #2041 from thfries/ui_bugfix_createEnv
Browse files Browse the repository at this point in the history
UI - bugfix for create new environment
  • Loading branch information
thjaeckle authored Oct 9, 2024
2 parents 26e1945 + c5ea9b3 commit 8eeccc1
Showing 1 changed file with 40 additions and 0 deletions.
40 changes: 40 additions & 0 deletions ui/modules/environments/environments.ts
Original file line number Diff line number Diff line change
Expand Up @@ -133,6 +133,45 @@ type Environment = {
recentPolicyIds?: string[],
}

const DEFAULT_AUTH_SETTINGS: AuthSettings = {
main: {
method: AuthMethod.basic,
oidc: {
enabled: false,
defaultProvider: null,
autoSso: false
},
basic: {
enabled: true,
defaultUsernamePassword: "ditto:ditto"
},
bearer: {
enabled: true
},
pre: {
enabled: false,
defaultDittoPreAuthenticatedUsername: null
}
},
devops: {
method: AuthMethod.basic,
oidc: {
enabled: false,
defaultProvider: null,
autoSso: false
},
basic: {
enabled: true,
defaultUsernamePassword: "devops:foobar"
},
bearer: {
enabled: false
}
},
"oidc": {
}
}

let environments: Record<string, Environment>;
let selectedEnvName: string;

Expand All @@ -158,6 +197,7 @@ document.getElementById('environmentsHTML').innerHTML = environmentsHTML;

function Environment(env: Environment): void {
Object.assign(this, env);
this.authSettings || (this.authSettings = DEFAULT_AUTH_SETTINGS);
this.authSettings.main.oidc.provider = env.authSettings?.main?.oidc?.defaultProvider;
fillMainUsernamePassword(env.authSettings?.main?.basic?.defaultUsernamePassword);
this.authSettings.main.pre.dittoPreAuthenticatedUsername = env.authSettings?.main?.pre?.defaultDittoPreAuthenticatedUsername;
Expand Down

0 comments on commit 8eeccc1

Please sign in to comment.