Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var ErrTokenExpired = errors.New("token expired")
ErrTokenExpired is returned when a token has expired.
Functions ¶
This section is empty.
Types ¶
type AuthManager ¶
type AuthMiddleware ¶
type AuthMiddleware struct {
// contains filtered or unexported fields
}
AuthMiddleware provides middleware for token authentication and role-based authorization.
func NewAuthMiddleware ¶
func NewAuthMiddleware(authManager AuthManager, logger logger.Logger) *AuthMiddleware
NewAuthMiddleware creates a new AuthMiddleware instance.
func (*AuthMiddleware) RequireRoles ¶
func (am *AuthMiddleware) RequireRoles(requiredRoles ...string) httpserver.HandlerFunc
RequireRoles is middleware that restricts access to endpoints based on user roles.
func (*AuthMiddleware) TokenAuth ¶
func (am *AuthMiddleware) TokenAuth() httpserver.HandlerFunc
TokenAuth is middleware that validates a JWT token from the Authorization header.
Click to show internal directories.
Click to hide internal directories.