Documentation ¶
Index ¶
- Constants
- Variables
- type JWTMaker
- type OAuthClaims
- func (o OAuthClaims) GetAudience() (jwt.ClaimStrings, error)
- func (o OAuthClaims) GetExpirationTime() (*jwt.NumericDate, error)
- func (o OAuthClaims) GetIssuedAt() (*jwt.NumericDate, error)
- func (o OAuthClaims) GetIssuer() (string, error)
- func (o OAuthClaims) GetNotBefore() (*jwt.NumericDate, error)
- func (o OAuthClaims) GetSubject() (string, error)
- func (o OAuthClaims) Valid() error
- type OAuthMaker
- type PasetoMaker
Constants ¶
View Source
const MinSecretKeySize = 32
Variables ¶
Functions ¶
This section is empty.
Types ¶
type JWTMaker ¶
type JWTMaker struct {
// contains filtered or unexported fields
}
JWTMaker is a JSON Web Token maker.
func (JWTMaker) GenerateAccessToken ¶
func (JWTMaker) GenerateRefreshToken ¶
func (JWTMaker) VerifyToken ¶
func (maker JWTMaker) VerifyToken(token string) (*OAuthClaims, error)
type OAuthClaims ¶
type OAuthClaims struct { Id string `json:"id"` Mobile string `json:"mobile"` UserName string `json:"user_name"` IssuedAt time.Time `json:"issued_at"` ExpiredAt time.Time `json:"expired_at"` NotBefore time.Time `json:"not_before"` Issuer string `json:"issuer,omitempty"` }
func NewOAuthClaims ¶
func (OAuthClaims) GetAudience ¶
func (o OAuthClaims) GetAudience() (jwt.ClaimStrings, error)
func (OAuthClaims) GetExpirationTime ¶
func (o OAuthClaims) GetExpirationTime() (*jwt.NumericDate, error)
func (OAuthClaims) GetIssuedAt ¶
func (o OAuthClaims) GetIssuedAt() (*jwt.NumericDate, error)
func (OAuthClaims) GetIssuer ¶
func (o OAuthClaims) GetIssuer() (string, error)
func (OAuthClaims) GetNotBefore ¶
func (o OAuthClaims) GetNotBefore() (*jwt.NumericDate, error)
func (OAuthClaims) GetSubject ¶
func (o OAuthClaims) GetSubject() (string, error)
func (OAuthClaims) Valid ¶
func (o OAuthClaims) Valid() error
type OAuthMaker ¶
type OAuthMaker interface { GenerateAccessToken(mobile string, username string) (string, *OAuthClaims, error) GenerateRefreshToken(mobile string, username string) (string, *OAuthClaims, error) VerifyToken(token string) (*OAuthClaims, error) }
func NewJWTMaker ¶
func NewJWTMaker(oauthCfg core.OAuthConfig) (OAuthMaker, error)
NewJWTMaker creates a new JWTMaker.
func NewPasetoMaker ¶
func NewPasetoMaker(oauthCfg core.OAuthConfig) (OAuthMaker, error)
NewPasetoMaker creates a new PasetoMaker.
type PasetoMaker ¶
type PasetoMaker struct {
// contains filtered or unexported fields
}
PasetoMaker is a PASETO maker.
func (PasetoMaker) GenerateAccessToken ¶
func (maker PasetoMaker) GenerateAccessToken(mobile string, username string) (string, *OAuthClaims, error)
func (PasetoMaker) GenerateRefreshToken ¶
func (maker PasetoMaker) GenerateRefreshToken(mobile string, username string) (string, *OAuthClaims, error)
func (PasetoMaker) VerifyToken ¶
func (maker PasetoMaker) VerifyToken(token string) (*OAuthClaims, error)
Click to show internal directories.
Click to hide internal directories.