mirror of
https://github.com/goharbor/harbor.git
synced 2024-11-02 16:49:48 +01:00
Merge pull request #305 from ywk253100/sync_image
bug fix: the username in token is null when using basic auth
This commit is contained in:
commit
ca6131e67d
@ -38,7 +38,7 @@ type Handler struct {
|
||||
// checkes the permission agains local DB and generates jwt token.
|
||||
func (h *Handler) Get() {
|
||||
|
||||
var username string
|
||||
var username, password string
|
||||
request := h.Ctx.Request
|
||||
service := h.GetString("service")
|
||||
scopes := h.GetStrings("scope")
|
||||
@ -49,7 +49,7 @@ func (h *Handler) Get() {
|
||||
log.Debugf("Will grant all access as this request is from job service with legal secret.")
|
||||
username = "job-service-user"
|
||||
} else {
|
||||
username, password, _ := request.BasicAuth()
|
||||
username, password, _ = request.BasicAuth()
|
||||
authenticated := authenticate(username, password)
|
||||
|
||||
if len(scopes) == 0 && !authenticated {
|
||||
|
Loading…
Reference in New Issue
Block a user