Documentation
¶
Index ¶
- Constants
- Variables
- type Config
- type Payload
- type Service
- func (j *Service) Generate(payload Payload) (accessToken, refreshToken string, err error)
- func (j *Service) GenerateTokenPair(payload Payload) (TokenPair, error)
- func (j *Service) GetSigningKey() jwtware.SigningKeydeprecated
- func (j *Service) ParsePayload(tokenString string) (*Payload, error)
- func (j *Service) PublicSigningKey() (SigningKey, error)
- type SigningKey
- type TokenPair
Constants ¶
View Source
const (
ContextJWTKey = "user"
)
View Source
const EnvPrefix = "JWT"
Variables ¶
View Source
var ErrJWTTokenNotFound = errors.New("jwt token not found")
Functions ¶
This section is empty.
Types ¶
type Config ¶
type Config struct {
PrivateKey string `env:"_PRIVATE_KEY,required,expand" envDefault:"${PWD}/testdata/test-jwt.key"`
PublicKey string `env:"_PUBLIC_KEY,required,expand" envDefault:"${PWD}/testdata/test-jwt.pem"`
}
func GetConfigFromEnv ¶
func (Config) GetPrivateKey ¶
func (Config) GetPublicKey ¶
type Payload ¶
type Payload struct {
UserID string `json:"user_id"`
OrgID string `json:"org_id"`
Role model.UserRole `json:"role"`
OrgSlug string `json:"org_slug"`
OrgName string `json:"org_name"`
UserName string `json:"user_name"`
Scopes model.Scopes `json:"scopes"`
ChangePassword bool `json:"change_password"`
}
func DecodeClaims
deprecated
type Service ¶
type Service struct {
// contains filtered or unexported fields
}
func (*Service) GenerateTokenPair ¶ added in v1.1.1
GenerateTokenPair generates access and refresh tokens with a core-owned result type.
func (*Service) GetSigningKey
deprecated
func (j *Service) GetSigningKey() jwtware.SigningKey
GetSigningKey returns a Fiber JWT middleware signing key.
Deprecated: use PublicSigningKey for a core-owned signing key result.
func (*Service) ParsePayload ¶ added in v1.1.1
ParsePayload parses and validates a JWT string into the core Payload model.
func (*Service) PublicSigningKey ¶ added in v1.1.1
func (j *Service) PublicSigningKey() (SigningKey, error)
PublicSigningKey returns the public signing key without exposing Fiber JWT middleware types.
type SigningKey ¶ added in v1.1.1
SigningKey is the core-owned public signing key description.
Click to show internal directories.
Click to hide internal directories.