Skip to content

Commit 3c81344

Browse files
committed
feat(cli/server.go): allow the use of public OIDC clients
Change-Id: Iadd85d40c2faa595a0498e25d3407a1f94b5c8a8 Signed-off-by: Thomas Kosiewski <tk@coder.com>
1 parent 5845031 commit 3c81344

File tree

2 files changed

+20
-1
lines changed

2 files changed

+20
-1
lines changed

cli/server.go

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -694,7 +694,12 @@ func (r *RootCmd) Server(newAPI func(context.Context, *coderd.Options) (*coderd.
694694
}
695695
}
696696

697-
if vals.OIDC.ClientKeyFile != "" || vals.OIDC.ClientSecret != "" {
697+
// As OIDC clients can be confidential or public,
698+
// we should only check for a client id being set.
699+
// The underlying library handles the case of no
700+
// client secrets correctly. For more details on
701+
// client types: https://oauth.net/2/client-types/
702+
if vals.OIDC.ClientID != "" {
698703
if vals.OIDC.IgnoreEmailVerified {
699704
logger.Warn(ctx, "coder will not check email_verified for OIDC logins")
700705
}

scripts/dev-oidc.sh

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,17 @@ cat <<EOF >/tmp/example-realm.json
4949
"baseUrl": "/coder",
5050
"redirectUris": ["*"],
5151
"secret": "coder"
52+
},
53+
{
54+
"clientId": "coder-public",
55+
"publicClient": true,
56+
"directAccessGrantsEnabled": true,
57+
"enabled": true,
58+
"fullScopeAllowed": true,
59+
"baseUrl": "/coder",
60+
"redirectUris": [
61+
"*"
62+
]
5263
}
5364
]
5465
}
@@ -79,6 +90,9 @@ hostname=$(hostname -f)
7990
export CODER_OIDC_ISSUER_URL="http://${hostname}:9080/realms/coder"
8091
export CODER_OIDC_CLIENT_ID=coder
8192
export CODER_OIDC_CLIENT_SECRET=coder
93+
# Comment out the two lines above, and comment in the line below,
94+
# to configure OIDC auth using a public client.
95+
# export CODER_OIDC_CLIENT_ID=coder-public
8296
export CODER_DEV_ACCESS_URL="http://${hostname}:8080"
8397

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

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy