Documentation ¶
Index ¶
- type APIKeyService
- func (svc APIKeyService) CreateAPIKey(ctx context.Context, params model.CreateAPIKeyParams) (model.APIKey, string, error)
- func (svc APIKeyService) DeleteAPIKeyByID(ctx context.Context, id uint) error
- func (svc APIKeyService) FindAPIKeyByID(ctx context.Context, id uint) (model.APIKey, error)
- func (svc APIKeyService) FindAPIKeyByName(ctx context.Context, name string) (model.APIKey, error)
- func (svc APIKeyService) GetAllAPIKeys(ctx context.Context) ([]model.APIKey, error)
- type AuthService
- type CachingAuthService
- type CachingAuthServiceConfig
- type JWTTokenService
- type UserService
- func (svc UserService) CreateUser(ctx context.Context, params model.CreateUserParams) (model.User, error)
- func (svc UserService) DeleteUserByID(ctx context.Context, id uint) error
- func (svc UserService) FindUserByEmail(ctx context.Context, email string) (model.User, error)
- func (svc UserService) FindUserByID(ctx context.Context, id uint) (model.User, error)
- func (svc UserService) FindUserByName(ctx context.Context, name string) (model.User, error)
- func (svc UserService) GetAllUsers(ctx context.Context) ([]model.User, error)
- func (svc UserService) UpdateUserByID(ctx context.Context, id uint, params model.UpdateUserParams) (model.User, error)
- func (svc UserService) UpdateUserByName(ctx context.Context, name string, params model.UpdateUserParams) (model.User, error)
- func (svc UserService) UpdateUserPasswordByID(ctx context.Context, id uint, params model.UpdateUserPasswordParams) error
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type APIKeyService ¶
type APIKeyService struct {
// contains filtered or unexported fields
}
func NewAPIKeyService ¶
func NewAPIKeyService(db *gorm.DB) APIKeyService
func (APIKeyService) CreateAPIKey ¶
func (svc APIKeyService) CreateAPIKey(ctx context.Context, params model.CreateAPIKeyParams) (model.APIKey, string, error)
func (APIKeyService) DeleteAPIKeyByID ¶
func (svc APIKeyService) DeleteAPIKeyByID(ctx context.Context, id uint) error
func (APIKeyService) FindAPIKeyByID ¶
func (APIKeyService) FindAPIKeyByName ¶
func (APIKeyService) GetAllAPIKeys ¶
type AuthService ¶
type AuthService struct {
// contains filtered or unexported fields
}
func NewAuthService ¶
func NewAuthService(db *gorm.DB, jwtTokenService JWTTokenService) AuthService
func (AuthService) APIKeyFromToken ¶
func (AuthService) AuthenticateUser ¶
func (svc AuthService) AuthenticateUser(ctx context.Context, name string, password string) (model.User, error)
AuthenticateUser returns User with the given login if its password hash matches the given one. If user cannot be found or the password does not match the function returns ErrCredentialsInvalid.
External users are not allowed to use password authentication. TODO(kolesnikovae): It's true for "some" authentication providers.
Others may need us to pass through the credentials (e.g. LDAP).
func (AuthService) UserFromJWTToken ¶
type CachingAuthService ¶
type CachingAuthService struct { AuthService // contains filtered or unexported fields }
func NewCachingAuthService ¶
func NewCachingAuthService(authService AuthService, c CachingAuthServiceConfig) CachingAuthService
func (CachingAuthService) APIKeyFromToken ¶
func (CachingAuthService) DeleteAPIKey ¶
func (svc CachingAuthService) DeleteAPIKey(t string)
type JWTTokenService ¶
type JWTTokenService struct {
// contains filtered or unexported fields
}
func NewJWTTokenService ¶
func NewJWTTokenService(signingKey []byte, tokenTTL time.Duration) JWTTokenService
func (JWTTokenService) GenerateUserJWTToken ¶
func (JWTTokenService) Parse ¶
func (svc JWTTokenService) Parse(t string) (*jwt.Token, error)
Parse parses the token and validates it using the signing key.
func (JWTTokenService) UserFromJWTToken ¶
UserFromJWTToken retrieves user info from the given JWT token. 'name' claim must be present and valid, otherwise the function returns false. The function does not validate the token.
type UserService ¶
type UserService struct {
// contains filtered or unexported fields
}
func NewUserService ¶
func NewUserService(db *gorm.DB) UserService
func (UserService) CreateUser ¶
func (svc UserService) CreateUser(ctx context.Context, params model.CreateUserParams) (model.User, error)
func (UserService) DeleteUserByID ¶
func (svc UserService) DeleteUserByID(ctx context.Context, id uint) error
func (UserService) FindUserByEmail ¶
func (UserService) FindUserByID ¶
func (UserService) FindUserByName ¶
func (UserService) GetAllUsers ¶
func (UserService) UpdateUserByID ¶
func (svc UserService) UpdateUserByID(ctx context.Context, id uint, params model.UpdateUserParams) (model.User, error)
func (UserService) UpdateUserByName ¶
func (svc UserService) UpdateUserByName(ctx context.Context, name string, params model.UpdateUserParams) (model.User, error)
func (UserService) UpdateUserPasswordByID ¶
func (svc UserService) UpdateUserPasswordByID(ctx context.Context, id uint, params model.UpdateUserPasswordParams) error
Click to show internal directories.
Click to hide internal directories.