mirror of
https://github.com/fnproject/fn.git
synced 2022-10-28 21:29:17 +03:00
add funcy/functions_go & update docker/distribution
This commit is contained in:
committed by
Travis Reeder
parent
452dc1ee86
commit
c9c7950d0f
24
vendor/github.com/docker/distribution/registry/auth/token/token.go
generated
vendored
24
vendor/github.com/docker/distribution/registry/auth/token/token.go
generated
vendored
@@ -34,6 +34,7 @@ var (
|
||||
// ResourceActions stores allowed actions on a named and typed resource.
|
||||
type ResourceActions struct {
|
||||
Type string `json:"type"`
|
||||
Class string `json:"class,omitempty"`
|
||||
Name string `json:"name"`
|
||||
Actions []string `json:"actions"`
|
||||
}
|
||||
@@ -349,6 +350,29 @@ func (t *Token) accessSet() accessSet {
|
||||
return accessSet
|
||||
}
|
||||
|
||||
func (t *Token) resources() []auth.Resource {
|
||||
if t.Claims == nil {
|
||||
return nil
|
||||
}
|
||||
|
||||
resourceSet := map[auth.Resource]struct{}{}
|
||||
for _, resourceActions := range t.Claims.Access {
|
||||
resource := auth.Resource{
|
||||
Type: resourceActions.Type,
|
||||
Class: resourceActions.Class,
|
||||
Name: resourceActions.Name,
|
||||
}
|
||||
resourceSet[resource] = struct{}{}
|
||||
}
|
||||
|
||||
resources := make([]auth.Resource, 0, len(resourceSet))
|
||||
for resource := range resourceSet {
|
||||
resources = append(resources, resource)
|
||||
}
|
||||
|
||||
return resources
|
||||
}
|
||||
|
||||
func (t *Token) compactRaw() string {
|
||||
return fmt.Sprintf("%s.%s", t.Raw, joseBase64UrlEncode(t.Signature))
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user