Skip to content

Commit

Permalink
fix: fix dex configuration, set identity provider in checluster (#1864)
Browse files Browse the repository at this point in the history
* fix: fix dex configuration, set identity provider in checluster

Signed-off-by: Michal Vala <[email protected]>

* don't show warning message when native user mode enabled

Signed-off-by: Michal Vala <[email protected]>
  • Loading branch information
sparkoo authored Nov 30, 2021
1 parent e4abc4e commit 9db7957
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 3 deletions.
2 changes: 1 addition & 1 deletion resources/dex/configmap.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ data:
staticClients:
- id: {{CLIENT_ID}}
redirectURIs:
- 'https://che-{{NAMESPACE}}.{{DOMAIN}}/oauth/callback'
- 'https://{{DOMAIN}}/oauth/callback'
name: 'Eclipse Che'
secret: {{CLIENT_SECRET}}
enablePasswordDB: true
Expand Down
2 changes: 1 addition & 1 deletion src/commands/server/deploy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -339,7 +339,7 @@ export default class Deploy extends Command {
await this.setPlaformDefaults(flags, ctx)
await this.config.runHook(DEFAULT_ANALYTIC_HOOK_NAME, { command: Deploy.id, flags })

if (!flags.batch && isKubernetesPlatformFamily(flags.platform) && (isDevWorkspaceEnabled(ctx) || flags['workspace-engine'] === 'dev-workspace')) {
if (!flags.batch && isKubernetesPlatformFamily(flags.platform) && (isDevWorkspaceEnabled(ctx) || flags['workspace-engine'] === 'dev-workspace') && !isNativeUserModeEnabled(ctx)) {
if (!await cli.confirm('DevWorkspace is experimental feature. It requires direct access to the underlying infrastructure REST API.\nThis results in huge privilege escalation. Do you want to proceed? [y/n]')) {
cli.exit(0)
}
Expand Down
5 changes: 4 additions & 1 deletion src/tasks/component-installers/dex.ts
Original file line number Diff line number Diff line change
Expand Up @@ -207,6 +207,10 @@ export class DexTasks {
await this.kube.createServiceFromFile(yamlFilePath, DexTasks.NAMESPACE_NAME)
task.title = `${task.title}...[OK]`
}

// set service in a CR
ctx[ChectlContext.CR_PATCH] = ctx[ChectlContext.CR_PATCH] || {}
merge(ctx[ChectlContext.CR_PATCH], { spec: { auth: { identityProviderURL: 'http://dex.dex:5556' } } })
},
},
{
Expand Down Expand Up @@ -271,7 +275,6 @@ export class DexTasks {
const yamlFilePath = this.getDexResourceFilePath('configmap.yaml')
let yamlContent = fs.readFileSync(yamlFilePath).toString()
yamlContent = yamlContent.replace(new RegExp(TemplatePlaceholders.DOMAIN, 'g'), this.flags.domain)
yamlContent = yamlContent.replace(new RegExp(TemplatePlaceholders.CHE_NAMESPACE, 'g'), this.flags.chenamespace)
yamlContent = yamlContent.replace(new RegExp(TemplatePlaceholders.CLIENT_ID, 'g'), DexTasks.CLIENT_ID)
// generate client secret
const clientSecret = crypto.randomBytes(32).toString('base64')
Expand Down

0 comments on commit 9db7957

Please sign in to comment.