mirror of
https://github.com/moby/moby.git
synced 2022-11-09 12:21:53 -05:00
Vendor distribution changes
Signed-off-by: Derek McGowan <derek@mcgstyle.net> (github: dmcgowan)
This commit is contained in:
parent
6167a9ab16
commit
1e0b7538fa
2 changed files with 21 additions and 4 deletions
|
@ -87,7 +87,7 @@ clone git github.com/boltdb/bolt v1.2.1
|
||||||
clone git github.com/miekg/dns 75e6e86cc601825c5dbcd4e0c209eab180997cd7
|
clone git github.com/miekg/dns 75e6e86cc601825c5dbcd4e0c209eab180997cd7
|
||||||
|
|
||||||
# get graph and distribution packages
|
# get graph and distribution packages
|
||||||
clone git github.com/docker/distribution 4e17ab5d319ac5b70b2769442947567a83386fbc
|
clone git github.com/docker/distribution 07f32ac1831ed0fc71960b7da5d6bb83cb6881b5
|
||||||
clone git github.com/vbatts/tar-split v0.9.11
|
clone git github.com/vbatts/tar-split v0.9.11
|
||||||
|
|
||||||
# get go-zfs packages
|
# get go-zfs packages
|
||||||
|
|
|
@ -72,15 +72,19 @@ type endpointAuthorizer struct {
|
||||||
}
|
}
|
||||||
|
|
||||||
func (ea *endpointAuthorizer) ModifyRequest(req *http.Request) error {
|
func (ea *endpointAuthorizer) ModifyRequest(req *http.Request) error {
|
||||||
v2Root := strings.Index(req.URL.Path, "/v2/")
|
pingPath := req.URL.Path
|
||||||
if v2Root == -1 {
|
if v2Root := strings.Index(req.URL.Path, "/v2/"); v2Root != -1 {
|
||||||
|
pingPath = pingPath[:v2Root+4]
|
||||||
|
} else if v1Root := strings.Index(req.URL.Path, "/v1/"); v1Root != -1 {
|
||||||
|
pingPath = pingPath[:v1Root] + "/v2/"
|
||||||
|
} else {
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
ping := url.URL{
|
ping := url.URL{
|
||||||
Host: req.URL.Host,
|
Host: req.URL.Host,
|
||||||
Scheme: req.URL.Scheme,
|
Scheme: req.URL.Scheme,
|
||||||
Path: req.URL.Path[:v2Root+4],
|
Path: pingPath,
|
||||||
}
|
}
|
||||||
|
|
||||||
challenges, err := ea.challenges.GetChallenges(ping)
|
challenges, err := ea.challenges.GetChallenges(ping)
|
||||||
|
@ -151,6 +155,19 @@ func (rs RepositoryScope) String() string {
|
||||||
return fmt.Sprintf("repository:%s:%s", rs.Repository, strings.Join(rs.Actions, ","))
|
return fmt.Sprintf("repository:%s:%s", rs.Repository, strings.Join(rs.Actions, ","))
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// RegistryScope represents a token scope for access
|
||||||
|
// to resources in the registry.
|
||||||
|
type RegistryScope struct {
|
||||||
|
Name string
|
||||||
|
Actions []string
|
||||||
|
}
|
||||||
|
|
||||||
|
// String returns the string representation of the user
|
||||||
|
// using the scope grammar
|
||||||
|
func (rs RegistryScope) String() string {
|
||||||
|
return fmt.Sprintf("registry:%s:%s", rs.Name, strings.Join(rs.Actions, ","))
|
||||||
|
}
|
||||||
|
|
||||||
// TokenHandlerOptions is used to configure a new token handler
|
// TokenHandlerOptions is used to configure a new token handler
|
||||||
type TokenHandlerOptions struct {
|
type TokenHandlerOptions struct {
|
||||||
Transport http.RoundTripper
|
Transport http.RoundTripper
|
||||||
|
|
Loading…
Add table
Reference in a new issue