Documentation
¶
Index ¶
- Variables
- func Authenticator(opts *types.AuthOptions) func(ctx *gin.Context) (any, error)
- func Authorizator(data any, ctx *gin.Context) bool
- func IdentityHandler(opts *types.AuthOptions) func(ctx *gin.Context) any
- func PayloadFunc(data any) jwt.MapClaims
- func Unauthorized(ctx *gin.Context, code int, message string)
- type JWTExchangeService
- type JWTMiddleware
- type JWTOptions
Constants ¶
This section is empty.
Variables ¶
Functions ¶
func Authenticator ¶
Authenticator validates login credentials Called when: User attempts to login - validates email/password combination
func Authorizator ¶
Authorizator determines if authenticated user has access to resource Called when: Access to protected endpoint is requested - checks user permissions
func IdentityHandler ¶
func IdentityHandler(opts *types.AuthOptions) func(ctx *gin.Context) any
IdentityHandler retrieves user identity from JWT claims Called when: JWT token is validated - reconstructs user from token claims
func PayloadFunc ¶
PayloadFunc extracts user information into JWT claims Called when: User successfully logs in - creates JWT payload from user data
Types ¶
type JWTExchangeService ¶
type JWTExchangeService struct {
// contains filtered or unexported fields
}
func NewJWTExchangeService ¶
func NewJWTExchangeService(jwtSecret string, sessionService types.SessionService, jwtExpiry time.Duration) *JWTExchangeService
func (*JWTExchangeService) ExchangeSessionForJWT ¶
func (exchangeService *JWTExchangeService) ExchangeSessionForJWT(sid string) (string, error)
func (*JWTExchangeService) RefreshSessionJWT ¶
func (exchangeService *JWTExchangeService) RefreshSessionJWT(sid string) (string, error)
type JWTMiddleware ¶
type JWTMiddleware struct {
*jwt.GinJWTMiddleware
}
func NewJWTMiddleware ¶
func NewJWTMiddleware(opts *JWTOptions) (*JWTMiddleware, error)
func (*JWTMiddleware) LoginHandler ¶
func (j *JWTMiddleware) LoginHandler() gin.HandlerFunc
func (*JWTMiddleware) LogoutHandler ¶
func (j *JWTMiddleware) LogoutHandler() gin.HandlerFunc
func (*JWTMiddleware) MiddlewareFunc ¶
func (j *JWTMiddleware) MiddlewareFunc() gin.HandlerFunc
func (*JWTMiddleware) RefreshHandler ¶
func (j *JWTMiddleware) RefreshHandler() gin.HandlerFunc
Click to show internal directories.
Click to hide internal directories.