mirror of
https://github.com/goharbor/harbor.git
synced 2025-01-28 02:21:24 +01:00
fix: fix scanner apikey type match error
Signed-off-by: chlins <chlins.zhang@gmail.com>
This commit is contained in:
parent
8af343f27a
commit
21b56d241a
@ -37,9 +37,9 @@ func (aa *apiKeyAuthorizer) Authorize(req *http.Request) error {
|
||||
}
|
||||
|
||||
// NewAPIKeyAuthorizer news a apiKeyAuthorizer
|
||||
func NewAPIKeyAuthorizer(accessCred string) Authorizer {
|
||||
func NewAPIKeyAuthorizer(key, accessCred string) Authorizer {
|
||||
return &apiKeyAuthorizer{
|
||||
typeID: APIKey,
|
||||
typeID: key,
|
||||
accessCred: accessCred,
|
||||
}
|
||||
}
|
||||
|
@ -28,7 +28,9 @@ const (
|
||||
// Bearer ...
|
||||
Bearer = "Bearer"
|
||||
// APIKey ...
|
||||
APIKey = "X-ScannerAdapter-API-Key"
|
||||
APIKey = "APIKey"
|
||||
// APIKeyScannerAdapter ...
|
||||
APIKeyScannerAdapter = "X-ScannerAdapter-API-Key"
|
||||
)
|
||||
|
||||
// Authorizer defines operation for authorizing the requests
|
||||
@ -47,7 +49,7 @@ func GetAuthorizer(auth, cred string) (Authorizer, error) {
|
||||
case Bearer:
|
||||
return NewBearerAuth(cred), nil
|
||||
case APIKey:
|
||||
return NewAPIKeyAuthorizer(cred), nil
|
||||
return NewAPIKeyAuthorizer(APIKeyScannerAdapter, cred), nil
|
||||
default:
|
||||
return nil, errors.Errorf("auth type %s is not supported", auth)
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user