28 lines
746 B
Go
28 lines
746 B
Go
package authn
|
|
|
|
import (
|
|
"net/http"
|
|
|
|
"forge.cadoles.com/cadoles/bouncer/internal/store"
|
|
"github.com/gorilla/sessions"
|
|
"github.com/pkg/errors"
|
|
)
|
|
|
|
var (
|
|
ErrUnauthorized = errors.New("unauthorized")
|
|
ErrForbidden = errors.New("forbidden")
|
|
ErrSkipRequest = errors.New("skip request")
|
|
)
|
|
|
|
type Authenticator interface {
|
|
Authenticate(w http.ResponseWriter, r *http.Request, layer *store.Layer, sess *sessions.Session) (*User, error)
|
|
}
|
|
|
|
type PreAuthentication interface {
|
|
PreAuthentication(w http.ResponseWriter, r *http.Request, layer *store.Layer, sess *sessions.Session) error
|
|
}
|
|
|
|
type PostAuthentication interface {
|
|
PostAuthentication(w http.ResponseWriter, r *http.Request, layer *store.Layer, sess *sessions.Session, user *User) error
|
|
}
|