-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #6 from fless-lab/feat/authentication
Integrate Authentication System
- Loading branch information
Showing
44 changed files
with
2,151 additions
and
87 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -7,6 +7,13 @@ ENABLE_CLIENT_AUTH=true | |
BASIC_AUTH_USER=admin | ||
BASIC_AUTH_PASS=secret | ||
|
||
# JWT Tokens | ||
ACCESS_TOKEN_SECRET=your-access-token-secret | ||
ACCESS_TOKEN_EXPIRE_TIME=1h # Adjust as needed | ||
REFRESH_TOKEN_SECRET=your-refresh-token-secret | ||
REFRESH_TOKEN_EXPIRE_TIME=7d # Adjust as needed | ||
TOKEN_ISSUER=your-issuer | ||
|
||
# Database | ||
DB_URI=mongodb://mongo:27017 | ||
DB_NAME=mydatabase | ||
|
@@ -15,6 +22,8 @@ MONGO_CLIENT_PORT=9005 | |
# Cache | ||
REDIS_HOST=redis | ||
REDIS_SERVER_PORT=9079 | ||
REDIS_TOKEN_EXPIRE_TIME=31536000 # 1 year in seconds (validity for refresh token) | ||
REDIS_BLACKLIST_EXPIRE_TIME=2592000 # 1 month in seconds | ||
|
||
# MinIO | ||
MINIO_ENDPOINT=minio | ||
|
@@ -29,6 +38,16 @@ MAILDEV_PORT=1025 | |
MAILDEV_SMTP=9025 | ||
MAILDEV_WEBAPP_PORT=9080 | ||
|
||
# SMTP (for production) | ||
SMTP_HOST=smtp.example.com | ||
SMTP_PORT=587 | ||
SMTP_USER=your-smtp-username | ||
SMTP_PASS=your-smtp-password | ||
|
||
# Mail Senders | ||
FROM_EMAIL=[email protected] | ||
FROM_NAME="Your Service Name" | ||
|
||
# Rate Limiting | ||
RATE_LIMIT_WINDOW_MS=900000 # 15 minutes in milliseconds | ||
RATE_LIMIT_MAX=100 # 100 requests per windowMs | ||
|
@@ -38,3 +57,16 @@ BRUTE_FORCE_FREE_RETRIES=5 | |
BRUTE_FORCE_MIN_WAIT=300000 # 5 minutes in milliseconds | ||
BRUTE_FORCE_MAX_WAIT=3600000 # 1 hour in milliseconds | ||
BRUTE_FORCE_LIFETIME=86400 # 1 day in seconds | ||
|
||
# Bcrypt | ||
BCRYPT_SALT_ROUNDS=10 | ||
|
||
# Session | ||
SESSION_SESSION_SECRET="mysessionsecret" | ||
|
||
#View engine | ||
VIEW_ENGINE=ejs | ||
|
||
#OTP | ||
OTP_LENGTH=6 | ||
OTP_EXPIRATION=15 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -13,6 +13,8 @@ services: | |
- redis | ||
- minio | ||
- maildev | ||
volumes: | ||
- .:/usr/src/app | ||
|
||
mongo: | ||
image: mongo | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
/* eslint-disable @typescript-eslint/no-unused-vars */ | ||
import { Request, Response, NextFunction } from 'express'; | ||
import ViewService from '../services/shared/view.service'; | ||
|
||
class AppController { | ||
static async showHomePage( | ||
req: Request, | ||
res: Response, | ||
next: NextFunction, | ||
): Promise<void> { | ||
try { | ||
const viewService = new ViewService(); | ||
req.flash('error', 'Error msg sample : une erreur est survenue.'); | ||
req.flash('success', 'Success msg sample : Successfully added.'); | ||
viewService.renderPage(req, res, 'index'); | ||
} catch (error) { | ||
const viewService = new ViewService(); | ||
viewService.renderErrorPage(req, res, 500, 'Internal Server Error'); | ||
} | ||
} | ||
} | ||
|
||
export default AppController; |
Oops, something went wrong.