Documentation ¶
Index ¶
- Constants
- type JWTValidator
- func (j *JWTValidator) AuthMiddleware(next http.Handler) http.Handler
- func (j *JWTValidator) Generate(user user.User) (Token, error)
- func (j *JWTValidator) RefreshToken(token string) (Token, error)
- func (j *JWTValidator) Verify(signedJWT string) (*TokenClaims, error)
- func (j *JWTValidator) VerifyRefreshToken(token string) (int, error)
- type Token
- type TokenClaims
Constants ¶
View Source
const ( Scope key = 0 Subject key = 1 )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type JWTValidator ¶
type JWTValidator struct { Issuer string AccessTokenExpiryDuration time.Duration RefreshTokenExpiryDuration time.Duration // contains filtered or unexported fields }
func New ¶
func New(privateKeyPath string) JWTValidator
func WithKey ¶
func WithKey(privateKeyBytes []byte) JWTValidator
func (*JWTValidator) AuthMiddleware ¶
func (j *JWTValidator) AuthMiddleware(next http.Handler) http.Handler
func (*JWTValidator) RefreshToken ¶
func (j *JWTValidator) RefreshToken(token string) (Token, error)
func (*JWTValidator) Verify ¶
func (j *JWTValidator) Verify(signedJWT string) (*TokenClaims, error)
func (*JWTValidator) VerifyRefreshToken ¶
func (j *JWTValidator) VerifyRefreshToken(token string) (int, error)
type TokenClaims ¶
type TokenClaims struct { jwt.StandardClaims Scope string }
Click to show internal directories.
Click to hide internal directories.