tokidoki/auth/interface.go

24 lines
392 B
Go
Raw Normal View History

2022-02-21 09:55:02 +00:00
package auth
import (
"net/http"
)
var AuthCtxKey = &contextKey{"auth"}
type contextKey struct {
name string
}
type AuthContext struct {
AuthMethod string
UserName string
// TODO more?
}
2022-02-21 09:55:02 +00:00
// Abstracts the authentication backend for the server.
type AuthProvider interface {
// Returns HTTP middleware for performing authentication.
Middleware() func(http.Handler) http.Handler
}