Documentation ¶
Index ¶
- Variables
- func BaseTokenPermission(t Token) ([]permission.Permission, error)
- func ChangeQuota(user *User, limit int) error
- func ParseToken(header string) (string, error)
- func RegisterScheme(name string, scheme Scheme)
- func ReleaseApp(user *User) error
- func RemoveRoleFromAllUsers(roleName string) error
- func ReserveApp(user *User) error
- func TeamService() authTypes.TeamService
- func UnregisterScheme(name string)
- func UpdateRoleFromAllUsers(roleName, newRoleName, ctx, desc string) error
- type APIToken
- type AuthenticationFailure
- type ManagedScheme
- type Scheme
- type SchemeInfo
- type Token
- type User
- func (u *User) AddKey(key repository.Key, force bool) error
- func (u *User) AddRole(roleName string, contextValue string) error
- func (u *User) AddRolesForEvent(roleEvent *permission.RoleEvent, contextValue string) error
- func (u *User) Create() error
- func (u *User) Delete() error
- func (u *User) ListKeys() (map[string]string, error)
- func (u *User) Permissions() ([]permission.Permission, error)
- func (u *User) RegenerateAPIKey() (string, error)
- func (u *User) Reload() error
- func (u *User) RemoveKey(key repository.Key) error
- func (u *User) RemoveRole(roleName string, contextValue string) error
- func (u *User) ShowAPIKey() (string, error)
- func (u *User) Update() error
Constants ¶
This section is empty.
Variables ¶
View Source
var ErrInvalidToken = errors.New("Invalid token")
Functions ¶
func BaseTokenPermission ¶
func BaseTokenPermission(t Token) ([]permission.Permission, error)
func ChangeQuota ¶
ChangeQuota redefines the limit of the user. The new limit must be bigger than or equal to the current number of apps of the user. The new limit maybe smaller than 0, which mean that the user should have an unlimited number of apps.
func ParseToken ¶
ParseToken extracts token from a header: 'type token' or 'token'
func RegisterScheme ¶
func ReleaseApp ¶
ReleaseApp releases an app from the user list, releasing the quota spot for another app.
func RemoveRoleFromAllUsers ¶
func ReserveApp ¶
ReserveApp reserves an app for the user, reserving it in the database. It's used to reserve the app in the user quota, returning an error when there isn't any space available.
func TeamService ¶
func TeamService() authTypes.TeamService
func UnregisterScheme ¶
func UnregisterScheme(name string)
func UpdateRoleFromAllUsers ¶
Types ¶
type APIToken ¶
type APIToken struct { Token string `json:"token" bson:"apikey"` UserEmail string `json:"email" bson:"email"` }
func (*APIToken) GetAppName ¶
func (*APIToken) GetUserName ¶
func (*APIToken) IsAppToken ¶
func (*APIToken) Permissions ¶
func (t *APIToken) Permissions() ([]permission.Permission, error)
type AuthenticationFailure ¶
type AuthenticationFailure struct {
Message string
}
func (AuthenticationFailure) Error ¶
func (a AuthenticationFailure) Error() string
type ManagedScheme ¶
type Scheme ¶
type Scheme interface { AppLogin(appName string) (Token, error) AppLogout(token string) error Login(params map[string]string) (Token, error) Logout(token string) error Auth(token string) (Token, error) Info() (SchemeInfo, error) Name() string Create(user *User) (*User, error) Remove(user *User) error }
type SchemeInfo ¶
type SchemeInfo map[string]interface{}
type Token ¶
type Token interface { GetValue() string GetAppName() string GetUserName() string IsAppToken() bool User() (*User, error) Permissions() ([]permission.Permission, error) }
type User ¶
type User struct { quota.Quota Email string Password string APIKey string Roles []authTypes.RoleInstance `bson:",omitempty"` }
func GetUserByEmail ¶
func ListUsersWithPermissions ¶
func ListUsersWithPermissions(wantedPerms ...permission.Permission) ([]User, error)
func ListUsersWithRole ¶
func (*User) AddRolesForEvent ¶
func (u *User) AddRolesForEvent(roleEvent *permission.RoleEvent, contextValue string) error
func (*User) Permissions ¶
func (u *User) Permissions() ([]permission.Permission, error)
func (*User) RegenerateAPIKey ¶
func (*User) ShowAPIKey ¶
Click to show internal directories.
Click to hide internal directories.