-
-
Notifications
You must be signed in to change notification settings - Fork 79
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
question: How to use Microsoft Authentication? #362
Comments
@qxsch , you can only use authenticator with local auth. |
@greenpau i have a working setup now (using caddy security and Entra ID) :-) i could share the configuration, that can be used as an example. |
@qxsch , great. Please do share. |
{
http_port 80
https_port 443
security {
oauth identity provider azure {
realm azure
driver azure
tenant_id tttttttt-tttt-tttt-tttt-tttttttttttt
client_id cccccccc-cccc-cccc-cccc-cccccccccccc
client_secret Please-Enter-Your-Client-Secret-Here
scopes openid email profile
enable id_token_cookie azure_token
}
authentication portal oauthportal {
# RS512 is better
crypto key key1 sign from file /etc/caddy/jwt/sign_key1.pem
crypto key key1 verify from file /etc/caddy/jwt/verify_key1.pem
crypto default token lifetime 36000
enable identity provider azure
cookie lifetime 36000
cookie path /
transform user {
match realm azure
action add role authp/user
}
}
authorization policy oauthpolicy {
# RS512 is better
crypto key key1 sign from file /etc/caddy/jwt/sign_key1.pem
crypto key key1 verify from file /etc/caddy/jwt/verify_key1.pem
allow roles authp/user
validate bearer header
inject headers with claims
}
}
}
www.domain.com {
header {
X-Content-Type-Options "nosniff"
Referrer-Policy "same-origin"
}
route {
authorize with oauthpolicy
# path ends with html or htm -> cache conflicts with oauth
@htmFiles {
path *.html
path *.htm
path /
}
header @htmFiles {
-Etag
-Last-Modified
-Expires
Cache-Control: "no-store, no-cache, must-revalidate, max-age=0"
defer
}
file_server {
root /srv/admin
index index.html index.htm
precompressed zstd gzip
#push /*.html /css/style.css /js/script.js
}
}
@authportal {
path /portal
path /auth
path /portal/*
path /auth/*
path /logout
path /logout/*
}
route @authportal {
authenticate with oauthportal
}
handle_errors 404 {
rewrite * /error.html
file_server {
root /srv/admin
}
}
handle_path /api/* {
reverse_proxy {
to http://api-a:8000
}
}
}
|
@greenpau is there any way to put information from the azure jwt into caddy's jwt (f.e. oid field). i was playing around with transform user, but i could just set a static value to caddy's jwt. looking for something like |
How to use Microsoft Authentication?
It seems, that the Microsoft AuthCrunch Guide is incomplete.
Also there is no exmaple for Microsoft at: https://github.com/authcrunch/authcrunch.github.io/tree/main/assets/conf/oauth
Goal
my goal:
/api/*
( reverse_proxy )what i have done
i have followed the instructions here:
https://docs.authcrunch.com/docs/authenticate/oauth/backend-oauth2-0006-microsoft
i get the following error message:
i have the below docker file:
and the caddy file looks like this:
The text was updated successfully, but these errors were encountered: