Documentation ¶
Index ¶
- Constants
- func IsAvailableScope(scope Scope) bool
- func ParseHashedPassword(value string, bcryptCost int) ([]byte, bool)
- func RegisterHooks(lifecycle fx.Lifecycle, config *config.Config, provider *UserProvider)
- func VerifyPassword(hashedPassword, password []byte) bool
- func WithAuthenticatedUser(ctx context.Context, user *User) context.Context
- type HashedPasswordParser
- type Scope
- type TokenManager
- type User
- type UserProvider
Constants ¶
View Source
const ( PasswordTypePlain = "plain" PasswordTypeEnv = "env" PasswordTypeEncrypt = "encrypt" )
View Source
const ( ScopeReadServer = "read:server" ScopeReadTubes = "read:tubes" ScopeReadJobs = "read:jobs" ScopeWriteJobs = "write:jobs" )
Variables ¶
This section is empty.
Functions ¶
func IsAvailableScope ¶
func RegisterHooks ¶
func RegisterHooks(lifecycle fx.Lifecycle, config *config.Config, provider *UserProvider)
func VerifyPassword ¶
Types ¶
type HashedPasswordParser ¶
func MustGetPasswordParser ¶
func MustGetPasswordParser(key string) HashedPasswordParser
type Scope ¶
type Scope string
func GetAvailableScopes ¶
func GetAvailableScopes() []Scope
func ParseScopes ¶
func VerifyScopes ¶
type TokenManager ¶
type TokenManager struct {
// contains filtered or unexported fields
}
func NewTokenManager ¶
func NewTokenManager(config *config.Config) *TokenManager
func (*TokenManager) Extract ¶
func (m *TokenManager) Extract(tokenString string) (*jwt.Token, error)
func (*TokenManager) Sign ¶
func (m *TokenManager) Sign(claims jwt.Claims) (string, error)
type User ¶
type User struct {
// contains filtered or unexported fields
}
func AuthenticatedUser ¶
func (*User) HashedPassword ¶
type UserProvider ¶
type UserProvider struct {
// contains filtered or unexported fields
}
func NewUserProvider ¶
func NewUserProvider() *UserProvider
func (*UserProvider) Get ¶
func (p *UserProvider) Get(name string) *User
func (*UserProvider) Set ¶
func (p *UserProvider) Set(name string, user *User)
Click to show internal directories.
Click to hide internal directories.