Documentation ¶
Index ¶
Constants ¶
View Source
const ( ADMIN int = 42 CREATOR int = 1 COORDINATOR int = 2 )
Variables ¶
This section is empty.
Functions ¶
func GetAPIToken ¶ added in v0.4.0
func GetServiceToken ¶ added in v0.4.0
Types ¶
type AuthService ¶ added in v0.0.5
type AuthService struct { SigningKey *rsa.PrivateKey ValidationKey *rsa.PublicKey ValidationKeyFile string TokenLifetime time.Duration Issuer string }
func NewAuthService ¶ added in v0.4.0
func NewAuthService(privatekey string, publickey string, tokenLifetime int, issuer string) *AuthService
type Authentication ¶ added in v0.0.5
Authentication interface lists the methods that our authentication service should implement
type ServiceKey ¶ added in v0.4.0
type User ¶ added in v0.4.0
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 ¶ added in v0.4.0
type UserClaims struct { UserID string UserRole int UserFestivals []int UserArtists []int UserLocations []int UserEvents []int UserLinks []int UserPlaces []int UserImages []int UserTags []int jwt.RegisteredClaims }
func GetValidClaims ¶ added in v0.4.0
func GetValidClaims(r *http.Request, validator *ValidationService) *UserClaims
type Validation ¶ added in v0.6.0
type ValidationService ¶ added in v0.6.0
type ValidationService struct { Key *rsa.PublicKey APIKeys *[]string ServiceKeys *[]string Client *http.Client Endpoint string }
func NewValidationService ¶ added in v0.6.0
func (*ValidationService) ValidateAccessToken ¶ added in v0.6.0
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.