Documentation
¶
Index ¶
- Variables
- type AdminUser
- type Session
- type TunnelUser
- type UserService
- func (u *UserService) CanCreateSuperUser(ctx context.Context) error
- func (u *UserService) CreateAdminUser(ctx context.Context, email, password string) (*AdminUser, error)
- func (u *UserService) CreateSuperUser(ctx context.Context, email, password string) (*AdminUser, error)
- func (u *UserService) CreateTunnelUser(ctx context.Context, email string) (*TunnelUser, error)
- func (u *UserService) CreateUser(ctx context.Context, email, password string, superUser bool) (*AdminUser, error)
- func (u *UserService) DeleteTunnelUser(ctx context.Context, id uint) error
- func (u *UserService) GetTunnelUserBySecret(ctx context.Context, secretKey string) (*TunnelUser, error)
- func (u *UserService) GetUserConnectionStatus(ctx context.Context) ([]TunnelUser, error)
- func (u *UserService) ListTunnelUsers(ctx context.Context) ([]TunnelUser, error)
- func (u *UserService) Login(ctx context.Context, email, password string) (string, error)
- func (u *UserService) Logout(ctx context.Context, sessionToken string) error
- func (u *UserService) RotateTunnelUserSecretKey(ctx context.Context, email string) (*TunnelUser, error)
- func (u *UserService) SetActiveConnection(ctx context.Context, tunnelUser *TunnelUser) error
- func (u *UserService) SetInactiveConnectionStatusForUsers(ctc context.Context, userIdentifiers ...string) error
- func (u *UserService) ValidateSession(ctx context.Context, sessionToken string) (*AdminUser, error)
Constants ¶
This section is empty.
Variables ¶
View Source
var ( ErrWrongPassword = errors.New("wrong password") ErrWrongSecretKey = errors.New("wrong secret key") )
View Source
var ErrAdminUserNotFound = errors.New("admin user does not exist")
View Source
var ErrDuplicateAdminUser = errors.New("admin user with the same email exists")
View Source
var ErrDuplicateTunnelUser = errors.New("tunnel user with the same email exists")
View Source
var ErrInvalidUserSession = errors.New("invalid user session")
View Source
var ErrMultipleSuperuserError = errors.New("you cannot create more than one superuser")
View Source
var ErrTunnelUserNotFound = errors.New("tunnel user does not exist")
View Source
var ErrWrongEmailOrPassword = errors.New("wrong email or password")
Functions ¶
This section is empty.
Types ¶
type AdminUser ¶
type AdminUser struct { gorm.Model Email string `gorm:"index,unique"` PasswordHash string `gorm:"unique" json:"-"` SuperUser bool Session Session }
func (*AdminUser) CheckPassword ¶
func (*AdminUser) SetPassword ¶
type Session ¶
func (*Session) GenerateSessionToken ¶
type TunnelUser ¶
type TunnelUser struct { gorm.Model Email string `gorm:"index,unique"` SecretKey *string `gorm:"index,unique" json:"-"` Active bool LastActiveAt *time.Time }
func (*TunnelUser) RotateSecretKey ¶
func (t *TunnelUser) RotateSecretKey() string
type UserService ¶
func NewUserService ¶
func NewUserService(store *gorm.DB) *UserService
func (*UserService) CanCreateSuperUser ¶
func (u *UserService) CanCreateSuperUser(ctx context.Context) error
func (*UserService) CreateAdminUser ¶
func (*UserService) CreateSuperUser ¶
func (*UserService) CreateTunnelUser ¶
func (u *UserService) CreateTunnelUser(ctx context.Context, email string) (*TunnelUser, error)
func (*UserService) CreateUser ¶
func (*UserService) DeleteTunnelUser ¶
func (u *UserService) DeleteTunnelUser(ctx context.Context, id uint) error
func (*UserService) GetTunnelUserBySecret ¶
func (u *UserService) GetTunnelUserBySecret(ctx context.Context, secretKey string) (*TunnelUser, error)
func (*UserService) GetUserConnectionStatus ¶
func (u *UserService) GetUserConnectionStatus(ctx context.Context) ([]TunnelUser, error)
func (*UserService) ListTunnelUsers ¶
func (u *UserService) ListTunnelUsers(ctx context.Context) ([]TunnelUser, error)
func (*UserService) Logout ¶
func (u *UserService) Logout(ctx context.Context, sessionToken string) error
func (*UserService) RotateTunnelUserSecretKey ¶
func (u *UserService) RotateTunnelUserSecretKey(ctx context.Context, email string) (*TunnelUser, error)
func (*UserService) SetActiveConnection ¶
func (u *UserService) SetActiveConnection(ctx context.Context, tunnelUser *TunnelUser) error
func (*UserService) SetInactiveConnectionStatusForUsers ¶
func (u *UserService) SetInactiveConnectionStatusForUsers(ctc context.Context, userIdentifiers ...string) error
func (*UserService) ValidateSession ¶
Click to show internal directories.
Click to hide internal directories.