mirror of
https://github.com/goharbor/harbor.git
synced 2025-01-21 23:21:26 +01:00
insecure config
This commit is contained in:
parent
c1a8846a68
commit
7862bd8033
@ -337,7 +337,7 @@ func newRepositoryClient(endpoint string, insecure bool, username, password, rep
|
||||
credential := auth.NewBasicAuthCredential(username, password)
|
||||
authorizer := auth.NewStandardTokenAuthorizer(credential, insecure, scopeType, scopeName, scopeActions...)
|
||||
|
||||
store, err := auth.NewAuthorizerStore(endpoint, authorizer)
|
||||
store, err := auth.NewAuthorizerStore(endpoint, insecure, authorizer)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
@ -276,12 +276,16 @@ func (t *TargetAPI) Delete() {
|
||||
}
|
||||
}
|
||||
|
||||
func ListPolicies(){
|
||||
dao
|
||||
}
|
||||
|
||||
func newRegistryClient(endpoint string, insecure bool, username, password, scopeType, scopeName string,
|
||||
scopeActions ...string) (*registry.Registry, error) {
|
||||
credential := auth.NewBasicAuthCredential(username, password)
|
||||
authorizer := auth.NewStandardTokenAuthorizer(credential, insecure, scopeType, scopeName, scopeActions...)
|
||||
|
||||
store, err := auth.NewAuthorizerStore(endpoint, authorizer)
|
||||
store, err := auth.NewAuthorizerStore(endpoint, insecure, authorizer)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
@ -426,7 +426,7 @@ func newRepositoryClient(endpoint string, insecure bool, credential auth.Credent
|
||||
|
||||
authorizer := auth.NewStandardTokenAuthorizer(credential, insecure, scopeType, scopeName, scopeActions...)
|
||||
|
||||
store, err := auth.NewAuthorizerStore(endpoint, authorizer)
|
||||
store, err := auth.NewAuthorizerStore(endpoint, insecure, authorizer)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
4
service/cache/cache.go
vendored
4
service/cache/cache.go
vendored
@ -120,7 +120,7 @@ func NewRegistryClient(endpoint string, insecure bool, username, scopeType, scop
|
||||
scopeActions ...string) (*registry.Registry, error) {
|
||||
authorizer := auth.NewUsernameTokenAuthorizer(username, scopeType, scopeName, scopeActions...)
|
||||
|
||||
store, err := auth.NewAuthorizerStore(endpoint, authorizer)
|
||||
store, err := auth.NewAuthorizerStore(endpoint, insecure, authorizer)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
@ -138,7 +138,7 @@ func NewRepositoryClient(endpoint string, insecure bool, username, repository, s
|
||||
|
||||
authorizer := auth.NewUsernameTokenAuthorizer(username, scopeType, scopeName, scopeActions...)
|
||||
|
||||
store, err := auth.NewAuthorizerStore(endpoint, authorizer)
|
||||
store, err := auth.NewAuthorizerStore(endpoint, insecure, authorizer)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
@ -16,6 +16,7 @@
|
||||
package auth
|
||||
|
||||
import (
|
||||
"crypto/tls"
|
||||
"fmt"
|
||||
"net/http"
|
||||
|
||||
@ -39,10 +40,18 @@ type AuthorizerStore struct {
|
||||
}
|
||||
|
||||
// NewAuthorizerStore ...
|
||||
func NewAuthorizerStore(endpoint string, authorizers ...Authorizer) (*AuthorizerStore, error) {
|
||||
func NewAuthorizerStore(endpoint string, insecure bool, authorizers ...Authorizer) (*AuthorizerStore, error) {
|
||||
endpoint = utils.FormatEndpoint(endpoint)
|
||||
|
||||
resp, err := http.Get(buildPingURL(endpoint))
|
||||
client := &http.Client{
|
||||
Transport: &http.Transport{
|
||||
TLSClientConfig: &tls.Config{
|
||||
InsecureSkipVerify: insecure,
|
||||
},
|
||||
},
|
||||
}
|
||||
|
||||
resp, err := client.Get(buildPingURL(endpoint))
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user