Skip to content

Commit

Permalink
Add status to authentication event type
Browse files Browse the repository at this point in the history
  • Loading branch information
LauraBeatris committed Mar 26, 2024
1 parent b972c1d commit ef843cd
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 8 deletions.
16 changes: 10 additions & 6 deletions src/user-management/interfaces/authentication-event.interface.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,28 +3,32 @@ interface AuthenticationEventError {
message: string;
}

export type AuthenticationEventType =
type AuthenticationEventType =
| 'sso'
| 'password'
| 'oauth'
| 'mfa'
| 'magic_auth'
| 'email_verification';

type AuthenticationEventStatus = 'failed' | 'succeeded';

export type AuthenticationEvent = {
type: AuthenticationEventType;
email?: string | null;
email: string | null;
error?: AuthenticationEventError;
ipAddress: string | null;
status: AuthenticationEventStatus;
type: AuthenticationEventType;
userAgent: string | null;
userId: string | null;
error?: AuthenticationEventError;
};

export interface AuthenticationEventResponse {
type: AuthenticationEventType;
email: string | null;
error?: AuthenticationEventError;
ip_address: string | null;
status: AuthenticationEventStatus;
type: AuthenticationEventType;
user_agent: string | null;
user_id: string | null;
error: AuthenticationEventError | null;
}
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,11 @@ import {
export const deserializeAuthenticationEvent = (
authenticationEvent: AuthenticationEventResponse,
): AuthenticationEvent => ({
type: authenticationEvent.type,
email: authenticationEvent.email,
error: authenticationEvent.error,
ipAddress: authenticationEvent.ip_address,
status: authenticationEvent.status,
type: authenticationEvent.type,
userAgent: authenticationEvent.user_agent,
userId: authenticationEvent.user_id,
error: authenticationEvent.error,
});

0 comments on commit ef843cd

Please sign in to comment.