Documentation ¶
Index ¶
- Variables
- func BaseTokenPermission(t Token) ([]permission.Permission, error)
- func ChangeQuota(user *User, limit int) error
- func CreateTeam(name string, user *User) error
- func GetTeam(name string) (*authTypes.Team, error)
- func GetTeamsNames(teams []authTypes.Team) []string
- func ListTeams() ([]authTypes.Team, error)
- func ParseToken(header string) (string, error)
- func RegisterScheme(name string, scheme Scheme)
- func ReleaseApp(user *User) error
- func RemoveRoleFromAllUsers(roleName string) error
- func RemoveTeam(teamName 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 ErrTeamStillUsed
- type ManagedScheme
- type RoleInstance
- 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 ( ErrUserNotFound = errors.New("user not found") ErrInvalidKey = errors.New("invalid key") ErrKeyDisabled = errors.New("key management is disabled") )
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 CreateTeam ¶
CreateTeam creates a team and add users to this team.
func GetTeamsNames ¶
GetTeamsNames maps teams to a list of team names.
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 RemoveTeam ¶
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 ErrTeamStillUsed ¶
func (*ErrTeamStillUsed) Error ¶
func (e *ErrTeamStillUsed) Error() string
type ManagedScheme ¶
type RoleInstance ¶
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 []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.