Skip to content

feat(cli/server.go): allow the use of public OIDC clients #16489

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

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
7 changes: 6 additions & 1 deletion cli/server.go
Original file line number Diff line number Diff line change
Expand Up @@ -694,7 +694,12 @@ func (r *RootCmd) Server(newAPI func(context.Context, *coderd.Options) (*coderd.
}
}

if vals.OIDC.ClientKeyFile != "" || vals.OIDC.ClientSecret != "" {
// As OIDC clients can be confidential or public,
// we should only check for a client id being set.
// The underlying library handles the case of no
// client secrets correctly. For more details on
// client types: https://oauth.net/2/client-types/
if vals.OIDC.ClientID != "" {
if vals.OIDC.IgnoreEmailVerified {
logger.Warn(ctx, "coder will not check email_verified for OIDC logins")
}
Expand Down
14 changes: 14 additions & 0 deletions scripts/dev-oidc.sh
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,17 @@ cat <<EOF >/tmp/example-realm.json
"baseUrl": "/coder",
"redirectUris": ["*"],
"secret": "coder"
},
{
"clientId": "coder-public",
"publicClient": true,
"directAccessGrantsEnabled": true,
"enabled": true,
"fullScopeAllowed": true,
"baseUrl": "/coder",
"redirectUris": [
"*"
]
}
]
}
Expand Down Expand Up @@ -79,6 +90,9 @@ hostname=$(hostname -f)
export CODER_OIDC_ISSUER_URL="http://${hostname}:9080/realms/coder"
export CODER_OIDC_CLIENT_ID=coder
export CODER_OIDC_CLIENT_SECRET=coder
# Comment out the two lines above, and comment in the line below,
# to configure OIDC auth using a public client.
# export CODER_OIDC_CLIENT_ID=coder-public
export CODER_DEV_ACCESS_URL="http://${hostname}:8080"

exec "${SCRIPT_DIR}/develop.sh" "$@"
Loading