Skip to content

Commit 0cdf919

Browse files
committed
add structured auth config example to dex guide
Signed-off-by: Karol Szwaj <[email protected]> On-behalf-of: @SAP [email protected]
1 parent 779a5c2 commit 0cdf919

File tree

2 files changed

+59
-1
lines changed

2 files changed

+59
-1
lines changed

contrib/kcp-dex/README.md

Lines changed: 38 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,9 @@ GOBIN=$(pwd)/bin go install github.com/mjudeikis/genkey
2525

2626
### KCP
2727

28-
Start kcp with oidc enabled:
28+
Start kcp with oidc enabled, you can either use the OIDC flags or structured authentication configuration from a file. Example configuration is shown in `auth-config.yaml`.
29+
30+
## OIDC Flags
2931

3032
```bash
3133
go run ./cmd/kcp start \
@@ -35,6 +37,41 @@ go run ./cmd/kcp start \
3537
--oidc-ca-file=127.0.0.1.pem
3638
```
3739

40+
## Structured Authentication Config
41+
42+
```bash
43+
CA_CERT=$(openssl x509 -in 127.0.0.1.pem | sed 's/^/ /')
44+
```
45+
```bash
46+
cat << EOF_AuthConfig > auth-config.yaml
47+
apiVersion: apiserver.config.k8s.io/v1beta1
48+
kind: AuthenticationConfiguration
49+
jwt:
50+
- issuer:
51+
url: https://127.0.0.1:5556/dex
52+
certificateAuthority: |
53+
$CA_CERT
54+
audiences:
55+
- kcp-dev
56+
audienceMatchPolicy: MatchAny
57+
claimMappings:
58+
username:
59+
claim: "email"
60+
prefix: ""
61+
groups:
62+
claim: "groups"
63+
prefix: ""
64+
claimValidationRules: []
65+
userValidationRules: []
66+
EOF_AuthConfig
67+
```
68+
69+
Start a kcp server:
70+
71+
```bash
72+
./bin/kcp start --authentication-config auth-config.yaml
73+
```
74+
3875
### Login
3976

4077
Use oidc plugin:

contrib/kcp-dex/auth-config.yaml

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
apiVersion: apiserver.config.k8s.io/v1beta1
2+
kind: AuthenticationConfiguration
3+
jwt:
4+
- issuer:
5+
url: https://127.0.0.1:5556/dex
6+
certificateAuthority: |
7+
-----BEGIN CERTIFICATE-----
8+
enter your certificate here
9+
-----END CERTIFICATE-----
10+
audiences:
11+
- kcp-dev
12+
audienceMatchPolicy: MatchAny
13+
claimMappings:
14+
username:
15+
claim: "email"
16+
prefix: ""
17+
groups:
18+
claim: "groups"
19+
prefix: ""
20+
claimValidationRules: []
21+
userValidationRules: []

0 commit comments

Comments
 (0)