caddy-security
caddy-security copied to clipboard
Running portal on path rather than subdomain
Hi
I wonder whether it is possible to run the portal on the same subdomain but using a path like /auth and protect a path /documents?
Thank you.
@darox , yes. It is done with βrouteβ directive. what is the config you are currently using?
i have the some problem, i have this working config:
{
http_port 8080
https_port 8443
# debug
order authenticate before respond
order authorize before basicauth
security {
local identity store localdb {
realm local
path users.json
}
authentication portal myportal {
crypto default token lifetime 3600
crypto key sign-verify 12345678901234567890123456789012
enable identity store localdb
cookie domain 127.0.0.1
ui {
theme basic
links {
"My Website" / icon "las la-star"
}
}
transform user {
match origin local
action add role authp/user
ui link "Portal Settings" /settings icon "las la-cog"
}
}
authorization policy users_policy {
set auth url /auth
allow roles authp/admin authp/user
crypto key verify 12345678901234567890123456789012
acl rule {
comment allow users
match role authp/user
allow stop log info
}
acl rule {
comment default deny
match any
deny log warn
}
}
}
}
http://127.0.0.1:8080 {
route /auth* {
authenticate with myportal
}
route {
authorize with users_policy
respond * "assetq - admins" 200
}
}
once i change to this config i get 404 for the login portal
{
http_port 8080
https_port 8443
# debug
order authenticate before respond
order authorize before basicauth
security {
local identity store localdb {
realm local
path users.json
}
authentication portal myportal {
crypto default token lifetime 3600
crypto key sign-verify 12345678901234567890123456789012
enable identity store localdb
cookie domain 127.0.0.1
ui {
theme basic
links {
"My Website" / icon "las la-star"
}
}
transform user {
match origin local
action add role authp/user
ui link "Portal Settings" /settings icon "las la-cog"
}
}
authorization policy users_policy {
set auth url /secure-auth
allow roles authp/admin authp/user
crypto key verify 12345678901234567890123456789012
acl rule {
comment allow users
match role authp/user
allow stop log info
}
acl rule {
comment default deny
match any
deny log warn
}
}
}
}
http://127.0.0.1:8080 {
route /secure-auth* {
authenticate with myportal
}
route {
authorize with users_policy
respond * "assetq - admins" 200
}
}
@terefang , try this and report the outcome
route /secure-auth* {
authenticate /secure-auth* with myportal
}
@terefang , try this and report the outcome
route /secure-auth* { authenticate /secure-auth* with myportal }
still
This worked great for me. It should be a config example!
@darox , @j0dan @terefang , I am looking to add testimonial sections to https://authcrunch.com. Could you please write one and send it to me at [email protected]?