Documentation ¶
Index ¶
- Variables
- func GetClaimsFromCtx(ctx context.Context) jwt.MapClaims
- func SetClaimsToCtx(ctx context.Context, claims jwt.MapClaims) context.Context
- func SetJwtFactory(jf *JWTFactory)
- type Config
- type GenerateTokenFunc
- type JWTFactory
- func (f JWTFactory) GenerateToken(ctx context.Context, form LoginForm) (string, error)
- func (f JWTFactory) GetClaims(token string) (jwt.MapClaims, error)
- func (f *JWTFactory) Init() (err error)
- func (f JWTFactory) RefreshToken(token string) (string, error)
- func (f JWTFactory) VerifyToken(token string) bool
- type KeyType
- type LoginForm
- type LoginFunc
- type Option
Constants ¶
This section is empty.
Variables ¶
View Source
var ErrNoPrivateKeyFile = errors.New("no private key err")
Functions ¶
func GetClaimsFromCtx ¶
func SetClaimsToCtx ¶
func SetJwtFactory ¶
func SetJwtFactory(jf *JWTFactory)
Types ¶
type GenerateTokenFunc ¶
type JWTFactory ¶
type JWTFactory struct {
// contains filtered or unexported fields
}
func JwtFactory ¶
func JwtFactory() *JWTFactory
func NewJWTFactory ¶
func NewJWTFactory(config Config, opts ...Option) (JWTFactory, error)
func (JWTFactory) GenerateToken ¶
func (JWTFactory) GetClaims ¶
func (f JWTFactory) GetClaims(token string) (jwt.MapClaims, error)
func (*JWTFactory) Init ¶
func (f *JWTFactory) Init() (err error)
func (JWTFactory) RefreshToken ¶
func (f JWTFactory) RefreshToken(token string) (string, error)
func (JWTFactory) VerifyToken ¶
func (f JWTFactory) VerifyToken(token string) bool
type Option ¶
type Option func(factory *JWTFactory)
func WithLoginFunc ¶
func WithPrivateKeyFile ¶
func WithPublicKeyFile ¶
func WithTimeout ¶
Click to show internal directories.
Click to hide internal directories.