@breadstone/archipel-platform-authentication 0.0.28 → 0.0.30
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +5 -5
- package/src/AuthModule.js +0 -3
- package/src/guards/JwtAuthGuard.d.ts +8 -0
- package/src/guards/JwtAuthGuard.js +24 -1
- package/src/guards/index.d.ts +0 -1
- package/src/guards/index.js +0 -1
- package/src/guards/GithubAuthGuard.d.ts +0 -9
- package/src/guards/GithubAuthGuard.js +0 -20
- package/src/guards/_RefreshTokenAuthGuard.d.ts +0 -0
- package/src/guards/_RefreshTokenAuthGuard.js +0 -2
- package/src/guards/_TwoFactorAuthGuard.d.ts +0 -0
- package/src/guards/_TwoFactorAuthGuard.js +0 -2
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@breadstone/archipel-platform-authentication",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.30",
|
|
4
4
|
"description": "JWT and OAuth authentication, MFA, session management, and email verification for NestJS applications.",
|
|
5
5
|
"type": "commonjs",
|
|
6
6
|
"main": "./src/index.js",
|
|
@@ -89,10 +89,10 @@
|
|
|
89
89
|
"README.md"
|
|
90
90
|
],
|
|
91
91
|
"dependencies": {
|
|
92
|
-
"@breadstone/archipel-platform-configuration": "0.0.
|
|
93
|
-
"@breadstone/archipel-platform-core": "0.0.
|
|
94
|
-
"@breadstone/archipel-platform-cryptography": "0.0.
|
|
95
|
-
"@breadstone/archipel-platform-mapping": "0.0.
|
|
92
|
+
"@breadstone/archipel-platform-configuration": "0.0.30",
|
|
93
|
+
"@breadstone/archipel-platform-core": "0.0.30",
|
|
94
|
+
"@breadstone/archipel-platform-cryptography": "0.0.30",
|
|
95
|
+
"@breadstone/archipel-platform-mapping": "0.0.30",
|
|
96
96
|
"tslib": "2.8.1"
|
|
97
97
|
},
|
|
98
98
|
"peerDependencies": {
|
package/src/AuthModule.js
CHANGED
|
@@ -24,7 +24,6 @@ const TokenEnricherPort_1 = require("./contracts/TokenEnricherPort");
|
|
|
24
24
|
const VerificationSubjectPort_1 = require("./contracts/VerificationSubjectPort");
|
|
25
25
|
const env_1 = require("./env");
|
|
26
26
|
const AnonymousAuthGuard_1 = require("./guards/AnonymousAuthGuard");
|
|
27
|
-
const GithubAuthGuard_1 = require("./guards/GithubAuthGuard");
|
|
28
27
|
const JwtAuthGuard_1 = require("./guards/JwtAuthGuard");
|
|
29
28
|
const LocalAuthGuard_1 = require("./guards/LocalAuthGuard");
|
|
30
29
|
const RolesGuard_1 = require("./guards/RolesGuard");
|
|
@@ -132,7 +131,6 @@ let AuthModule = AuthModule_1 = class AuthModule {
|
|
|
132
131
|
JwtAuthGuard_1.JwtAuthGuard,
|
|
133
132
|
LocalAuthGuard_1.LocalAuthGuard,
|
|
134
133
|
AnonymousAuthGuard_1.AnonymousAuthGuard,
|
|
135
|
-
GithubAuthGuard_1.GithubAuthGuard,
|
|
136
134
|
RolesGuard_1.RolesGuard,
|
|
137
135
|
AuthTokenService_1.AuthTokenService,
|
|
138
136
|
VerificationService_1.VerificationService,
|
|
@@ -159,7 +157,6 @@ let AuthModule = AuthModule_1 = class AuthModule {
|
|
|
159
157
|
JwtAuthGuard_1.JwtAuthGuard,
|
|
160
158
|
LocalAuthGuard_1.LocalAuthGuard,
|
|
161
159
|
AnonymousAuthGuard_1.AnonymousAuthGuard,
|
|
162
|
-
GithubAuthGuard_1.GithubAuthGuard,
|
|
163
160
|
RolesGuard_1.RolesGuard,
|
|
164
161
|
archipel_platform_cryptography_1.BcryptService,
|
|
165
162
|
archipel_platform_cryptography_1.CryptoService,
|
|
@@ -1,9 +1,17 @@
|
|
|
1
|
+
import { ExecutionContext } from '@nestjs/common';
|
|
2
|
+
import { Reflector } from '@nestjs/core';
|
|
1
3
|
declare const JwtAuthGuard_base: import("@nestjs/passport").Type<import("@nestjs/passport").IAuthGuard>;
|
|
2
4
|
/**
|
|
3
5
|
* The `JwtAuthGuard` protects routes using JWT-based authentication.
|
|
6
|
+
* It checks for the `@Public()` decorator metadata.
|
|
7
|
+
* When registered as `APP_GUARD`, all routes require JWT authentication by default.
|
|
8
|
+
* Routes decorated with `@Public()` are exempt.
|
|
4
9
|
*
|
|
5
10
|
* @public
|
|
6
11
|
*/
|
|
7
12
|
export declare class JwtAuthGuard extends JwtAuthGuard_base {
|
|
13
|
+
private readonly reflector;
|
|
14
|
+
constructor(reflector: Reflector);
|
|
15
|
+
canActivate(context: ExecutionContext): boolean | Promise<boolean> | import("rxjs").Observable<boolean>;
|
|
8
16
|
}
|
|
9
17
|
export {};
|
|
@@ -3,18 +3,41 @@
|
|
|
3
3
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
4
|
exports.JwtAuthGuard = void 0;
|
|
5
5
|
const tslib_1 = require("tslib");
|
|
6
|
+
const archipel_platform_core_1 = require("@breadstone/archipel-platform-core");
|
|
6
7
|
const common_1 = require("@nestjs/common");
|
|
8
|
+
const core_1 = require("@nestjs/core");
|
|
7
9
|
const passport_1 = require("@nestjs/passport");
|
|
8
10
|
// #endregion
|
|
9
11
|
/**
|
|
10
12
|
* The `JwtAuthGuard` protects routes using JWT-based authentication.
|
|
13
|
+
* It checks for the `@Public()` decorator metadata.
|
|
14
|
+
* When registered as `APP_GUARD`, all routes require JWT authentication by default.
|
|
15
|
+
* Routes decorated with `@Public()` are exempt.
|
|
11
16
|
*
|
|
12
17
|
* @public
|
|
13
18
|
*/
|
|
14
19
|
let JwtAuthGuard = class JwtAuthGuard extends (0, passport_1.AuthGuard)('jwt') {
|
|
20
|
+
// #region Ctor
|
|
21
|
+
constructor(reflector) {
|
|
22
|
+
super();
|
|
23
|
+
this.reflector = reflector;
|
|
24
|
+
}
|
|
25
|
+
// #endregion
|
|
26
|
+
// #region Methods
|
|
27
|
+
canActivate(context) {
|
|
28
|
+
const isPublic = this.reflector.getAllAndOverride(archipel_platform_core_1.IS_PUBLIC_KEY, [
|
|
29
|
+
context.getHandler(),
|
|
30
|
+
context.getClass(),
|
|
31
|
+
]);
|
|
32
|
+
if (isPublic) {
|
|
33
|
+
return true;
|
|
34
|
+
}
|
|
35
|
+
return super.canActivate(context);
|
|
36
|
+
}
|
|
15
37
|
};
|
|
16
38
|
exports.JwtAuthGuard = JwtAuthGuard;
|
|
17
39
|
exports.JwtAuthGuard = JwtAuthGuard = tslib_1.__decorate([
|
|
18
|
-
(0, common_1.Injectable)()
|
|
40
|
+
(0, common_1.Injectable)(),
|
|
41
|
+
tslib_1.__metadata("design:paramtypes", [core_1.Reflector])
|
|
19
42
|
], JwtAuthGuard);
|
|
20
43
|
//# sourceMappingURL=JwtAuthGuard.js.map
|
package/src/guards/index.d.ts
CHANGED
package/src/guards/index.js
CHANGED
|
@@ -2,7 +2,6 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
const tslib_1 = require("tslib");
|
|
4
4
|
tslib_1.__exportStar(require("./AnonymousAuthGuard"), exports);
|
|
5
|
-
tslib_1.__exportStar(require("./GithubAuthGuard"), exports);
|
|
6
5
|
tslib_1.__exportStar(require("./JwtAuthGuard"), exports);
|
|
7
6
|
tslib_1.__exportStar(require("./LocalAuthGuard"), exports);
|
|
8
7
|
tslib_1.__exportStar(require("./RolesGuard"), exports);
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
declare const GithubAuthGuard_base: import("@nestjs/passport").Type<import("@nestjs/passport").IAuthGuard>;
|
|
2
|
-
/**
|
|
3
|
-
* The `GithubAuthGuard` protects routes using GitHub authentication.
|
|
4
|
-
*
|
|
5
|
-
* @public
|
|
6
|
-
*/
|
|
7
|
-
export declare class GithubAuthGuard extends GithubAuthGuard_base {
|
|
8
|
-
}
|
|
9
|
-
export {};
|
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
// #region Imports
|
|
3
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
|
-
exports.GithubAuthGuard = void 0;
|
|
5
|
-
const tslib_1 = require("tslib");
|
|
6
|
-
const common_1 = require("@nestjs/common");
|
|
7
|
-
const passport_1 = require("@nestjs/passport");
|
|
8
|
-
// #endregion
|
|
9
|
-
/**
|
|
10
|
-
* The `GithubAuthGuard` protects routes using GitHub authentication.
|
|
11
|
-
*
|
|
12
|
-
* @public
|
|
13
|
-
*/
|
|
14
|
-
let GithubAuthGuard = class GithubAuthGuard extends (0, passport_1.AuthGuard)('github') {
|
|
15
|
-
};
|
|
16
|
-
exports.GithubAuthGuard = GithubAuthGuard;
|
|
17
|
-
exports.GithubAuthGuard = GithubAuthGuard = tslib_1.__decorate([
|
|
18
|
-
(0, common_1.Injectable)()
|
|
19
|
-
], GithubAuthGuard);
|
|
20
|
-
//# sourceMappingURL=GithubAuthGuard.js.map
|
|
File without changes
|
|
File without changes
|