mirror of
https://github.com/project-zot/zot.git
synced 2026-06-18 05:28:07 +08:00
Introduce support for OIDC workload identity federation (#3711)
* feat(oidc): introduce support for OIDC workload identity federation Signed-off-by: Matheus Pimenta <matheuscscp@gmail.com> * feat(oidc): add e2e test for bearer OIDC and a kind cluster Signed-off-by: Matheus Pimenta <matheuscscp@gmail.com> * feat(oidc): make OIDC workload identity federation its own feature Signed-off-by: Matheus Pimenta <matheuscscp@gmail.com> * feat(oidc): move errors to the errors package Signed-off-by: Matheus Pimenta <matheuscscp@gmail.com> * feat(oidc): fix race in cel package Signed-off-by: Matheus Pimenta <matheuscscp@gmail.com> * feat(oidc): compile cel expressions Signed-off-by: Matheus Pimenta <matheuscscp@gmail.com> --------- Signed-off-by: Matheus Pimenta <matheuscscp@gmail.com>
This commit is contained in:
+8
-5
@@ -17,9 +17,10 @@ import (
|
||||
)
|
||||
|
||||
const (
|
||||
BASIC = "Basic"
|
||||
BEARER = "Bearer"
|
||||
OPENID = "OpenID"
|
||||
BASIC = "Basic"
|
||||
BEARER = "Bearer"
|
||||
BEARER_OIDC = "BearerOIDC" // OIDC bearer tokens use accessControl config for authorization
|
||||
OPENID = "OpenID"
|
||||
)
|
||||
|
||||
func AuthzFilterFunc(userAc *reqCtx.UserAccessControl) storageTypes.FilterRepoFunc {
|
||||
@@ -264,7 +265,8 @@ func BaseAuthzHandler(ctlr *Controller) mux.MiddlewareFunc {
|
||||
return
|
||||
}
|
||||
|
||||
// request comes from bearer authn, bypass it
|
||||
// request comes from bearer authn, bypass it. note: we don't bypass for BEARER_OIDC
|
||||
// tokens since they use accessControl config for authorization
|
||||
authnMwCtx, err := reqCtx.GetAuthnMiddlewareContext(request.Context())
|
||||
if err != nil || (authnMwCtx != nil && authnMwCtx.AuthnType == BEARER) {
|
||||
next.ServeHTTP(response, request)
|
||||
@@ -311,7 +313,8 @@ func DistSpecAuthzHandler(ctlr *Controller) mux.MiddlewareFunc {
|
||||
return
|
||||
}
|
||||
|
||||
// request comes from bearer authn, bypass it
|
||||
// request comes from bearer authn, bypass it. note: we don't bypass for BEARER_OIDC
|
||||
// tokens since they use accessControl config for authorization
|
||||
authnMwCtx, err := reqCtx.GetAuthnMiddlewareContext(request.Context())
|
||||
if err != nil || (authnMwCtx != nil && authnMwCtx.AuthnType == BEARER) {
|
||||
next.ServeHTTP(response, request)
|
||||
|
||||
Reference in New Issue
Block a user