Documentation ¶
Index ¶
- Variables
- func IsUserError(err error) bool
- type Authenticator
- func (authenticator Authenticator) CreateUser(useridStr string, name string, password []byte, clientId string, ...) (*string, *string, error)
- func (authenticator Authenticator) Login(useridStr string, password []byte, clientId string, userStorage UserDb_I) (acToken *string, refToken *string, name *string, language *string, e error)
- func (authenticator Authenticator) VerifyPrivilege(userInfo UserAuthInfo, levelToMeet PVL) (ok bool, err error)
- type Language
- type MockUserCredentials_I
- type MockUserDb_I
- func (_m *MockUserDb_I) CreateUser(userid UserId, name string, hashedPassword []byte, priv PVL, ...) error
- func (_m *MockUserDb_I) EXPECT() *_MockUserDb_IRecorder
- func (_m *MockUserDb_I) GetFields(userid UserId, fields []UserFieldName) (map[UserFieldName]interface{}, error)
- func (_m *MockUserDb_I) GetRefreshToken(userid UserId, clientId string) (*string, error)
- func (_m *MockUserDb_I) SetRefreshToken(userid UserId, clientId string, refreshToken string) error
- func (_m *MockUserDb_I) UpdateUser(userid UserId, fields map[UserFieldName]interface{}) error
- type PVL
- type RefreshFieldName
- type UserAuthInfo
- type UserCredentials_I
- type UserDb_I
- type UserFieldName
- type UserIDPassword
- type UserIDRefreshToken
- type UserId
Constants ¶
This section is empty.
Variables ¶
View Source
var ( ErrUserIdInvalid = errors.New("User id must be 5 - 32 letters,digits or _") ErrUserIdForbidden = errors.New("User id is not allowed") ErrWrongUsernameOrPassword = errors.New("Username or password incorrect") ErrWrongRefreshToken = errors.New("Refresh token incorrect") )
View Source
var ( ErrNotFound = errors.New("No record found") ErrUserExists = errors.New("User Id exists") )
Functions ¶
func IsUserError ¶
Types ¶
type Authenticator ¶
type Authenticator struct {
// contains filtered or unexported fields
}
func NewAuthenticator ¶
func NewAuthenticator(newKey []byte) (newObj *Authenticator)
func (Authenticator) CreateUser ¶
func (authenticator Authenticator) CreateUser( useridStr string, name string, password []byte, clientId string, otherFields map[UserFieldName]interface{}, userStorage UserDb_I) (*string, *string, error)
func (Authenticator) VerifyPrivilege ¶
func (authenticator Authenticator) VerifyPrivilege( userInfo UserAuthInfo, levelToMeet PVL) (ok bool, err error)
-- No db access
type MockUserCredentials_I ¶
type MockUserCredentials_I struct {
// contains filtered or unexported fields
}
Mock of UserCredentials_I interface
func NewMockUserCredentials_I ¶
func NewMockUserCredentials_I(ctrl *gomock.Controller) *MockUserCredentials_I
func (*MockUserCredentials_I) EXPECT ¶
func (_m *MockUserCredentials_I) EXPECT() *_MockUserCredentials_IRecorder
func (*MockUserCredentials_I) UserId ¶
func (_m *MockUserCredentials_I) UserId() UserId
type MockUserDb_I ¶
type MockUserDb_I struct {
// contains filtered or unexported fields
}
Mock of UserDb_I interface
func NewMockUserDb_I ¶
func NewMockUserDb_I(ctrl *gomock.Controller) *MockUserDb_I
func (*MockUserDb_I) CreateUser ¶
func (_m *MockUserDb_I) CreateUser(userid UserId, name string, hashedPassword []byte, priv PVL, otherFields map[UserFieldName]interface{}) error
func (*MockUserDb_I) EXPECT ¶
func (_m *MockUserDb_I) EXPECT() *_MockUserDb_IRecorder
func (*MockUserDb_I) GetFields ¶
func (_m *MockUserDb_I) GetFields(userid UserId, fields []UserFieldName) (map[UserFieldName]interface{}, error)
func (*MockUserDb_I) GetRefreshToken ¶
func (_m *MockUserDb_I) GetRefreshToken(userid UserId, clientId string) (*string, error)
func (*MockUserDb_I) SetRefreshToken ¶
func (_m *MockUserDb_I) SetRefreshToken(userid UserId, clientId string, refreshToken string) error
func (*MockUserDb_I) UpdateUser ¶
func (_m *MockUserDb_I) UpdateUser(userid UserId, fields map[UserFieldName]interface{}) error
type RefreshFieldName ¶
type RefreshFieldName string
const ( RefreshField_UserId RefreshFieldName = "userid" RefreshField_ClientId RefreshFieldName = "client_id" RefreshField_RefreshTok RefreshFieldName = "refresh_token" )
type UserAuthInfo ¶
type UserAuthInfo struct { UserId UserId // contains filtered or unexported fields }
func NewUserAuthInfo ¶
func NewUserAuthInfo(newUserIdStr string, newAccessToken string) ( *UserAuthInfo, error)
type UserCredentials_I ¶
type UserCredentials_I interface { UserId() UserId // contains filtered or unexported methods }
type UserDb_I ¶
type UserDb_I interface { GetFields(userid UserId, fields []UserFieldName) (map[UserFieldName]interface{}, error) UpdateUser(userid UserId, fields map[UserFieldName]interface{}) error CreateUser(userid UserId, name string, hashedPassword []byte, priv PVL, otherFields map[UserFieldName]interface{}) error GetRefreshToken(userid UserId, clientId string) (*string, error) SetRefreshToken(userid UserId, clientId string, refreshToken string) error }
type UserFieldName ¶
type UserFieldName string
const ( UserField_Priv UserFieldName = "priv" UserField_UserId UserFieldName = "userid" UserField_Name UserFieldName = "username" UserField_Password UserFieldName = "password" UserField_Language UserFieldName = "lang" )
type UserIDPassword ¶
type UserIDPassword struct {
// contains filtered or unexported fields
}
func NewUserIDPassword ¶
func NewUserIDPassword(newUserIdStr string, password []byte) (*UserIDPassword, error)
func (UserIDPassword) UserId ¶
func (u UserIDPassword) UserId() UserId
type UserIDRefreshToken ¶
type UserIDRefreshToken struct { RefreshToken string // contains filtered or unexported fields }
func (UserIDRefreshToken) UserId ¶
func (u UserIDRefreshToken) UserId() UserId
Source Files ¶
Click to show internal directories.
Click to hide internal directories.