Versions in this module Expand all Collapse all v1 v1.0.1 Apr 18, 2024 Changes in this version + var ErrNoCookie = errors.New("no cookie") + var ErrNoSession = errors.New("no session") + func Context[T Ctx](ctx context.Context) (t T) + func IsAuthenticated(ctx context.Context) bool + func WithAuthContext[T Ctx](ctx context.Context, c T) context.Context + type Authenticator struct + func New[T Ctx](ctx context.Context, zitadel *zitadel.Zitadel, encryptionKey string, ...) (*Authenticator[T], error) + func (a *Authenticator[T]) Authenticate(w http.ResponseWriter, r *http.Request, requestedURI string) + func (a *Authenticator[T]) Callback(w http.ResponseWriter, req *http.Request) + func (a *Authenticator[T]) IsAuthenticated(req *http.Request) (T, error) + func (a *Authenticator[T]) Logout(w http.ResponseWriter, req *http.Request) + func (a *Authenticator[T]) ServeHTTP(w http.ResponseWriter, r *http.Request) + type Ctx interface + IsAuthenticated func() bool + type Handler interface + Authenticate func(w http.ResponseWriter, r *http.Request, state string) + Callback func(w http.ResponseWriter, r *http.Request) (t T, state string) + Logout func(w http.ResponseWriter, r *http.Request, authCtx T, ...) + type HandlerInitializer func(ctx context.Context, zitadel *zitadel.Zitadel) (Handler[T], error) + type InMemorySessions struct + func (s *InMemorySessions[T]) Get(id string) (T, error) + func (s *InMemorySessions[T]) Set(id string, session T) error + type Interceptor struct + func Middleware[T Ctx](authenticator *Authenticator[T]) *Interceptor[T] + func (i *Interceptor[T]) CheckAuthentication() func(next http.Handler) http.Handler + func (i *Interceptor[T]) Context(ctx context.Context) T + func (i *Interceptor[T]) RequireAuthentication() func(next http.Handler) http.Handler + type Option func(authorizer *Authenticator[T]) + func WithLogger[T Ctx](logger *slog.Logger) Option[T] + type Sessions interface + Get func(id string) (T, error) + Set func(id string, session T) error + type State struct + RequestedURI string + func DecryptState(data, key string) (*State, error) + func (s *State) Encrypt(key string) (string, error)