Skip to content

Commit

Permalink
Add support for custom callback URI
Browse files Browse the repository at this point in the history
  • Loading branch information
simaotwx committed Mar 1, 2022
1 parent 7f0bac7 commit d6bea7c
Show file tree
Hide file tree
Showing 3 changed files with 27 additions and 1 deletion.
1 change: 1 addition & 0 deletions caddyfile_authn.go
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,7 @@ const (
// disable metadata_discovery
// authorization_url <authorization_url>
// disable key_verification
// callback_url <callback_url>
// }
//
// backend gitlab {
Expand Down
2 changes: 1 addition & 1 deletion caddyfile_authn_backends.go
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,7 @@ func parseCaddyfileAuthPortalBackends(h *caddyfile.Dispenser, repl *caddy.Replac
case "idp_metadata_location", "idp_sign_cert_location", "tenant_id", "idp_login_url",
"application_id", "application_name", "entity_id", "domain_name",
"client_id", "client_secret", "server_id", "base_auth_url", "metadata_url",
"identity_token_name", "authorization_url", "token_url":
"identity_token_name", "authorization_url", "token_url", "callback_url":
if !h.NextArg() {
return backendValueErr(h, backendName, backendArg)
}
Expand Down
25 changes: 25 additions & 0 deletions caddyfile_authn_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -133,6 +133,17 @@ func TestParseCaddyfileAuthentication(t *testing.T) {
server_id default
scopes openid email profile groups
}
oidc_backend {
method oauth2
realm oidc
provider generic
client_id 42246c62-c07a-43b4-9b32-976e517fd2a9
client_secret d09511fd-8945-47fe-b78c-3dd2d1708184
scopes openid
base_auth_url https://auth.example.com/
metadata_url https://auth.example.com/.well-known/openid-configuration
callback_url /custom-callback
}
}
}
}`),
Expand Down Expand Up @@ -284,6 +295,20 @@ func TestParseCaddyfileAuthentication(t *testing.T) {
"server_id": "default",
"scopes": ["openid", "email", "profile", "groups"]
}
},
{
"oauth2": {
"name": "oidc_backend",
"method": "oauth2",
"realm": "oidc",
"provider": "generic",
"client_id": "42246c62-c07a-43b4-9b32-976e517fd2a9",
"client_secret": "d09511fd-8945-47fe-b78c-3dd2d1708184",
"scopes": ["openid"],
"base_auth_url": "https://auth.example.com/",
"metadata_url": "https://auth.example.com/.well-known/openid-configuration",
"callback_url": "/custom-callback"
}
}
],
"token_validator_options": {
Expand Down

0 comments on commit d6bea7c

Please sign in to comment.