@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. |
SignInResponseCode | Sign In Response Code for sign in with username/password flow from User Service Auth API. |
ResetPasswordResponseCode | Password Reset/Complete Password Reset Code from User Service Auth API. |
UserSignUpResponseCode | Sign Up Response Code from User Service Auth API. |
CompleteUserSignUpResponseCode | Verify 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',
}
SignInResponseCode
enum SignInResponseCode {
SUCCESS = 'SUCCESS',
INTERNAL_SERVER_ERROR = 'INTERNAL_SERVER_ERROR',
BAD_REQUEST = 'BAD_REQUEST',
AUTH_FLOW_ERROR = 'AUTH_FLOW_ERROR',
SERVICE_CONFIGURATION_ERROR = 'SERVICE_CONFIGURATION_ERROR',
}
ResetPasswordResponseCode
enum ResetPasswordResponseCode {
SUCCESS = 'SUCCESS',
ERROR = 'ERROR',
SERVICE_CONFIGURATION_ERROR = 'SERVICE_CONFIGURATION_ERROR',
}
UserSignUpResponseCode
enum UserSignUpResponseCode {
SUCCESS = 'SUCCESS',
ERROR = 'ERROR',
SERVICE_CONFIGURATION_ERROR = 'SERVICE_CONFIGURATION_ERROR',
}
CompleteUserSignUpResponseCode
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. |
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. |
SignInResponse | Response for a Sign In with username/password 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;
}
UserServiceConfig
interface UserServiceConfig {
userServiceBaseUrl: string;
}
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;
}
SignInResponse
interface SignInResponse {
code: SignInResponseCode;
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: ResetPasswordResponseCode;
message?: string;
details?: Record<string, unknown>;
}
CompletePasswordResetResponse
interface CompletePasswordResetResponse {
code: ResetPasswordResponseCode;
message?: string;
details?: Record<string, unknown>;
}
CheckPasswordResetOtpResponse
interface CheckPasswordResetOtpResponse {
code: CheckOtpResponseCode;
message?: string;
isOtpValid?: boolean;
}
CheckUserSignUpOtpResponse
interface CheckUserSignUpOtpResponse {
code: CheckOtpResponseCode;
message?: string;
isOtpValid?: boolean;
}