Documentation
¶
Overview ¶
Package events defines the structured observability events of Auth-All. Auth-All does not dictate the logging or tracing backend of the application.
Index ¶
Constants ¶
const ActorSystem = "system"
ActorSystem names the actor of an operation that no request started, for example a call of the operator Go API or of the command line tool.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Actor ¶ added in v0.3.0
type Actor struct {
// ID is the user identifier of the caller, or ActorSystem.
ID string
// Method names the authentication method, for example "session" or
// "api_key". It is empty for the system actor.
Method string
// IP is the client address of the request. It is empty for the system
// actor.
IP string
}
Actor names the caller of one operation.
type Emitter ¶
type Emitter struct {
// contains filtered or unexported fields
}
Emitter fans one event out to every registered handler.
type Event ¶
type Event struct {
Name Name
Time time.Time
// UserID is the user that the event is about. It equals Target.
UserID string
Fields map[string]any
// Actor is the user that started the operation, or ActorSystem. It equals
// UserID for a self-service operation.
Actor string
// Target is the user that the operation changed.
Target string
// IP is the client address of the request. It is empty when no request
// started the operation.
IP string
// Method names the authentication method of the actor.
Method string
}
Event is one structured observability event.
An event must never carry a password, a password hash, a session token, a one-time token, or a provider secret.
type HandlerFunc ¶
HandlerFunc adapts a function to the Handler interface.
func (HandlerFunc) HandleEvent ¶
func (f HandlerFunc) HandleEvent(ctx context.Context, e Event)
HandleEvent implements Handler.
type Name ¶
type Name string
Name identifies an event type.
const ( SignUp Name = "auth.sign_up" SignIn Name = "auth.sign_in" SignInFailed Name = "auth.sign_in_failed" SignOut Name = "auth.sign_out" PasswordResetRequested Name = "auth.password_reset_requested" PasswordChanged Name = "auth.password_changed" EmailVerified Name = "auth.email_verified" EmailChangeRequested Name = "auth.email_change_requested" EmailChanged Name = "auth.email_changed" // UserDeleted arrives before Auth-All removes the rows, so a handler can // still read the owned data. UserDeleted Name = "auth.user_deleted" MagicLinkRequested Name = "auth.magic_link_requested" MagicLinkUsed Name = "auth.magic_link_used" OAuthCompleted Name = "auth.oauth_completed" AccountLinked Name = "auth.account_linked" AccountUnlinked Name = "auth.account_unlinked" TOTPEnabled Name = "auth.totp_enabled" TOTPDisabled Name = "auth.totp_disabled" // Events of the v0.3.0 release. UserCreated Name = "auth.user_created" UserUpdated Name = "auth.user_updated" UserDisabled Name = "auth.user_disabled" UserEnabled Name = "auth.user_enabled" PasswordResetByAdmin Name = "auth.password_reset_by_admin" RoleChanged Name = "auth.role_changed" APIKeyCreated Name = "auth.api_key_created" APIKeyRevoked Name = "auth.api_key_revoked" // Names of the v0.4.0 release. Every organization event carries the // organization identifier in the field "orgId". OrganizationCreated Name = "auth.organization_created" OrganizationUpdated Name = "auth.organization_updated" OrganizationDeleted Name = "auth.organization_deleted" MemberAdded Name = "auth.member_added" MemberRemoved Name = "auth.member_removed" MemberRoleChanged Name = "auth.member_role_changed" MemberSuspended Name = "auth.member_suspended" MemberRestored Name = "auth.member_restored" InvitationCreated Name = "auth.invitation_created" InvitationAccepted Name = "auth.invitation_accepted" InvitationRevoked Name = "auth.invitation_revoked" CustomRoleCreated Name = "auth.custom_role_created" CustomRoleDeleted Name = "auth.custom_role_deleted" TeamCreated Name = "auth.team_created" TeamDeleted Name = "auth.team_deleted" TeamMemberAdded Name = "auth.team_member_added" TeamMemberRemoved Name = "auth.team_member_removed" ActiveOrganizationSet Name = "auth.active_organization_set" )
Expected v1 events.