mirror of
https://github.com/goharbor/harbor.git
synced 2025-02-16 20:01:35 +01:00
Skip robot account for oidc_cli middleware (#18317)
Fixes #15253 Signed-off-by: stonezdj <daojunz@vmware.com>
This commit is contained in:
parent
5a065d1cd8
commit
5c9ce836cf
@ -26,6 +26,7 @@ import (
|
||||
"github.com/goharbor/harbor/src/common/security/local"
|
||||
"github.com/goharbor/harbor/src/controller/user"
|
||||
"github.com/goharbor/harbor/src/lib"
|
||||
"github.com/goharbor/harbor/src/lib/config"
|
||||
"github.com/goharbor/harbor/src/lib/log"
|
||||
"github.com/goharbor/harbor/src/pkg/oidc"
|
||||
)
|
||||
@ -57,6 +58,11 @@ func (o *oidcCli) Generate(req *http.Request) security.Context {
|
||||
if !o.valid(req) {
|
||||
return nil
|
||||
}
|
||||
|
||||
if strings.HasPrefix(username, config.RobotPrefix(ctx)) {
|
||||
return nil
|
||||
}
|
||||
|
||||
info, err := oidc.VerifySecret(ctx, username, secret)
|
||||
if err != nil {
|
||||
logger.Errorf("failed to verify secret, username: %s, error: %v", username, err)
|
||||
|
Loading…
Reference in New Issue
Block a user