mirror of
https://github.com/teamhanko/hanko.git
synced 2025-10-27 06:06:54 +08:00
* Add endpoint to invalidate HTTP-Only cookie from the backend * Add methods to the UserClient SDK for logout * Remove session token fetch and add unit test for logout * Update public router to use JWT middleware * Add logout button to frontend. Route back to login page once logout is successful. * Add a logout failur event * Update logout logic in SDK * Remove unneeded endpoint from main.go * Update logoutlink reference * Fix request path; undo change in package order * Update common.css to incldue hanko-logout * feat(fronend-sdk): remove cookie during cross-domain operations * fix(frontend-sdk): No unauthorized error during logout, when the user is already logged out * feat(backend): Create an audit log entry when the user logs off * chore(frontend-sdk): re-generate jsdoc * fix: Adjust logout response codes and the corresponding frontend sdk error handling * chore(frontend-sdk): re-generate jsdoc * feat: add logout endpoint specification to the docs * Fix broken unit test * Remove logout button from elements * Add event listener on frontend to call the logout method from SDK * Rollback changes to SecuredContent on e2e tests * Update logout test on user * Update quickstart/public/assets/css/common.css Co-authored-by: bjoern-m <56024829+bjoern-m@users.noreply.github.com> --------- Co-authored-by: Björn Müller <bjoern.mueller@hanko.io> Co-authored-by: bjoern-m <56024829+bjoern-m@users.noreply.github.com>
60 lines
3.0 KiB
Go
60 lines
3.0 KiB
Go
package models
|
|
|
|
import (
|
|
"github.com/gofrs/uuid"
|
|
"time"
|
|
)
|
|
|
|
type AuditLog struct {
|
|
ID uuid.UUID `db:"id" json:"id"`
|
|
Type AuditLogType `db:"type" json:"type"`
|
|
Error *string `db:"error" json:"error,omitempty"`
|
|
MetaHttpRequestId string `db:"meta_http_request_id" json:"meta_http_request_id"`
|
|
MetaSourceIp string `db:"meta_source_ip" json:"meta_source_ip"`
|
|
MetaUserAgent string `db:"meta_user_agent" json:"meta_user_agent"`
|
|
ActorUserId *uuid.UUID `db:"actor_user_id" json:"actor_user_id,omitempty"`
|
|
ActorEmail *string `db:"actor_email" json:"actor_email,omitempty"`
|
|
CreatedAt time.Time `db:"created_at" json:"created_at"`
|
|
UpdatedAt time.Time `db:"updated_at" json:"updated_at"`
|
|
}
|
|
|
|
type AuditLogType string
|
|
|
|
var (
|
|
AuditLogUserCreated AuditLogType = "user_created"
|
|
AuditLogUserLoggedOut AuditLogType = "user_logged_out"
|
|
|
|
AuditLogPasswordSetSucceeded AuditLogType = "password_set_succeeded"
|
|
AuditLogPasswordSetFailed AuditLogType = "password_set_failed"
|
|
|
|
AuditLogPasswordLoginSucceeded AuditLogType = "password_login_succeeded"
|
|
AuditLogPasswordLoginFailed AuditLogType = "password_login_failed"
|
|
|
|
AuditLogPasscodeLoginInitSucceeded AuditLogType = "passcode_login_init_succeeded"
|
|
AuditLogPasscodeLoginInitFailed AuditLogType = "passcode_login_init_failed"
|
|
AuditLogPasscodeLoginFinalSucceeded AuditLogType = "passcode_login_final_succeeded"
|
|
AuditLogPasscodeLoginFinalFailed AuditLogType = "passcode_login_final_failed"
|
|
|
|
AuditLogWebAuthnRegistrationInitSucceeded AuditLogType = "webauthn_registration_init_succeeded"
|
|
AuditLogWebAuthnRegistrationInitFailed AuditLogType = "webauthn_registration_init_failed"
|
|
AuditLogWebAuthnRegistrationFinalSucceeded AuditLogType = "webauthn_registration_final_succeeded"
|
|
AuditLogWebAuthnRegistrationFinalFailed AuditLogType = "webauthn_registration_final_failed"
|
|
|
|
AuditLogWebAuthnAuthenticationInitSucceeded AuditLogType = "webauthn_authentication_init_succeeded"
|
|
AuditLogWebAuthnAuthenticationInitFailed AuditLogType = "webauthn_authentication_init_failed"
|
|
AuditLogWebAuthnAuthenticationFinalSucceeded AuditLogType = "webauthn_authentication_final_succeeded"
|
|
AuditLogWebAuthnAuthenticationFinalFailed AuditLogType = "webauthn_authentication_final_failed"
|
|
|
|
AuditLogWebAuthnCredentialUpdated AuditLogType = "webauthn_credential_updated"
|
|
AuditLogWebAuthnCredentialDeleted AuditLogType = "webauthn_credential_deleted"
|
|
|
|
AuditLogEmailCreated AuditLogType = "email_created"
|
|
AuditLogEmailDeleted AuditLogType = "email_deleted"
|
|
AuditLogEmailVerified AuditLogType = "email_verified"
|
|
AuditLogPrimaryEmailChanged AuditLogType = "primary_email_changed"
|
|
|
|
AuditLogThirdPartySignUpSucceeded AuditLogType = "thirdparty_signup_succeeded"
|
|
AuditLogThirdPartySignInSucceeded AuditLogType = "thirdparty_signin_succeeded"
|
|
AuditLogThirdPartySignInSignUpFailed AuditLogType = "thirdparty_signin_signup_failed"
|
|
)
|