Documentation
¶
Index ¶
Constants ¶
View Source
const ( ClaimsContextKey contextKey = "claims" // Permissions CreateURLs permission = "create:urls" DeleteURLs permission = "delete:urls" DeleteOwnURLs permission = "delete:own-urls" GetOwnURLs permission = "get:own-urls" GetURL permission = "get:url" GetURLs permission = "get:urls" UserBlock permission = "user:block" UserUnblock permission = "user:unblock" GetUserBlocks permission = "get:user-blocks" )
Variables ¶
This section is empty.
Functions ¶
Types ¶
type CustomClaims ¶
CustomClaims contains custom data we want from the token
func (CustomClaims) HasPermission ¶
func (c CustomClaims) HasPermission(expectedPermission permission) bool
HasPermission checks whether claims have a specific permission
func (CustomClaims) HasScope ¶
func (c CustomClaims) HasScope(expectedScope string) bool
HasScope checks whether claims have a specific scope
type Management ¶
type Management struct {
// contains filtered or unexported fields
}
func NewManagement ¶
func NewManagement(logger *slog.Logger, cfg config.Auth) *Management
func (*Management) BlockUser ¶
func (m *Management) BlockUser(ctx context.Context, userID string) (*management.UpdateUserResponseContent, error)
func (*Management) UnblockUser ¶
func (m *Management) UnblockUser(ctx context.Context, userID string) error
type Middleware ¶
type Middleware struct {
// contains filtered or unexported fields
}
func NewMiddleware ¶
func NewMiddleware(cfg config.Auth) *Middleware
func (*Middleware) Authenticate ¶
func (m *Middleware) Authenticate(next echo.HandlerFunc) echo.HandlerFunc
Authenticate is a middleware that will check the validity of the JWT if it is present
func (*Middleware) RequireAuthentication ¶
func (m *Middleware) RequireAuthentication(next echo.HandlerFunc) echo.HandlerFunc
func (*Middleware) RequirePermission ¶
func (m *Middleware) RequirePermission(permission permission) echo.MiddlewareFunc
Click to show internal directories.
Click to hide internal directories.