Documentation
¶
Index ¶
Constants ¶
View Source
const ( ADMIN int = 42 CREATOR int = 1 COORDINATOR int = 2 )
Variables ¶
This section is empty.
Functions ¶
func GetAPIToken ¶
Types ¶
type APIKey ¶
type AuthService ¶
type AuthService struct {
SigningKey *rsa.PrivateKey
ValidationKey *rsa.PublicKey
ValidationKeyFile string
TokenLifetime time.Duration
Issuer string
}
func NewAuthService ¶
func NewAuthService(privatekey string, publickey string, tokenLifetime int, issuer string) *AuthService
type Authentication ¶
Authentication interface lists the methods that our authentication service should implement
type User ¶
type User struct {
ID int `json:"user_id" sql:"user_id"`
Email string `json:"user_email" sql:"user_email"`
PasswordHash string `json:"user_password" sql:"user_password"`
CreateDate time.Time `json:"user_createdat" sql:"user_createdat"`
UpdateDate time.Time `json:"user_updatedat" sql:"user_updatedat"`
Role int `json:"user_role" sql:"user_role"`
}
type UserClaims ¶
type UserClaims struct {
UserID string
UserRole int
UserZwischentons []int
UserSituations []int
jwt.RegisteredClaims
}
func GetValidClaims ¶
func GetValidClaims(r *http.Request, validator *ValidationService) *UserClaims
type Validation ¶
type ValidationService ¶
func NewValidationService ¶
func NewValidationService(auth *AuthService, APIKeys []string) *ValidationService
func (*ValidationService) ValidateAccessToken ¶
func (validator *ValidationService) ValidateAccessToken(tokenString string) (*UserClaims, error)
ValidateAccessToken parses and validates the given access token returns the custom claim present in the token payload
Click to show internal directories.
Click to hide internal directories.