package
0.5.0
Repository: https://github.com/fmitra/authenticator.git
Documentation: pkg.go.dev

# Functions

AuthMiddleware validates an Authorization header if available.
ErrorLoggingMiddleware logs any errors that are returned before being parsed to an HTTP response.
ErrorResponse writes an error response.
GetIP Retrieves the client IP address.
GetRefreshToken retrieves a Refresh Token from context.
GetToken retrieves a Token from context.
GetUserID retrieves a User ID from context.
JSONResponse writes a response body.
NewRateLimiter returns a new Limiter.
RateLimitMiddleware rate limits HTTP requests.
RefreshTokenMiddleware sets a refresh token in context.
ToHandlerFunc adapts a JSONAPIHandler into net/http's HandlerFunc.

# Constants

HHMM formats a timestamp as HH:MM Reference: https://yourbasic.org/golang/format-parse-string-time-date-example/.
HHMMSS formats a timestamp as HH:MM:SS Reference: https://yourbasic.org/golang/format-parse-string-time-date-example/.
PerMinute allows us to accept x requests per minute.
PerSecond allows us to accept x requests per second.

# Structs

MockLimiter is a stub for Limiter interface.
MockLimiterFactory is a stub for LimiterFactory interface.

# Interfaces

Limiter provides rate limiting tooling.
LimiterFactory creates new Limiters.

# Type aliases

JSONAPIHandler is an HTTP handler for a JSON API.
Rate is the rate of allowed requests.