auth

package
v0.0.0-...-9451de5 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Feb 27, 2019 License: BSD-3-Clause Imports: 23 Imported by: 0

Documentation

Index

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 ConvertOldUser

func ConvertOldUser(u *User, err error) (*authTypes.User, error)

func ParseToken

func ParseToken(header string) (string, error)

ParseToken extracts token from a header: 'type token' or 'token'

func QuotaService

func QuotaService() (quotaTypes.QuotaService, error)

func RegisterScheme

func RegisterScheme(name string, scheme Scheme)

func RemoveRoleFromAllUsers

func RemoveRoleFromAllUsers(roleName string) error

func TeamService

func TeamService() (authTypes.TeamService, error)

func TeamTokenService

func TeamTokenService() (authTypes.TeamTokenService, error)

func UnregisterScheme

func UnregisterScheme(name string)

func UpdateRoleFromAllUsers

func UpdateRoleFromAllUsers(roleName, newRoleName, ctx, desc string) error

Types

type APIToken

type APIToken struct {
	Token     string `json:"token" bson:"apikey"`
	UserEmail string `json:"email" bson:"email"`
}

func APIAuth

func APIAuth(token string) (*APIToken, error)

func (*APIToken) GetAppName

func (t *APIToken) GetAppName() string

func (*APIToken) GetUserName

func (t *APIToken) GetUserName() string

func (*APIToken) GetValue

func (t *APIToken) GetValue() string

func (*APIToken) IsAppToken

func (t *APIToken) IsAppToken() bool

func (*APIToken) Permissions

func (t *APIToken) Permissions() ([]permission.Permission, error)

func (*APIToken) User

func (t *APIToken) User() (*authTypes.User, error)

type AuthenticationFailure

type AuthenticationFailure struct {
	Message string
}

func (AuthenticationFailure) Error

func (a AuthenticationFailure) Error() string

type ManagedScheme

type ManagedScheme interface {
	Scheme
	StartPasswordReset(user *User) error
	ResetPassword(user *User, resetToken string) error
	ChangePassword(token Token, oldPassword string, newPassword string) error
}

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
}

func GetScheme

func GetScheme(name string) (Scheme, error)

type SchemeInfo

type SchemeInfo map[string]interface{}

type Token

type Token authTypes.Token

Token type alias exists to ease refactoring while we move auth types to types/auth package. Both this type alias and the Convert*User funcs should be eliminated once we convert everyone to use authTypes.User.

type User

type User struct {
	Quota    quota.Quota
	Email    string
	Password string
	APIKey   string
	Roles    []authTypes.RoleInstance `bson:",omitempty"`
}

func ConvertNewUser

func ConvertNewUser(u *authTypes.User, err error) (*User, error)

func GetUserByEmail

func GetUserByEmail(email string) (*User, error)

func ListUsers

func ListUsers() ([]User, error)

ListUsers list all users registred in tsuru

func ListUsersWithPermissions

func ListUsersWithPermissions(wantedPerms ...permission.Permission) ([]User, error)

func ListUsersWithRole

func ListUsersWithRole(role string) ([]User, error)

func (*User) AddKey

func (u *User) AddKey(key repository.Key, force bool) error

func (*User) AddRole

func (u *User) AddRole(roleName string, contextValue string) error

func (*User) AddRolesForEvent

func (u *User) AddRolesForEvent(roleEvent *permTypes.RoleEvent, contextValue string) error

func (*User) Create

func (u *User) Create() error

func (*User) Delete

func (u *User) Delete() error

func (*User) ListKeys

func (u *User) ListKeys() (map[string]string, error)

func (*User) Permissions

func (u *User) Permissions() ([]permission.Permission, error)

func (*User) RegenerateAPIKey

func (u *User) RegenerateAPIKey() (string, error)

func (*User) Reload

func (u *User) Reload() error

func (*User) RemoveKey

func (u *User) RemoveKey(key repository.Key) error

func (*User) RemoveRole

func (u *User) RemoveRole(roleName string, contextValue string) error

func (*User) ShowAPIKey

func (u *User) ShowAPIKey() (string, error)

func (*User) Update

func (u *User) Update() error

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL