pomerium/authenticate/events/events.go
Kenneth Jenkins 1dbe4410d7
move events.go out of internal/authenticateflow (#4852)
Commit b7896b3153 moved events.go from the 'authenticate' package to
'internal/authenticateflow' in order to avoid an import cycle. However
this location is not actually suitable, as the hosted authenticate
service refers to AuthEvent and AuthEventFn.

Move events.go back out from under 'internal', to a new package
'authenticate/events'. This should still avoid an import cycle between
'authenticate' and 'internal/authenticateflow', while also allowing the
hosted authenticate service to use the events types.
2023-12-11 19:42:56 -08:00

39 lines
1.2 KiB
Go

// Package events defines authentication flow event types.
package events
import (
"context"
)
// AuthEventKind is the type of an authentication event
type AuthEventKind string
const (
// AuthEventSignInRequest is an authentication event for a sign in request before IdP redirect
AuthEventSignInRequest AuthEventKind = "sign_in_request"
// AuthEventSignInComplete is an authentication event for a sign in request after IdP redirect
AuthEventSignInComplete AuthEventKind = "sign_in_complete"
)
// AuthEvent is a log event for an authentication event
type AuthEvent struct {
// Event is the type of authentication event
Event AuthEventKind
// IP is the IP address of the client
IP string
// Version is the version of the Pomerium client
Version string
// RequestUUID is the UUID of the request
RequestUUID string
// PubKey is the public key of the client
PubKey string
// UID is the IdP user ID of the user
UID *string
// Email is the email of the user
Email *string
// Domain is the domain of the request (for sign in complete events)
Domain *string
}
// AuthEventFn is a function that handles an authentication event
type AuthEventFn func(context.Context, AuthEvent)