Skip to content

Commit cb7d0c7

Browse files
committed
Add 2FA Authentication Method
1 parent 83fc7f3 commit cb7d0c7

File tree

10 files changed

+272
-22
lines changed

10 files changed

+272
-22
lines changed

README.md

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
|| Implement Guard for all authentication method | [#65d1c61](https://github.com/Zenfection/project-management/commit/65d1c61e5a9e7a9576986c9fa81f9c68ce3799ab) | <img src="https://raw.githubusercontent.com/Zenfection/Image/master/2023/09/21-16-54-10-passportJS-300x300.png" title="" alt="passportJS300x300png" width="50">[passport](https://www.passportjs.org/) |
1919
|| Intergrate Redis to save `refresh-token` instead of `client-cookie` | [#d101d84](https://github.com/Zenfection/project-management/commit/d101d84fd7e1ec6b531511e646ee6c2146fd2889) | [ioredis](https://github.com/luin/ioredis) |
2020
|| Use cookie express store token via Redis | [#d060876](https://github.com/Zenfection/project-management/commit/d06087658fb38222bff39c49db6d114432a00fa7) | [express-session](https://github.com/expressjs/session)<br>[connect-redis](https://github.com/tj/connect-redis) |
21-
| | Add 2FA Authentication Method | | |
21+
| | Add 2FA Authentication Method | | [otplib](https://www.npmjs.com/package/otplib)<br>[qrcode](https://www.npmjs.com/package/qrcode) |
2222
| | Add Google Authentication Method | | |
2323
| | Build RBAC and ABAC Authorization with `roles`, `permissions`, `policies` | | |
2424

@@ -55,4 +55,7 @@ JWT_REFRESH_TOKEN_TTL=86400
5555
5656
# SESSION
5757
SESSION_SECRET=<YOUR SECRET>
58+
59+
# TFA SECRET
60+
TFA_APP_NAME=<YOUR TFA NAME>
5861
```

server/.env

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,11 @@ JWT_SECRET=secret
1414
JWT_AUDIENCE=localhost:3000
1515
JWT_ISSUER=localhost:3000
1616
JWT_ACESSS_TOKEN_TTL=3600
17-
JWT_REFRESH_TOKEN_TTL=86400\
17+
JWT_REFRESH_TOKEN_TTL=86400
1818

1919
# SESSION SECRET
20-
SESSION_SECRET=secret
20+
SESSION_SECRET=secret
21+
22+
23+
# TFA SECRET
24+
TFA_APP_NAME=Zen_Task_Management

server/package.json

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,8 +35,10 @@
3535
"express-session": "^1.17.3",
3636
"ioredis": "^5.3.2",
3737
"nestjs-prisma": "^0.22.0",
38+
"otplib": "^12.0.1",
3839
"passport": "^0.6.0",
3940
"passport-jwt": "^4.0.1",
41+
"qrcode": "^1.5.3",
4042
"reflect-metadata": "^0.1.13",
4143
"rxjs": "^7.8.1"
4244
},
@@ -57,6 +59,7 @@
5759
"@types/node": "^18",
5860
"@types/passport": "^1.0.12",
5961
"@types/passport-jwt": "^3.0.9",
62+
"@types/qrcode": "^1.5.2",
6063
"@types/supertest": "^2.0.12",
6164
"@typescript-eslint/eslint-plugin": "^6.7.2",
6265
"@typescript-eslint/parser": "^6.7.2",

server/pnpm-lock.yaml

Lines changed: 135 additions & 10 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)