-
Notifications
You must be signed in to change notification settings - Fork 1
/
Caddyfile
56 lines (48 loc) · 1.29 KB
/
Caddyfile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
{
order authenticate before respond
order authorize before basicauth
security {
oauth identity provider generic {
realm generic
driver generic
base_auth_url {$CADDY_SECURITY_BASE_AUTH_URL}
metadata_url {$CADDY_SECURITY_METADATA}
client_id {$CADDY_SECURITY_CLIENT_ID}
client_secret {$CADDY_SECURITY_CLIENT_SECRET}
scopes openid email profile
delay_start 5
retry_attempts 100
retry_interval 10
}
authentication portal oidc-provider {
crypto default token lifetime 86400
crypto key sign-verify {$CADDY_SECURITY_CLIENT_SECRET}
enable identity provider generic
cookie domain test.localhost
transform user {
exact match realm generic
action add role authp/user
}
}
authorization policy oidc-provider {
set auth url https://bytebase.test.localhost:8443/caddy-security/oauth2/generic
crypto key verify {$CADDY_SECURITY_CLIENT_SECRET}
validate bearer header
allow roles authp/user
inject header "X-User-Email" from email
inject header "X-User-Name" from sub
inject header "X-User-Role" from roles
}
}
}
bytebase.test.localhost:8443 {
tls internal
handle /caddy-security/* {
authenticate with oidc-provider
}
handle {
authorize with oidc-provider
reverse_proxy /auth bytebase-unauth:8080
reverse_proxy bytebase:8080
}
}