Define and use an auth context structure

This commit is contained in:
Conrad Hoffmann 2022-02-23 13:42:28 +01:00
parent d917938a29
commit 3e464747d8
2 changed files with 19 additions and 0 deletions

View file

@ -4,6 +4,18 @@ import (
"net/http"
)
var AuthCtxKey = &contextKey{"auth"}
type contextKey struct {
name string
}
type AuthContext struct {
AuthMethod string
UserName string
// TODO more?
}
// Abstracts the authentication backend for the server.
type AuthProvider interface {
// Returns HTTP middleware for performing authentication.