Documentation ¶
Index ¶
- func ProtectedWithJWT[T JWTObj](token JWToken[T], onAuthenticate func(c echo.Context) error, ...) echo.MiddlewareFunc
- type IDRSASigner
- type InvalidTokenError
- type JWT
- type JWTObj
- type JWTObjectInput
- type JWTSigner
- type JWToken
- type NoSubError
- type NotFoundSignerType
- type SECRETSigner
- type TokenExpiredError
- type TokenNotFound
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ProtectedWithJWT ¶
Types ¶
type IDRSASigner ¶
type IDRSASigner[T JWTObj] struct { PrivateKey []byte `inject:"file:jwt.idrsa.priv"` PublicKey []byte `inject:"file:jwt.idrsa.pub"` }
IDRSASigner is a signer that uses an RSA private key to sign the token and an RSA public key to check the token
type InvalidTokenError ¶
type InvalidTokenError error
type JWT ¶
type JWT struct { Token string `json:"token"` TokenExpiresIn int64 `json:"token_exp"` RefreshToken string `json:"refresh_token"` RefreshExpiresIn int64 `json:"refresh_exp"` }
JWT is the struct that will be returned by the Sign method
type JWTObjectInput ¶
type JWTObjectInput struct {
// contains filtered or unexported fields
}
func NewJWTObjectInput ¶
func NewJWTObjectInput(sub string, scopes []string) JWTObjectInput
func (JWTObjectInput) GetJIT ¶
func (j JWTObjectInput) GetJIT() string
func (JWTObjectInput) GetSCOPES ¶
func (j JWTObjectInput) GetSCOPES() []string
func (JWTObjectInput) GetSUB ¶
func (j JWTObjectInput) GetSUB() string
type JWTSigner ¶
type JWTSigner[T JWTObj] interface { Sign(T, time.Duration, time.Duration) (JWT, error) Check(string) (any, error) }
JWTSigner is the interface that must be implemented by the signer
type JWToken ¶
type JWToken[T JWTObj] struct { Expiration int `inject:"property:jwt.expires_in;default:5"` RefreshExpiration int `inject:"property:jwt.refresh_expires_in;default:15"` JWTSigner JWTSigner[T] }
JWToken is the struct that will be injected It contains the expiration time and the signer The expiration time is in minutes
type NoSubError ¶
type NoSubError error
type NotFoundSignerType ¶
type NotFoundSignerType error
type SECRETSigner ¶
SECRETSigner is a signer that uses a secret to sign the token
type TokenExpiredError ¶
type TokenExpiredError error
type TokenNotFound ¶
type TokenNotFound error
Click to show internal directories.
Click to hide internal directories.