Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var ( ErrUnknown = errors.New("user unknown error") ErrUserNotFound = errors.New("user not found") ErrInvalidUsernameOrPassword = errors.New("invalid username or password") ErrAccessTokenNotFound = errors.New("access token not found") ErrAgentTokenNotFound = errors.New("agent token not found") ErrBadTokenFormat = errors.New("bad format token") )
Functions ¶
This section is empty.
Types ¶
type AccessToken ¶
func NewAccessToken ¶
func NewAccessToken() *AccessToken
func ParseAccessTokenFromString ¶
func ParseAccessTokenFromString(s string) (*AccessToken, error)
type AgentToken ¶
func NewAgentToken ¶
func NewAgentToken(name string) *AgentToken
func ParseAgentTokenFromString ¶
func ParseAgentTokenFromString(s string) (*AgentToken, error)
func (*AgentToken) String ¶
func (t *AgentToken) String() string
type EncryptedPassword ¶
type EncryptedPassword string
func NewEncryptedPassword ¶
func NewEncryptedPassword(password string) EncryptedPassword
func NewEncryptedPasswordWithSalt ¶
func NewEncryptedPasswordWithSalt(password, salt string) EncryptedPassword
func (EncryptedPassword) Salt ¶
func (ep EncryptedPassword) Salt() string
func (EncryptedPassword) String ¶
func (ep EncryptedPassword) String() string
func (EncryptedPassword) Validate ¶
func (ep EncryptedPassword) Validate(password string) bool
type Repository ¶
type Repository interface { CreateUser(*User) (*User, error) DeleteUserByID(id UserID) error GetUserByID(id UserID) (*User, error) CreateAccessToken(UserID, *AccessToken) error DeleteAccessTokens(UserID, []*AccessToken) error LookupUserByUsername(username string) (*User, error) LookupUserByAccessToken(*AccessToken) (*User, error) CreateAgentToken(UserID, *AgentToken) error DeleteAgentTokens(UserID, []*AgentToken) error LookupUserByAgentToken(*AgentToken) (*User, error) LookupAgentTokenByName(UserID, string) (*AgentToken, error) }
type User ¶
type User struct { ID UserID Username string Password EncryptedPassword Email Email AccessTokens []*AccessToken AgentTokens []*AgentToken }
func (*User) LookupAccessTokenByString ¶
func (user *User) LookupAccessTokenByString(s string) (*AccessToken, bool)
func (*User) LookupAgentTokenByString ¶
func (user *User) LookupAgentTokenByString(s string) (*AgentToken, bool)
func (*User) ValidatePassword ¶
Click to show internal directories.
Click to hide internal directories.