24 lines
392 B
Go
24 lines
392 B
Go
package auth
|
|
|
|
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.
|
|
Middleware() func(http.Handler) http.Handler
|
|
}
|