mirror of
https://github.com/goharbor/harbor
synced 2025-04-20 16:28:56 +00:00
Update the URL checking logic of auth proxy security generator (#11180)
As we don't support bearer token in Harbor 2.0, the URL checking logic in auth proxy security generator should be updated Signed-off-by: Wenkai Yin <yinw@vmware.com>
This commit is contained in:
parent
8984979bd2
commit
d05817c8a2
|
@ -38,7 +38,7 @@ func (a *authProxy) Generate(req *http.Request) security.Context {
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
// only support docker login
|
// only support docker login
|
||||||
if req.URL.Path != "/service/token" {
|
if !strings.HasPrefix(req.URL.Path, "/v2") {
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
proxyUserName, proxyPwd, ok := req.BasicAuth()
|
proxyUserName, proxyPwd, ok := req.BasicAuth()
|
||||||
|
|
|
@ -60,7 +60,7 @@ func TestAuthProxy(t *testing.T) {
|
||||||
})
|
})
|
||||||
|
|
||||||
// No onboard
|
// No onboard
|
||||||
req, err := http.NewRequest(http.MethodGet, "http://127.0.0.1/service/token", nil)
|
req, err := http.NewRequest(http.MethodGet, "http://127.0.0.1/v2", nil)
|
||||||
require.Nil(t, err)
|
require.Nil(t, err)
|
||||||
req = req.WithContext(lib.WithAuthMode(req.Context(), common.HTTPAuth))
|
req = req.WithContext(lib.WithAuthMode(req.Context(), common.HTTPAuth))
|
||||||
req.SetBasicAuth("tokenreview$administrator@vsphere.local", "reviEwt0k3n")
|
req.SetBasicAuth("tokenreview$administrator@vsphere.local", "reviEwt0k3n")
|
||||||
|
|
Loading…
Reference in New Issue
Block a user