@axinom/mosaic-user-auth-utils is a supporting library of @axinom/mosaic-user-auth that exports common types, so they may be shared between the Frontends and Backends during authentication & authorization flows (end-user facing)

@axinom/mosaic-user-auth-utils

This is a supporting library of @axinom/mosaic-user-auth which exports common types, so they may be shared between the Frontends and Backends during authentication & authorization flows (end-user facing).

Enumerations

The @axinom/mosaic-user-auth-utils library exposes the following enumerations in order to expressively define the response codes related to the @axinom/mosaic-user-auth library operations.

Interface Name Description

TokenResponseCode

Token response code from User Service Auth API.

SignOutResponseCode

Sign out response code from User Service Auth API.

IdpConfigurationResponseCode

IDP Configuration response code from User Service Auth API.

ROPCSignInResponseCode

ROPC Sign In Response Code from User Service Auth API.

ROPCPasswordResponseCode

ROPC Password Reset/Complete Password Reset Code from User Service Auth API.

UserSignUpResponseCode

ROPC Sign Up Response Code from User Service Auth API.

CompleteUserSignUpResponseCode

Verify ROPC Sign Up Response Code from User Service Auth API.

CheckOtpResponseCode

OTP Check Response Code from User Service Auth API. This response type is used for both Sign Up OTP check and Reset Password OTP check.

TokenResponseCode

enum TokenResponseCode {
  SUCCESS = 'SUCCESS',
  NEEDS_LOGIN = 'NEEDS_LOGIN',
  ACCOUNT_NOT_ACTIVE = 'ACCOUNT_NOT_ACTIVE',
  AUTH_FLOW_ERROR = 'AUTH_FLOW_ERROR',
  BAD_REQUEST = 'BAD_REQUEST',
  INTERNAL_SERVER_ERROR = 'INTERNAL_SERVER_ERROR',
}

SignOutResponseCode

enum SignOutResponseCode {
  SUCCESS = 'SUCCESS',
  BAD_REQUEST = 'BAD_REQUEST',
  INTERNAL_SERVER_ERROR = 'INTERNAL_SERVER_ERROR',
}

IdpConfigurationResponseCode

enum IdpConfigurationResponseCode {
  SUCCESS = 'SUCCESS',
  APPLICATION_NOT_ACTIVE = 'APPLICATION_NOT_ACTIVE',
  NO_ACTIVE_IDPS = 'NO_ACTIVE_IDPS',
  ACCOUNT_NOT_ACTIVE = 'ACCOUNT_NOT_ACTIVE',
  BAD_REQUEST = 'BAD_REQUEST',
  INTERNAL_SERVER_ERROR = 'INTERNAL_SERVER_ERROR',
}

ROPCSignInResponseCode

enum ROPCSignInResponseCode {
  SUCCESS = 'SUCCESS',
  INTERNAL_SERVER_ERROR = 'INTERNAL_SERVER_ERROR',
  BAD_REQUEST = 'BAD_REQUEST',
  AUTH_FLOW_ERROR = 'AUTH_FLOW_ERROR',
  SERVICE_CONFIGURATION_ERROR = 'SERVICE_CONFIGURATION_ERROR',
}

ROPCPasswordResponseCode

enum ROPCPasswordResponseCode {
  SUCCESS = 'SUCCESS',
  ERROR = 'ERROR',
  SERVICE_CONFIGURATION_ERROR = 'SERVICE_CONFIGURATION_ERROR',
}

UserSignUpResponseCode

enum CompleteUserSignUpResponseCode {
  SUCCESS = 'SUCCESS',
  ERROR = 'ERROR',
  SERVICE_CONFIGURATION_ERROR = 'SERVICE_CONFIGURATION_ERROR',
}

CheckOtpResponseCode

enum CheckOtpResponseCode {
  SUCCESS = 'SUCCESS',
  ERROR = 'ERROR',
  SERVICE_CONFIGURATION_ERROR = 'SERVICE_CONFIGURATION_ERROR',
}

Interfaces

The @axinom/mosaic-user-auth-utils library exposes the following interfaces.

Interface Name Description

UserToken

Represents a user token.

UserServiceConfig

Configuration for the user service API.

User

Represents an authenticated user.

TokenResponse

Token response from User Service Auth API.

SignOutResponse

Sign out response from User Service Auth API.

IdpConfiguration

Represents an IDP Configuration.

IdpConfigurationResponse

IDP Configuration response from User Service Auth API.

WellKnownEndpointResponse

The well known endpoints exposed by ax-user-service.

ROPCSignInResponse

Response for a ROPC Sign In flow.

UserSignUpResponse

Represents the response for a User Sign Up request.

CompleteUserSignUpResponse

Represents the response for a Complete User Sign Up request.

InitiatePasswordResetResponse

Represents the response for InitiatePasswordReset request.

CompletePasswordResetResponse

Represents the response for a CompletePasswordReset request.

CheckPasswordResetOtpResponse

Represents the response for a Check Password Reset OTP Request.

CheckUserSignUpOtpResponse

Represents the response for a User Sign Up OTP Request.

UserToken

interface UserToken {
  accessToken: string;
  expiresInSeconds: number;
  expiresAt: Date;
}

User

interface User {
  id: string;
  name: string | null;
  email: string | null;
  profileId: string;
  token: UserToken;
}

TokenResponse

interface TokenResponse {
  code: TokenResponseCode;
  message?: string;
  tenantId?: string;
  environmentId?: string;
  applicationId?: string;
  extensions?: unknown;
  user?: User;
}

SignOutResponse

interface SignOutResponse {
  code: SignOutResponseCode;
  message?: string;
}

IdpConfiguration

interface IdpConfiguration {
  idpConnectionId: string;
  providerId: string;
  clientId: string;
  providerIconUrl: string | null;
  title: string;
  sortOrder: number | null;
  authUrl?: string;
}

IdpConfigurationResponse

interface IdpConfigurationResponse {
  code: IdpConfigurationResponseCode;
  message?: string;
  tenantId?: string;
  environmentId?: string;
  applicationId?: string;
  availableIdentityProviders?: IdpConfiguration[];
}

WellKnownEndpointResponse

interface WellKnownEndpointResponse {
  jwks: string;
  userServiceAdminGQL: string;
  userServiceEndUserGQL: string;
  axAuthManagementGQL: string;
  axAuthEndpoint: string;
}

ROPCSignInResponse

interface ROPCSignInResponse {
  code: ROPCSignInResponseCode;
  message?: string;
  details?: Record<string, unknown>;
}

UserSignUpResponse

interface UserSignUpResponse {
  code: UserSignUpResponseCode;
  idpUserId?: string;
  message?: string;
}

CompleteUserSignUpResponse

interface CompleteUserSignUpResponse {
  code: CompleteUserSignUpResponseCode;
  idpUserId?: string;
  message?: string;
}

InitiatePasswordResetResponse

interface InitiatePasswordResetResponse {
  code: ROPCPasswordResponseCode;
  message?: string;
  details?: Record<string, unknown>;
}

CompletePasswordResetResponse

interface CompletePasswordResetResponse {
  code: ROPCPasswordResponseCode;
  message?: string;
  details?: Record<string, unknown>;
}

CheckUserSignUpOtpResponse

interface CheckUserSignUpOtpResponse {
  code: CheckOtpResponseCode;
  message?: string;
  isOtpValid?: boolean;
}