Documentation
¶
Index ¶
- func GenerateKeyID(random []byte) string
- func ParseUnverified(tokenString string, claims jwt.Claims) (*jwt.Token, []string, error)
- type JWT
- func (t *JWT) ExpFunc() int64
- func (t *JWT) Generate(mapClaims map[string]interface{}, expDate int64) (string, error)
- func (t *JWT) GivenKey() map[string]keyfunc.GivenKey
- func (t *JWT) Jwks() models.InfKeyFunc
- func (t *JWT) Parse(tokenStr string, claims jwt.Claims) (*jwt.Token, error)
- func (t *JWT) Renew(tokenStr string, expDate int64) (string, error)
- type Option
- func WithECDSAPrivateKey(secret *ecdsa.PrivateKey) Option
- func WithECDSAPublicKey(secret *ecdsa.PublicKey) Option
- func WithED25519PrivateKey(secret ed25519.PrivateKey) Option
- func WithED25519PublicKey(secret ed25519.PublicKey) Option
- func WithExpFunc(fn func() int64) Option
- func WithKID(kid string) Option
- func WithMethod(method jwt.SigningMethod) Option
- func WithRSAPrivateKey(secret *rsa.PrivateKey) Option
- func WithRSAPublicKey(secret *rsa.PublicKey) Option
- func WithSecretByte(secret []byte) Option
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func GenerateKeyID ¶
Types ¶
type JWT ¶
type JWT struct {
// contains filtered or unexported fields
}
func New ¶
New function get secret key and options and return a new JWT instance.
Default expiration function is time.Now().Add(time.Hour).Unix().
func (*JWT) Generate ¶
Generate function get custom values and add 'exp' as expires at with expDate argument with unix format.
func (*JWT) GivenKey ¶
GivenKey useful for mixing other keys in jwks function.
jwks, err := authProvider.JWTKeyFunc(auth.WithContext(ctx), auth.WithGivenKeys( serverJWT.GivenKey(), ))
func (*JWT) Jwks ¶
func (t *JWT) Jwks() models.InfKeyFunc
type Option ¶
type Option func(options *option)
func WithECDSAPrivateKey ¶
func WithECDSAPrivateKey(secret *ecdsa.PrivateKey) Option
func WithECDSAPublicKey ¶
func WithED25519PrivateKey ¶
func WithED25519PrivateKey(secret ed25519.PrivateKey) Option
func WithED25519PublicKey ¶
func WithExpFunc ¶
WithExpFunc sets the expiration function for the JWT.
func WithMethod ¶
func WithMethod(method jwt.SigningMethod) Option
WithMethod sets the signing method for the JWT.
func WithRSAPrivateKey ¶
func WithRSAPrivateKey(secret *rsa.PrivateKey) Option
func WithRSAPublicKey ¶
func WithSecretByte ¶
Click to show internal directories.
Click to hide internal directories.