Documentation
¶
Index ¶
- func CanonicalizeListFilters(session handlers.SessionManager) func(next http.Handler) http.Handler
- func CanonicalizeSearchParams(session handlers.SessionManager) func(next http.Handler) http.Handler
- func DetectClient(req *http.Request) models.ClientType
- func ExtractUserFromSession(users UserService, auth Authenticator, session SessionManager) func(next http.Handler) http.Handler
- func Logger(next http.Handler) http.Handler
- func NoCache(next http.Handler) http.Handler
- func Otel(next http.Handler) http.Handler
- func Recoverer(next http.Handler) http.Handler
- func RequireValidUser(next http.Handler) http.Handler
- func SetClient(next http.Handler) http.Handler
- type AppConfig
- type Authenticator
- type SessionManager
- type UserService
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func CanonicalizeListFilters ¶ added in v0.221.2
CanonicalizeListFilters handles processing and storing the fully-specified, whitelisted list filters for the user.
func CanonicalizeSearchParams ¶ added in v0.221.2
CanonicalizeSearchParams processes and stores the search params requested by a user.
func DetectClient ¶ added in v0.154.0
func DetectClient(req *http.Request) models.ClientType
DetectClient detects the type of client accessing the app.
func ExtractUserFromSession ¶ added in v0.143.0
func ExtractUserFromSession( users UserService, auth Authenticator, session SessionManager, ) func(next http.Handler) http.Handler
ExtractUserFromSession will make sure the session has a usable access token (refreshing it if needed), extract the user data from the session, retrieve the user details from the backend and then store the user object in the context for use by later handlers.
NOTE: the old SkipUpdatesRoute step was removed. It never called next (so matching routes got an empty 200) and it wrote a "100 Continue" header on every other request. If some routes must bypass authentication, mount them outside the router group that uses this middleware.
func Recoverer ¶ added in v0.134.0
Recoverer is a modified version of the standard chi Recoverer middleware that additional logs to the GCP error console.
func RequireValidUser ¶ added in v0.143.0
RequireValidUser will ensure that protected routes have a valid user status before continuing.
Types ¶
type Authenticator ¶ added in v0.244.3
type Authenticator interface {
IsAuthenticated(ctx context.Context) bool
GenerateAuthURL(signup bool) (*auth0.AuthURLResult, error)
StoreAuthRequest(ctx context.Context, r *auth0.AuthURLResult)
ValidateState(ctx context.Context, got string) error
PerformExchange(ctx context.Context, code string) (*models.UserProfileResponse, error)
EnsureFresh(ctx context.Context) error
PutReturnTo(ctx context.Context, path string)
ConsumeReturnTo(ctx context.Context) (string, error)
GenerateLogoutURL() (*url.URL, error)
ClearAuth(ctx context.Context)
}