1
0
mirror of https://github.com/docker/docs.git synced 2026-10-31 10:34:26 +03:00

fixing lint

This commit is contained in:
David Lawrence
2015-04-24 11:23:59 -07:00
parent 929828ba52
commit 6055569d48
3 changed files with 10 additions and 2 deletions

View File

@@ -5,10 +5,13 @@ import (
"net/http"
)
// User represents an entity
type User struct {
Name string
}
// Resource represents something that can be accessed and manipulated
// by a User
type Resource struct {
Type string `json:"type"`
Name string `json:"name"`
@@ -86,8 +89,8 @@ func (ss SimpleScope) ID() string {
return string(ss)
}
// TODO: possibly rename to Equals
// Compare compares to the given scope for equality.
// TODO: possibly rename to Equals
func (ss SimpleScope) Compare(toCompare Scope) bool {
return ss.ID() == toCompare.ID()
}

View File

@@ -18,6 +18,8 @@ import (
"github.com/docker/vetinari/utils"
)
// ConfigSection is the name used to identify the tokenAuthorizer config
// in the config json
const ConfigSection string = "token_auth"
type tokenConfig struct {
@@ -90,7 +92,7 @@ type tokenAuthorizer struct {
trustedKeys map[string]libtrust.PublicKey
}
// newAccessController creates an accessController using the given options.
// NewTokenAuthorizer creates an Authorizer that operates with JWTs.
func NewTokenAuthorizer(conf []byte) (auth.Authorizer, error) {
tokenConf := new(tokenConfig)
err := json.Unmarshal(conf, tokenConf)

View File

@@ -48,6 +48,9 @@ func (root *rootHandler) ServeHTTP(w http.ResponseWriter, r *http.Request) {
return
}
// ResourceName parses the name of the resource being accessed from the request.
// It relies on gorilla mux being used and will need to be updated if that
// changes
func ResourceName(r *http.Request) string {
params := mux.Vars(r)
if resource, ok := params["imageName"]; ok {