in pkg/testutil/bldr/oci_basic_auth_access.go [31:47]
func (ac *OCIBasicAuthAccess) Authorized(req *http.Request, _ ...auth.Access) (*auth.Grant, error) {
// Fetching does not require authentication
if req.Method == http.MethodGet || req.Method == http.MethodHead {
return &auth.Grant{User: auth.UserInfo{}, Resources: nil}, nil
}
username, password, ok := req.BasicAuth()
if !ok {
return nil, &basicAuthChallenge{}
}
if username == ac.user && password == ac.password {
return &auth.Grant{User: auth.UserInfo{}, Resources: nil}, nil
}
return nil, auth.ErrAuthenticationFailure
}