Documentation
¶
Index ¶
Constants ¶
View Source
const ( // DS is the location of the token datastore DS = "core" + string(os.PathSeparator) + "token.ds" )
Variables ¶
View Source
var ErrTokenLevel = errors.New("Token grants permissions that the requester does not currently have.")
ErrTokenLevel is when a token is created that grants more permissions than the requester has
Functions ¶
Types ¶
type Token ¶
type Token struct { Token string `json:"token,omitempty"` // Unique identifier used for authentication ID string `json:"id,omitempty"` //Unique identifier used for identification Name string `json:"name,omitempty"` Expires string `json:"expires,omitempty"` Resource string `json:"resource,omitempty"` Permission string `json:"permission,omitempty"` Created string `json:"created,omitempty"` // contains filtered or unexported fields }
Token grants access to everything a user can access, or access just to a specific resource and permissions level
func (*Token) GetPermission ¶
func (t *Token) GetPermission(res permission.Permitter) (*permission.Permission, error)
GetPermission creates the permissions to check against based on the token. token access is unauthenticated in that the token doesn't have a *user.User if a permission and / or a resource is supplied so SetPermissions sets the appropriate public permissions based on token
Click to show internal directories.
Click to hide internal directories.