Skip to content
@archipel/platform-authentication Auto-generated

@pixel-brewery/archipel-platform-authentication ​

Enumerations ​

EnumerationDescription
SessionRefreshOutcomeResult of exchanging a refresh token.

Classes ​

ClassDescription
AnonymousAuthGuardThe AnonymousAuthGuard protects routes using anonymous authentication.
AppleConnectorThe AppleConnector integrates Apple Sign In authentication.
AuthenticationHealthIndicatorHealth indicator for the authentication infrastructure.
AuthModuleThe AuthModule handles JWT-based authentication, including token creation and validation.
AuthSubjectPortAbstract port for resolving authentication subjects by identity. Used by the JWT, Local, and Anonymous strategies.
AuthTokenServiceGeneric service responsible for creating JWT access tokens. Builds a base payload from IAuthSubject and optionally enriches it via the TokenEnricherPort with product-specific claims.
ChallengeServiceStores and validates MFA login challenges.
ChallengeStorePortAbstract port for persisting MFA challenge state.
GithubConnector-
GoogleConnectorThe GoogleConnector integrates Google OAuth authentication.
InvalidMfaCodeErrorError thrown when a code does not confirm the setup of a multi-factor authentication method.
JwtAuthGuardThe JwtAuthGuard protects routes using JWT-based authentication. It checks for the @Public() decorator metadata. When registered as APP_GUARD, all routes require JWT authentication by default. Routes decorated with @Public() are exempt.
JwtPayloadBaseAbstract base class for JWT payloads. Products extend this to add their own claims (e.g. profileId, isPro). Used as both a serialization contract and NestJS injection token.
LastActiveMiddlewareMiddleware to automatically update the lastActive timestamp for authenticated sessions. Reads the session identifier from the bearer token and updates the session asynchronously.
LocalAuthGuardThe LocalAuthGuard protects routes using local authentication.
MfaChannelNotEnabledErrorError thrown when a sign-in challenge is issued for a multi-factor authentication channel the person has not enabled.
MfaCodeExpiredErrorError thrown when a sign-in challenge code is verified after it expired.
MfaCodeNotIssuedErrorError thrown when a sign-in challenge code is verified although none was issued.
MfaCodeRecentlySentErrorError thrown when a new multi-factor authentication code is requested before the resend interval has passed.
MfaCodeRequiredErrorError thrown when a multi-factor authentication code is missing.
MfaEmailRequiredErrorError thrown when email-based multi-factor authentication has no email address to send codes to.
MfaMethodAlreadyEnabledErrorError thrown when the setup of a multi-factor authentication method starts although the method is already enabled.
MfaMethodNotEnabledErrorError thrown when a multi-factor authentication method that is not enabled is chosen as the preferred method.
MfaNotEnabledErrorError thrown when an operation requires multi-factor authentication that the person has not enabled.
MfaPhoneNumberRequiredErrorError thrown when SMS-based multi-factor authentication has no phone number to send codes to.
MfaServiceOrchestrates MFA channels, backup codes, and user preferences.
MfaSetupExpiredErrorError thrown when the code or approval that confirms a multi-factor authentication setup has expired.
MfaSetupNotInitializedErrorError thrown when the setup of a multi-factor authentication method is confirmed before it was started.
MfaSubjectNotFoundErrorError thrown when the MfaSubjectPort does not find the person of a multi-factor authentication operation.
MfaSubjectPortAbstract port for reading and writing MFA state on the underlying subject entity. Used by the MfaService and all MFA channel implementations.
MicrosoftConnectorThe MicrosoftConnector integrates Microsoft OAuth authentication.
RolesGuard-
SessionMappingProfileMapping profile for Session entity to response transformations.
SessionPersistencePortAbstract port for persisting and querying sessions.
SessionResponseThe SessionResponse class.
SessionServiceManages user sessions via the SessionPersistencePort.
SocialAuthGuard-
SocialAuthPortAbstract port for resolving or creating subjects from social / OAuth profiles. Used by all social strategies (GitHub, Google, Microsoft, Apple).
TokenEnricherPortAbstract port for enriching JWT claims with product-specific data. This is an optional port: when not provided, the token contains only base claims.
TotpMfaChannel-
UnsupportedMfaMethodErrorError thrown when no channel is registered for a multi-factor authentication method.
VerificationServiceManages email / PIN verification tokens via the VerificationSubjectPort.
VerificationSubjectPortAbstract port for verifiable subject persistence. Used by the VerificationService to manage email/PIN verification.

Interfaces ​

InterfaceDescription
IAuthMiddlewareOptionsConfiguration for the auth module's middleware registration.
IAuthModuleOptionsOptions for configuring the AuthModule.
IAuthSubjectGeneric authentication subject returned by the AuthSubjectPort. Represents any entity that can authenticate (user, service account, etc.).
ICreateSessionArgsArguments for creating a new session.
IIssuedSessionA newly opened session together with the refresh token issued for it.
IMfaChallengePayloadRepresents the MFA challenge payload encoded in a challenge token.
IMfaChallengeState-
IMfaConfirmationRepresents the activation result for multi-factor authentication.
IMfaSetupRepresents the data required to onboard a multi-factor authenticator.
IMfaSubjectRepresents an MFA-enabled subject. Contains the data the MFA subsystem needs to read and write MFA state on the underlying user-like entity.
IMfaSubjectUpdateData payload for updating MFA state on the underlying entity. All properties are optional - only the provided ones are applied.
IRotateRefreshTokenArgsArguments for replacing the refresh token of an existing session.
ISessionRecordRepresents a persisted session record.
ISessionRefreshResultOutcome of a refresh-token exchange.
ISignInResultRepresents the outcome of a sign-in attempt.
ISocialProfileProfile data received from a social / OAuth provider.
IVerifiableSubjectRepresents a verifiable authentication subject. Used by the VerificationService to verify email / PIN.

Variables ​

VariableDescription
APPLE_AUTH_CONFIG_ENTRIESConfiguration entries required by Apple Sign-In authentication.
AUTH_APPLE_CALLBACK_URLApple Sign-In callback URL.
AUTH_APPLE_CLIENT_IDApple Sign-In client (service) ID.
AUTH_APPLE_KEY_IDApple Sign-In key ID.
AUTH_APPLE_PRIVATE_KEYApple Sign-In private key (PEM string).
AUTH_APPLE_SCOPEComma-separated list of Apple Sign-In scopes (e.g. 'name,email').
AUTH_APPLE_STATEWhether to enable the OAuth state parameter for CSRF protection on the Apple connector. Requires a persistent session store (e.g. Redis) to verify state on callback. Disable ('false') for stateless / serverless environments without a shared session store.
AUTH_APPLE_TEAM_IDApple developer team ID.
AUTH_GITHUB_CALLBACK_URLGitHub OAuth callback URL.
AUTH_GITHUB_CLIENT_IDGitHub OAuth client ID.
AUTH_GITHUB_CLIENT_SECRETGitHub OAuth client secret.
AUTH_GITHUB_SCOPEComma-separated list of GitHub OAuth scopes (e.g. 'user:email,read:user').
AUTH_GITHUB_STATEWhether to enable the OAuth state parameter for CSRF protection on the GitHub connector. Requires a persistent session store (e.g. Redis) to verify state on callback. Disable ('false') for stateless / serverless environments without a shared session store.
AUTH_GOOGLE_CALLBACK_URLGoogle OAuth2 callback URL.
AUTH_GOOGLE_CLIENT_IDGoogle OAuth2 client ID.
AUTH_GOOGLE_CLIENT_SECRETGoogle OAuth2 client secret.
AUTH_GOOGLE_SCOPEComma-separated list of Google OAuth scopes (e.g. 'email,profile').
AUTH_GOOGLE_STATEWhether to enable the OAuth state parameter for CSRF protection on the Google connector. Requires a persistent session store (e.g. Redis) to verify state on callback. Disable ('false') for stateless / serverless environments without a shared session store.
AUTH_JWT_EXPIRES_INLifetime of access tokens (e.g. '15m', '1h').
AUTH_JWT_SECRETSecret used to sign JWTs.
AUTH_MFA_CHALLENGE_EXPIRES_INHow long an MFA challenge stays valid (e.g. '5m').
AUTH_MFA_EMAIL_CODE_TTLTime-to-live for email OTP codes (e.g. '10m').
AUTH_MFA_EMAIL_MIN_RESENDMinimum interval between email OTP resend requests (e.g. '30s').
AUTH_MFA_ENCRYPTION_KEYAES encryption key used to encrypt MFA secrets at rest.
AUTH_MFA_ISSUERIssuer name shown in authenticator apps for TOTP MFA.
AUTH_MFA_MAX_ATTEMPTSMaximum number of failed MFA attempts before lockout.
AUTH_MFA_PUSH_CODE_TTLTime-to-live for push OTP codes (e.g. '10m').
AUTH_MFA_PUSH_MIN_RESENDMinimum interval between push OTP resend requests (e.g. '30s').
AUTH_MFA_SMS_CODE_TTLTime-to-live for SMS OTP codes (e.g. '10m').
AUTH_MFA_SMS_MIN_RESENDMinimum interval between SMS resend requests (e.g. '30s').
AUTH_MICROSOFT_CALLBACK_URLMicrosoft OAuth2 callback URL.
AUTH_MICROSOFT_CLIENT_IDMicrosoft OAuth2 client ID.
AUTH_MICROSOFT_CLIENT_SECRETMicrosoft OAuth2 client secret.
AUTH_MICROSOFT_SCOPEComma-separated list of Microsoft OAuth scopes (e.g. 'user.read,mail.read').
AUTH_MICROSOFT_STATEWhether to enable the OAuth state parameter for CSRF protection on the Microsoft connector. Requires a persistent session store (e.g. Redis) to verify state on callback. Disable ('false') for stateless / serverless environments without a shared session store.
AUTH_MICROSOFT_TENANTMicrosoft tenant ID or 'common' for multi-tenant.
AUTH_VERIFY_JWT_EXPIRES_INLifetime of email-verification JWTs.
GITHUB_AUTH_CONFIG_ENTRIESConfiguration entries required by GitHub OAuth authentication.
GOOGLE_AUTH_CONFIG_ENTRIESConfiguration entries required by Google OAuth authentication.
MICROSOFT_AUTH_CONFIG_ENTRIESConfiguration entries required by Microsoft OAuth authentication.
PLATFORM_AUTHENTICATION_CONFIG_ENTRIESCore configuration entries required by platform-authentication.
ROLES_KEYRepresents the key for the UseRoles decorator.
SEED_ANONYMOUS_USERNAMEUsername used for the anonymous seed user.
SESSION_LIST_MAPPING_KEYType-safe mapping key for Session entity list to response list transformation.
SESSION_MAPPING_KEYType-safe mapping key for Session entity to response transformation.
TOTP_MFA_PROVIDERSProviders required by the TotpMfaChannel.
UserRepresents the User decorator.

Functions ​

FunctionDescription
socialAuthGuardFactory-
TokenRepresents the Token decorator.
UseRolesRepresents the UseRoles decorator.

Released under the MIT License.