Documentation
¶
Overview ¶
Package middleware contains the middleware for the HTTP server
Index ¶
Constants ¶
View Source
const (
// CookieName is the name of the cookie
CookieName = "accessToken"
)
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Authenticator ¶
type Authenticator struct {
// contains filtered or unexported fields
}
Authenticator is a middleware for authenticating requests
func New ¶
func New(logger *zap.Logger, privateKey *rsa.PrivateKey) (*Authenticator, error)
New creates a new Authenticator
func (*Authenticator) Authenticate ¶
func (a *Authenticator) Authenticate(next http.Handler) http.Handler
Authenticate is the middleware function
type Claims ¶
type Claims struct { SessionID string `json:"session_id"` Permissions map[string]string `json:"permissions"` jwt.RegisteredClaims }
Claims is a custom claims type for JWT
type ContextKey ¶
type ContextKey string
ContextKey is a custom type for context keys
var ( // SessionIDKey is the key for the session ID in the context SessionIDKey ContextKey = "session_id" // Permissions is the key for the permissions in the context Permissions ContextKey = "perms" )
Click to show internal directories.
Click to hide internal directories.