mirror of
https://github.com/goharbor/harbor.git
synced 2025-01-30 19:41:29 +01:00
fix bugs
This commit is contained in:
parent
44b27e71c2
commit
aa9fa581ec
@ -23,7 +23,7 @@ import (
|
|||||||
"github.com/vmware/harbor/dao"
|
"github.com/vmware/harbor/dao"
|
||||||
"github.com/vmware/harbor/models"
|
"github.com/vmware/harbor/models"
|
||||||
svc_utils "github.com/vmware/harbor/service/utils"
|
svc_utils "github.com/vmware/harbor/service/utils"
|
||||||
log "github.com/vmware/harbor/utils/log"
|
"github.com/vmware/harbor/utils/log"
|
||||||
|
|
||||||
"github.com/astaxie/beego"
|
"github.com/astaxie/beego"
|
||||||
)
|
)
|
||||||
|
@ -21,7 +21,7 @@ import (
|
|||||||
"github.com/vmware/harbor/auth"
|
"github.com/vmware/harbor/auth"
|
||||||
"github.com/vmware/harbor/models"
|
"github.com/vmware/harbor/models"
|
||||||
svc_utils "github.com/vmware/harbor/service/utils"
|
svc_utils "github.com/vmware/harbor/service/utils"
|
||||||
log "github.com/vmware/harbor/utils/log"
|
"github.com/vmware/harbor/utils/log"
|
||||||
|
|
||||||
"github.com/astaxie/beego"
|
"github.com/astaxie/beego"
|
||||||
"github.com/docker/distribution/registry/auth/token"
|
"github.com/docker/distribution/registry/auth/token"
|
||||||
@ -38,7 +38,7 @@ type TokenHandler struct {
|
|||||||
func (a *TokenHandler) Get() {
|
func (a *TokenHandler) Get() {
|
||||||
|
|
||||||
request := a.Ctx.Request
|
request := a.Ctx.Request
|
||||||
log.Info("request url: " + request.URL.String())
|
log.Infof("request url: " + request.URL.String())
|
||||||
username, password, _ := request.BasicAuth()
|
username, password, _ := request.BasicAuth()
|
||||||
authenticated := authenticate(username, password)
|
authenticated := authenticate(username, password)
|
||||||
service := a.GetString("service")
|
service := a.GetString("service")
|
||||||
|
@ -25,7 +25,7 @@ import (
|
|||||||
"time"
|
"time"
|
||||||
|
|
||||||
"github.com/vmware/harbor/dao"
|
"github.com/vmware/harbor/dao"
|
||||||
log "github.com/vmware/harbor/utils/log"
|
"github.com/vmware/harbor/utils/log"
|
||||||
|
|
||||||
"github.com/docker/distribution/registry/auth/token"
|
"github.com/docker/distribution/registry/auth/token"
|
||||||
"github.com/docker/libtrust"
|
"github.com/docker/libtrust"
|
||||||
|
@ -20,7 +20,7 @@ import (
|
|||||||
"time"
|
"time"
|
||||||
|
|
||||||
"github.com/vmware/harbor/models"
|
"github.com/vmware/harbor/models"
|
||||||
log "github.com/vmware/harbor/utils/log"
|
"github.com/vmware/harbor/utils/log"
|
||||||
|
|
||||||
"github.com/astaxie/beego/cache"
|
"github.com/astaxie/beego/cache"
|
||||||
)
|
)
|
||||||
|
@ -23,7 +23,7 @@ import (
|
|||||||
"os"
|
"os"
|
||||||
"strings"
|
"strings"
|
||||||
|
|
||||||
log "github.com/vmware/harbor/utils/log"
|
"github.com/vmware/harbor/utils/log"
|
||||||
)
|
)
|
||||||
|
|
||||||
// BuildRegistryURL ...
|
// BuildRegistryURL ...
|
||||||
@ -35,7 +35,7 @@ func BuildRegistryURL(segments ...string) string {
|
|||||||
url := registryURL + "/v2"
|
url := registryURL + "/v2"
|
||||||
for _, s := range segments {
|
for _, s := range segments {
|
||||||
if s == "v2" {
|
if s == "v2" {
|
||||||
log.Infof("unnecessary v2 in %v", segments)
|
log.Debugf("unnecessary v2 in %v", segments)
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
url += "/" + s
|
url += "/" + s
|
||||||
@ -60,7 +60,7 @@ func RegistryAPIGet(url, username string) ([]byte, error) {
|
|||||||
} else if response.StatusCode == http.StatusUnauthorized {
|
} else if response.StatusCode == http.StatusUnauthorized {
|
||||||
authenticate := response.Header.Get("WWW-Authenticate")
|
authenticate := response.Header.Get("WWW-Authenticate")
|
||||||
str := strings.Split(authenticate, " ")[1]
|
str := strings.Split(authenticate, " ")[1]
|
||||||
log.Info("url: " + url)
|
log.Debugf("url: " + url)
|
||||||
var service string
|
var service string
|
||||||
var scope string
|
var scope string
|
||||||
strs := strings.Split(str, ",")
|
strs := strings.Split(str, ",")
|
||||||
|
Loading…
Reference in New Issue
Block a user