You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Derived as `Omit<IAuthJwtAccessTokenPayload, 'roleId' | 'username' | 'email'>` — the refresh payload drops `roleId`, `username`, and `email`, keeping the rest:
Copy file name to clipboardExpand all lines: docs/authorization.md
+2-2Lines changed: 2 additions & 2 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -267,7 +267,7 @@ flowchart TD
267
267
### Important Notes
268
268
269
269
-`@RoleProtected()`**requires**`@AuthJwtAccessProtected()` and `@UserProtected()` to be applied
270
-
-`@AuthJwtAccessProtected()` must be placed at the bottom, followed by `@RoleProtected()`, then`@UserProtected()`. See [Authentication Documentation][ref-doc-authentication] for `@AuthJwtAccessProtected()` details
270
+
-Decorators must be stacked in this order from top to bottom: `@RoleProtected()` →`@UserProtected()` → `@AuthJwtAccessProtected()`. See [Authentication Documentation][ref-doc-authentication] for `@AuthJwtAccessProtected()` details
271
271
- This decorator stores role abilities via `RequestStoreService.set(RoleAbilityStoreKey, abilities)` (read back with `RequestStoreService.get(RoleAbilityStoreKey)`), which is required by policy guards
272
272
- Incorrect ordering will result in runtime errors
273
273
- Users with `superAdmin` role type have unrestricted access to all `@RoleProtected` routes, regardless of the specified required roles. The guard returns an empty abilities array for super admins, as they bypass ability checks.
@@ -416,7 +416,7 @@ The factory creates a CASL ability instance that can check if a user can perform
416
416
### Important Notes
417
417
418
418
-`@PolicyAbilityProtected()`**requires**`@AuthJwtAccessProtected()`, `@RoleProtected()`, and `@UserProtected()` to be applied
419
-
- Decorators must be stacked in this order from bottom to top: `@PolicyAbilityProtected()` → `@RoleProtected()` → `@UserProtected()` → `@AuthJwtAccessProtected()`. See [Authentication Documentation][ref-doc-authentication] for `@AuthJwtAccessProtected()` details
419
+
- Decorators must be stacked in this order from top to bottom: `@PolicyAbilityProtected()` → `@RoleProtected()` → `@UserProtected()` → `@AuthJwtAccessProtected()`. See [Authentication Documentation][ref-doc-authentication] for `@AuthJwtAccessProtected()` details
420
420
- Incorrect ordering will result in runtime errors
421
421
- Users with `superAdmin` role type have unrestricted access to all `@PolicyAbilityProtected` routes, bypassing all ability checks.
422
422
- All actions in a required ability must be present in the user's abilities. For example, if you require `[UPDATE, DELETE]` on `USER` subject, the user must have both actions, not just one.
@@ -139,7 +137,7 @@ encryptionSecretKey: string // Secret key used to derive AES-256 encryption
139
137
**File**: `src/configs/auth.config.ts`
140
138
**Interface**: `IConfigAuth`
141
139
142
-
This configuration manages JWT authentication settings including token configuration, password policies, social authentication, dan two-factor authentication.
140
+
This configuration manages JWT authentication settings including token configuration, password policies, social authentication, and two-factor authentication.
143
141
144
142
> **Environment Variables**: See [Environment Documentation](environment.md) for detailed environment variable configuration.
uploadPhotoProfilePath: string// Path template for user profile photo uploads
489
484
```
490
485
486
+
**`default`** - Default role and country assigned to new users
487
+
```typescript
488
+
default: {
489
+
role: string; // Default role name (default: 'user')
490
+
country: string; // Default country code (default: 'ID')
491
+
}
492
+
```
493
+
491
494
### Documentation Configuration
492
495
493
496
@@ -505,11 +508,6 @@ This configuration manages API documentation settings for Swagger/OpenAPI.
505
508
name: string// API documentation title
506
509
```
507
510
508
-
**`description`** - Documentation description
509
-
```typescript
510
-
description: string// API documentation description
511
-
```
512
-
513
511
**`prefix`** - Documentation URL prefix
514
512
```typescript
515
513
prefix: string// URL prefix for API documentation (default: '/docs')
@@ -546,7 +544,7 @@ language: string // Default application language
546
544
**File**: `src/configs/email.config.ts`
547
545
**Interface**: `IConfigEmail`
548
546
549
-
This configuration manages default email addresses for system communications. Email addresses (`noreply`, `support`, `admin`) can be overridden via environment variables. If not set, they fall back to hardcoded default values.
547
+
This configuration manages default email addresses for system communications. Email addresses (`noreply`, `support`, `admin`) come from environment variables and fall back to `null` when unset.
550
548
551
549
> **Environment Variables**: See [Environment Documentation](environment.md) for detailed environment variable configuration.
Default language for the application. Supported: `en`, `id`
190
+
Default language for the application. Validated against `EnumMessageLanguage`; currently only `en` is supported.
191
191
```bash
192
192
APP_LANGUAGE=en
193
193
```
194
194
195
195
**`APP_TIMEZONE`***(required)*
196
-
Default timezone for date operations. Example: `Asia/Jakarta`, `UTC`
196
+
Default timezone for date operations. Validated against `EnumRequestTimezone`; currently only `Asia/Jakarta` is supported.
197
197
```bash
198
198
APP_TIMEZONE=Asia/Jakarta
199
199
```
200
200
201
201
**`APP_ENCRYPTION_SECRET_KEY`***(required)*
202
-
Secret key used to derive an AES-256 encryption key for encrypting sensitive data (recommended 32+ characters). Empty by default — startup validation rejects an unset value. Generate a unique key per environment (`openssl rand -base64 32`); never reuse the example below.
202
+
Secret key used to derive an AES-256 encryption key for encrypting sensitive data. Must be 32-64 characters (enforced by `@MinLength(32)` / `@MaxLength(64)`). Empty by default — startup validation rejects an unset value. Generate a unique key per environment (`openssl rand -base64 32`); never reuse the example below.
Issuer name displayed in authenticator apps. Empty by default — startup validation rejects an unset value.
463
463
```bash
464
464
AUTH_TWO_FACTOR_ISSUER=ACKNestJsTwoFactor
465
465
```
466
466
467
-
**`AUTH_TWO_FACTOR_ENCRYPTION_KEY`***(required for 2FA)*
467
+
**`AUTH_TWO_FACTOR_ENCRYPTION_KEY`***(required)*
468
468
Secret used to derive an AES-256 key for encrypting TOTP secrets (recommended 32+ chars). Empty by default — startup validation rejects an unset value. Generate a unique key per environment (`openssl rand -base64 32`); never reuse the example below.
@@ -489,8 +489,8 @@ AWS IAM secret access key for S3 bucket operations.
489
489
AWS_S3_IAM_CREDENTIAL_SECRET=
490
490
```
491
491
492
-
**`AWS_S3_IAM_ARN`***(optional)*
493
-
AWS IAM Role ARN for S3 operations. Used for role-based access control and temporary credentials.
492
+
**`AWS_S3_IAM_ARN`***(required when S3 credentials are set)*
493
+
AWS IAM Role ARN for S3 operations. Used for role-based access control and temporary credentials. Validation requires it whenever `AWS_S3_IAM_CREDENTIAL_KEY` or `AWS_S3_IAM_CREDENTIAL_SECRET` is provided.
494
494
```bash
495
495
AWS_S3_IAM_ARN=
496
496
```
@@ -548,8 +548,8 @@ AWS IAM secret access key for SES email service.
548
548
AWS_SES_IAM_CREDENTIAL_SECRET=
549
549
```
550
550
551
-
**`AWS_SES_IAM_ARN`***(optional)*
552
-
AWS IAM Role ARN for SES operations. Used for role-based access control and temporary credentials.
551
+
**`AWS_SES_IAM_ARN`***(required when SES credentials are set)*
552
+
AWS IAM Role ARN for SES operations. Used for role-based access control and temporary credentials. Validation requires it whenever `AWS_SES_IAM_CREDENTIAL_KEY` or `AWS_SES_IAM_CREDENTIAL_SECRET` is provided.
0 commit comments