Documentation
¶
Index ¶
- func GenerateChatToken(info ChatToken, secret string, expiresIn time.Duration) (string, time.Time, error)
- func GenerateToken(userID, secret string, expiresIn time.Duration) (string, time.Time, error)
- func JWTMiddleware(secret string, skipper middleware.Skipper, validators ...UserSessionValidator) echo.MiddlewareFunc
- func RawTokenFromContext(c echo.Context) string
- func RefreshTokenFromContext(c echo.Context, secret string, defaultExpiresIn time.Duration) (string, time.Time, error)
- func UserIDFromContext(c echo.Context) (string, error)
- type ChatToken
- type UserSessionValidator
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func GenerateChatToken ¶
func GenerateChatToken(info ChatToken, secret string, expiresIn time.Duration) (string, time.Time, error)
GenerateChatToken creates a signed JWT for chat route reply.
func GenerateToken ¶
GenerateToken creates a signed JWT for the user.
func JWTMiddleware ¶
func JWTMiddleware(secret string, skipper middleware.Skipper, validators ...UserSessionValidator) echo.MiddlewareFunc
JWTMiddleware returns a JWT auth middleware configured for HS256 tokens.
func RawTokenFromContext ¶ added in v0.21.0
RawTokenFromContext returns the token the middleware validated, as it arrived, whether from the Authorization header or the token query parameter. It is empty when the request carries no valid token.
Types ¶
Click to show internal directories.
Click to hide internal directories.