Documentation ¶
Index ¶
- Variables
- func SignCallbackToken(secret, prv, cat, redirect string) (string, error)
- func SignCategorySelectToken(secret string, categories []*model.Category, u *types.ProviderUserData) (string, error)
- func SignDisclaimerAcknowledgementRequiredToken(secret string, userID string) (string, error)
- func SignEmailVerificationRequiredToken(secret string, u *model.User) (string, error)
- func SignEmailVerificationToken(secret string, userID string, email string) (string, error)
- func SignLoginToken(secret string, expiration time.Time, sessID string, u *model.User) (string, error)
- func SignPasswordResetRequiredToken(secret string, userID string) (string, error)
- func SignPasswordResetToken(secret string, userID string) (string, error)
- func SignRegisterToken(secret string, u *model.User) (string, error)
- type CallbackClaims
- type CategorySelectClaims
- type CategorySelectClaimsCategory
- type DisclaimerAcknowledgementRequiredClaims
- type EmailVerificationClaims
- type EmailVerificationRequiredClaims
- type ExternalClaims
- type LoginClaims
- type LoginClaimsData
- type PasswordResetClaims
- type PasswordResetRequiredClaims
- type RegisterClaims
- type Type
- type TypeClaims
Constants ¶
This section is empty.
Variables ¶
View Source
var ErrInvalidToken = errors.New("invalid JWT token")
View Source
var ErrInvalidTokenType = errors.New("invalid token type")
Functions ¶
func SignCallbackToken ¶
func SignCategorySelectToken ¶
func SignLoginToken ¶
func SignPasswordResetToken ¶
Types ¶
type CallbackClaims ¶
type CallbackClaims struct { TypeClaims Provider string `json:"provider"` CategoryID string `json:"category_id"` Redirect string `json:"redirect"` }
func ParseCallbackToken ¶
func ParseCallbackToken(secret, ss string) (*CallbackClaims, error)
func (CallbackClaims) Validate ¶
func (c CallbackClaims) Validate() error
type CategorySelectClaims ¶
type CategorySelectClaims struct { TypeClaims Categories []CategorySelectClaimsCategory `json:"categories"` User types.ProviderUserData `json:"user"` }
func ParseCategorySelectToken ¶
func ParseCategorySelectToken(secret, ss string) (*CategorySelectClaims, error)
func (CategorySelectClaims) Validate ¶
func (c CategorySelectClaims) Validate() error
type DisclaimerAcknowledgementRequiredClaims ¶
type DisclaimerAcknowledgementRequiredClaims struct { TypeClaims UserID string `json:"user_id"` }
func ParseDisclaimerAcknowledgementRequiredToken ¶
func ParseDisclaimerAcknowledgementRequiredToken(secret, ss string) (*DisclaimerAcknowledgementRequiredClaims, error)
func (DisclaimerAcknowledgementRequiredClaims) Validate ¶
func (c DisclaimerAcknowledgementRequiredClaims) Validate() error
type EmailVerificationClaims ¶
type EmailVerificationClaims struct { TypeClaims UserID string `json:"user_id"` Email string `json:"email"` }
func ParseEmailVerificationToken ¶
func ParseEmailVerificationToken(secret, ss string) (*EmailVerificationClaims, error)
func (EmailVerificationClaims) Validate ¶
func (c EmailVerificationClaims) Validate() error
type EmailVerificationRequiredClaims ¶
type EmailVerificationRequiredClaims struct { TypeClaims UserID string `json:"user_id"` CategoryID string `json:"category_id"` CurrentEmail string `json:"current_email"` }
func ParseEmailVerificationRequiredToken ¶
func ParseEmailVerificationRequiredToken(secret, ss string) (*EmailVerificationRequiredClaims, error)
func (EmailVerificationRequiredClaims) Validate ¶
func (c EmailVerificationRequiredClaims) Validate() error
type ExternalClaims ¶
type ExternalClaims struct { TypeClaims UserID string `json:"user_id"` GroupID string `json:"group_id"` Role string `json:"role"` Username string `json:"username"` Name string `json:"name"` Email string `json:"email"` Photo string `json:"photo"` CategoryID string `json:"-"` }
func ParseExternalToken ¶
func ParseExternalToken(db rethinkdb.QueryExecutor, ss string) (*ExternalClaims, error)
func (ExternalClaims) Validate ¶
func (c ExternalClaims) Validate() error
type LoginClaims ¶
type LoginClaims struct { *jwt.RegisteredClaims KeyID string `json:"kid"` Type Type `json:"type,omitempty"` SessionID string `json:"session_id"` Data LoginClaimsData `json:"data"` }
func ParseLoginToken ¶
func ParseLoginToken(secret, ss string) (*LoginClaims, error)
func (LoginClaims) Validate ¶
func (c LoginClaims) Validate() error
type LoginClaimsData ¶
type PasswordResetClaims ¶
type PasswordResetClaims struct { TypeClaims UserID string `json:"user_id"` }
func ParsePasswordResetToken ¶
func ParsePasswordResetToken(secret, ss string) (*PasswordResetClaims, error)
func (PasswordResetClaims) Validate ¶
func (c PasswordResetClaims) Validate() error
type PasswordResetRequiredClaims ¶
type PasswordResetRequiredClaims struct { TypeClaims UserID string `json:"user_id"` }
func ParsePasswordResetRequiredToken ¶
func ParsePasswordResetRequiredToken(secret, ss string) (*PasswordResetRequiredClaims, error)
func (PasswordResetRequiredClaims) Validate ¶
func (c PasswordResetRequiredClaims) Validate() error
type RegisterClaims ¶
type RegisterClaims struct { TypeClaims Provider string `json:"provider"` UserID string `json:"user_id"` Username string `json:"username"` CategoryID string `json:"category_id"` Name string `json:"name"` Email string `json:"email"` Photo string `json:"photo"` }
func ParseRegisterToken ¶
func ParseRegisterToken(secret, ss string) (*RegisterClaims, error)
func (RegisterClaims) Validate ¶
func (c RegisterClaims) Validate() error
type Type ¶
type Type string
const ( TypeUnknown Type = "unknown" TypeLogin Type = "login" TypeCallback Type = "callback" TypeRegister Type = "register" TypeExternal Type = "external" TypeDisclaimerAcknowledgementRequired Type = "disclaimer-acknowledgement-required" TypeEmailVerificationRequired Type = "email-verification-required" TypeEmailVerification Type = "email-verification" TypePasswordResetRequired Type = "password-reset-required" TypePasswordReset Type = "password-reset" TypeCategorySelect Type = "category-select" )
func GetTokenType ¶
type TypeClaims ¶
Click to show internal directories.
Click to hide internal directories.