mirror of
https://github.com/project-zot/zot.git
synced 2026-06-15 11:37:56 +08:00
cb9d682a69
* feat(auth): map OpenID groups claim Signed-off-by: Akash Kumar <meakash7902@gmail.com> * fix(auth): refine OIDC claim mapping logs Signed-off-by: Akash Kumar <meakash7902@gmail.com> * refactor(auth): collapse OIDC username fallback into nested if Reuse the empty-username branch for the email fallback so the value is checked once and the failure path lives next to the recovery attempt. Signed-off-by: Akash Kumar <meakash7902@gmail.com> * refactor(auth): consolidate OIDC claim extraction into authn.go Move getOpenIDClaimMapping, getOpenIDUsername, and appendOpenIDGroups out of routes.go into authn.go alongside a new extractOpenIDIdentity helper that owns the username/groups extraction flow. This keeps the HTTP callback in routes.go thin and groups OIDC plumbing with the rest of the authentication code. Also: - Filter nil and empty entries consistently across the []any, []string, and string branches of appendOpenIDGroups, with new test cases covering []any{nil, ""} and []string{"admin","",...}. - Surface a Warn log when an operator-configured username claim is missing/empty so the fallback to email isn't silent. - Rename openid_claim_mapping_internal_test.go to authn_internal_test.go and drop the build tags that aren't needed for the internal tests. Signed-off-by: Akash Kumar <meakash7902@gmail.com> --------- Signed-off-by: Akash Kumar <meakash7902@gmail.com>
57 lines
1.3 KiB
JSON
57 lines
1.3 KiB
JSON
{
|
|
"distSpecVersion": "1.1.1",
|
|
"storage": {
|
|
"rootDirectory": "/tmp/zot",
|
|
"dedupe": true
|
|
},
|
|
"http": {
|
|
"address": "127.0.0.1",
|
|
"port": "8080",
|
|
"externalUrl": "http://127.0.0.1:8080",
|
|
"realm": "zot",
|
|
"auth": {
|
|
"sessionKeysFile": "examples/sessionKeys.json",
|
|
"openid": {
|
|
"callbackAllowOrigins": ["http://127.0.0.1:3000"],
|
|
"providers": {
|
|
"oidc": {
|
|
"name": "Zitadel",
|
|
"issuer": "https://iam.example.com",
|
|
"credentialsFile": "examples/config-openid-oidc-credentials.json",
|
|
"scopes": ["openid", "profile", "email", "groups"],
|
|
"claimMapping": {
|
|
"username": "preferred_username",
|
|
"groups": "groups"
|
|
}
|
|
}
|
|
}
|
|
},
|
|
"failDelay": 5
|
|
},
|
|
"accessControl": {
|
|
"repositories": {
|
|
"**": {
|
|
"policies": [
|
|
{
|
|
"users": [
|
|
"admin"
|
|
],
|
|
"actions": [
|
|
"read",
|
|
"create",
|
|
"update",
|
|
"delete"
|
|
]
|
|
}
|
|
],
|
|
"defaultPolicy": ["read"]
|
|
}
|
|
}
|
|
}
|
|
},
|
|
"log": {
|
|
"level": "debug"
|
|
},
|
|
"extensions": {}
|
|
}
|