You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
We have two different realms in our Keycloak setup. Staff and external associates. We have a service that requires both realms to be authenticated on said web service. Is this possible to accomplice that with caddy-security? Any example configs on how to do that?
The text was updated successfully, but these errors were encountered:
I came up with a demo using two OpenID-Connect IdPs to protect some pages, which can then be adapted to any other IdP like Keycloak.
Put the config below in a Caddyfile file and then run docker run -p 8080:80 -v ./Caddyfile:/etc/caddy/Caddyfile ghcr.io/authcrunch/authcrunch, it uses oauth.wiremockapi.cloud to mock a real IdP and then in the whoami page you can check that the appropriate role has been set:
{
auto_https off
debug
order authenticate before respond
order authorize before basicauth
security {
oauth identity provider idp1 {
driver generic
realm idp1
client_id the_client_id_for_idp1
client_secret the_secret_for_idp1
scopes openid email profile
metadata_url https://oauth.wiremockapi.cloud/.well-known/openid-configuration
}
oauth identity provider idp2 {
driver generic
realm idp2
client_id the_client_id_for_idp2
client_secret the_secret_for_idp2
scopes openid email profile
metadata_url https://oauth.wiremockapi.cloud/.well-known/openid-configuration
}
authentication portal authportal {
enable identity provider idp1
enable identity provider idp2
transform user {
match realm idp1
action add role idp1/user
}
transform user {
match realm idp2
action add role idp2/user
}
ui {
links {
"whoami" /auth/whoami icon "las la-rocket"
"root" / icon "las la-sitemap"
}
}
}
authorization policy authpolicy {
set auth url /auth
allow roles idp1/user idp2/user
}
}
}
:80 {
handle /auth* {
authenticate with authportal
}
handle /* {
authorize with authpolicy
header Content-Type text/html
respond <<HTML
<html>
<head><title>Caddy auth test</title></head>
<body>
<h1>It works!</h1>
<a href=/auth/whoami>Check the auth token contents</a>
</body>
</html>
HTML 200
}
}
We have two different realms in our Keycloak setup. Staff and external associates. We have a service that requires both realms to be authenticated on said web service. Is this possible to accomplice that with caddy-security? Any example configs on how to do that?
The text was updated successfully, but these errors were encountered: