@zola_do/authorization 0.2.3 → 0.2.4
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/README.md +31 -1
- package/dist/decorators/index.d.ts +2 -0
- package/dist/decorators/index.js +19 -0
- package/dist/decorators/index.js.map +1 -0
- package/dist/guards/index.d.ts +6 -0
- package/dist/guards/index.js +23 -0
- package/dist/guards/index.js.map +1 -0
- package/dist/helper/index.d.ts +2 -0
- package/dist/helper/index.js +19 -0
- package/dist/helper/index.js.map +1 -0
- package/dist/index.d.ts +0 -1
- package/dist/index.js +0 -1
- package/dist/index.js.map +1 -1
- package/dist/models/index.d.ts +1 -0
- package/dist/models/index.js +18 -0
- package/dist/models/index.js.map +1 -0
- package/dist/module/index.d.ts +1 -0
- package/dist/module/index.js +18 -0
- package/dist/module/index.js.map +1 -0
- package/dist/optional/throttler.d.ts +1 -0
- package/dist/optional/throttler.js +18 -0
- package/dist/optional/throttler.js.map +1 -0
- package/dist/strategy/index.d.ts +2 -0
- package/dist/strategy/index.js +19 -0
- package/dist/strategy/index.js.map +1 -0
- package/package.json +36 -1
package/README.md
CHANGED
|
@@ -12,6 +12,24 @@ npm install @zola_do/authorization
|
|
|
12
12
|
npm install @zola_do/nestjs-shared
|
|
13
13
|
```
|
|
14
14
|
|
|
15
|
+
## Recommended Imports
|
|
16
|
+
|
|
17
|
+
`@zola_do/authorization` root imports remain fully supported for backward compatibility.
|
|
18
|
+
For new code, prefer focused subpath imports:
|
|
19
|
+
|
|
20
|
+
```typescript
|
|
21
|
+
import { AuthorizationModule } from '@zola_do/authorization/module';
|
|
22
|
+
import { JwtGuard, PermissionsGuard } from '@zola_do/authorization/guards';
|
|
23
|
+
import { AllowAnonymous, CurrentUser } from '@zola_do/authorization/decorators';
|
|
24
|
+
import { AuthHelper } from '@zola_do/authorization/helper';
|
|
25
|
+
```
|
|
26
|
+
|
|
27
|
+
Optional throttler guard stays available at:
|
|
28
|
+
|
|
29
|
+
```typescript
|
|
30
|
+
import { ThrottlerBehindProxyGuard } from '@zola_do/authorization/optional/throttler';
|
|
31
|
+
```
|
|
32
|
+
|
|
15
33
|
## Usage
|
|
16
34
|
|
|
17
35
|
### Module Setup
|
|
@@ -146,10 +164,22 @@ export class AuthService {
|
|
|
146
164
|
|
|
147
165
|
## Exports
|
|
148
166
|
|
|
149
|
-
- **Guards:** `JwtGuard`, `JwtRefreshGuard`, `PermissionsGuard`, `ApiKeyGuard`, `VendorGuard`, `OptionalJwtGuard
|
|
167
|
+
- **Guards:** `JwtGuard`, `JwtRefreshGuard`, `PermissionsGuard`, `ApiKeyGuard`, `VendorGuard`, `OptionalJwtGuard`
|
|
150
168
|
- **Decorators:** `@CurrentUser()`, `@AllowAnonymous()`
|
|
151
169
|
- **Strategies:** `JwtStrategy`, `JwtRefreshTokenStrategy`
|
|
152
170
|
- **Helpers:** `AuthHelper`
|
|
171
|
+
- **Subpath entrypoints:** `@zola_do/authorization/module`, `@zola_do/authorization/decorators`, `@zola_do/authorization/guards`, `@zola_do/authorization/strategy`, `@zola_do/authorization/helper`, `@zola_do/authorization/models`
|
|
172
|
+
- **Root entrypoint:** `@zola_do/authorization` (supported for backward compatibility)
|
|
173
|
+
|
|
174
|
+
### Optional Features
|
|
175
|
+
|
|
176
|
+
`ThrottlerBehindProxyGuard` is available as an optional export:
|
|
177
|
+
|
|
178
|
+
```typescript
|
|
179
|
+
import { ThrottlerBehindProxyGuard } from '@zola_do/authorization/optional/throttler';
|
|
180
|
+
```
|
|
181
|
+
|
|
182
|
+
When using this guard, install `@nestjs/throttler` in your app.
|
|
153
183
|
|
|
154
184
|
## Related Packages
|
|
155
185
|
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
+
};
|
|
16
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
__exportStar(require("./allow-anonymous.decorator"), exports);
|
|
18
|
+
__exportStar(require("./current-user.decorator"), exports);
|
|
19
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/decorators/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,8DAA4C;AAC5C,2DAAyC"}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
+
};
|
|
16
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
__exportStar(require("./jwt.guard"), exports);
|
|
18
|
+
__exportStar(require("./jwt-refresh.guard"), exports);
|
|
19
|
+
__exportStar(require("./permissions.guard"), exports);
|
|
20
|
+
__exportStar(require("./api-key.guard"), exports);
|
|
21
|
+
__exportStar(require("./vendor.guard"), exports);
|
|
22
|
+
__exportStar(require("./optional-jwt.guard"), exports);
|
|
23
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/guards/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,8CAA4B;AAC5B,sDAAoC;AACpC,sDAAoC;AACpC,kDAAgC;AAChC,iDAA+B;AAC/B,uDAAqC"}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
+
};
|
|
16
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
__exportStar(require("./auth.helper"), exports);
|
|
18
|
+
__exportStar(require("./jwt.type"), exports);
|
|
19
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/helper/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,gDAA8B;AAC9B,6CAA2B"}
|
package/dist/index.d.ts
CHANGED
|
@@ -5,7 +5,6 @@ export * from './decorators/current-user.decorator';
|
|
|
5
5
|
export * from './guards/permissions.guard';
|
|
6
6
|
export * from './helper/auth.helper';
|
|
7
7
|
export * from './guards/jwt-refresh.guard';
|
|
8
|
-
export * from './guards/throttler-behind-proxy.guard';
|
|
9
8
|
export * from './guards/api-key.guard';
|
|
10
9
|
export * from './guards/vendor.guard';
|
|
11
10
|
export * from './guards/optional-jwt.guard';
|
package/dist/index.js
CHANGED
|
@@ -24,7 +24,6 @@ __exportStar(require("./decorators/current-user.decorator"), exports);
|
|
|
24
24
|
__exportStar(require("./guards/permissions.guard"), exports);
|
|
25
25
|
__exportStar(require("./helper/auth.helper"), exports);
|
|
26
26
|
__exportStar(require("./guards/jwt-refresh.guard"), exports);
|
|
27
|
-
__exportStar(require("./guards/throttler-behind-proxy.guard"), exports);
|
|
28
27
|
__exportStar(require("./guards/api-key.guard"), exports);
|
|
29
28
|
__exportStar(require("./guards/vendor.guard"), exports);
|
|
30
29
|
__exportStar(require("./guards/optional-jwt.guard"), exports);
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;AAAA,+DAA6D;AAApD,2HAAA,mBAAmB,OAAA;AAC5B,gDAA8C;AAArC,qGAAA,QAAQ,OAAA;AACjB,yEAAuD;AACvD,sEAAoD;AACpD,6DAA2C;AAC3C,uDAAqC;AACrC,6DAA2C;AAC3C,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;AAAA,+DAA6D;AAApD,2HAAA,mBAAmB,OAAA;AAC5B,gDAA8C;AAArC,qGAAA,QAAQ,OAAA;AACjB,yEAAuD;AACvD,sEAAoD;AACpD,6DAA2C;AAC3C,uDAAqC;AACrC,6DAA2C;AAC3C,yDAAuC;AACvC,wDAAsC;AACtC,8DAA4C;AAC5C,wEAAsD;AACtD,0DAAwC;AACxC,sDAAoC;AACpC,oDAAkC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './auth.model';
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
+
};
|
|
16
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
__exportStar(require("./auth.model"), exports);
|
|
18
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/models/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,+CAA6B"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from '../authorization.module';
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
+
};
|
|
16
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
__exportStar(require("../authorization.module"), exports);
|
|
18
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/module/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,0DAAwC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from '../guards/throttler-behind-proxy.guard';
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
+
};
|
|
16
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
__exportStar(require("../guards/throttler-behind-proxy.guard"), exports);
|
|
18
|
+
//# sourceMappingURL=throttler.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"throttler.js","sourceRoot":"","sources":["../../src/optional/throttler.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,yEAAuD"}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
+
};
|
|
16
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
__exportStar(require("./jwt.strategy"), exports);
|
|
18
|
+
__exportStar(require("./jwt-refresh-token.strategy"), exports);
|
|
19
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/strategy/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,iDAA+B;AAC/B,+DAA6C"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@zola_do/authorization",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.4",
|
|
4
4
|
"description": "JWT auth, guards, strategies for NestJS",
|
|
5
5
|
"author": "zolaDO",
|
|
6
6
|
"license": "ISC",
|
|
@@ -18,6 +18,41 @@
|
|
|
18
18
|
"types": "./dist/index.d.ts",
|
|
19
19
|
"require": "./dist/index.js",
|
|
20
20
|
"default": "./dist/index.js"
|
|
21
|
+
},
|
|
22
|
+
"./module": {
|
|
23
|
+
"types": "./dist/module/index.d.ts",
|
|
24
|
+
"require": "./dist/module/index.js",
|
|
25
|
+
"default": "./dist/module/index.js"
|
|
26
|
+
},
|
|
27
|
+
"./decorators": {
|
|
28
|
+
"types": "./dist/decorators/index.d.ts",
|
|
29
|
+
"require": "./dist/decorators/index.js",
|
|
30
|
+
"default": "./dist/decorators/index.js"
|
|
31
|
+
},
|
|
32
|
+
"./guards": {
|
|
33
|
+
"types": "./dist/guards/index.d.ts",
|
|
34
|
+
"require": "./dist/guards/index.js",
|
|
35
|
+
"default": "./dist/guards/index.js"
|
|
36
|
+
},
|
|
37
|
+
"./strategy": {
|
|
38
|
+
"types": "./dist/strategy/index.d.ts",
|
|
39
|
+
"require": "./dist/strategy/index.js",
|
|
40
|
+
"default": "./dist/strategy/index.js"
|
|
41
|
+
},
|
|
42
|
+
"./helper": {
|
|
43
|
+
"types": "./dist/helper/index.d.ts",
|
|
44
|
+
"require": "./dist/helper/index.js",
|
|
45
|
+
"default": "./dist/helper/index.js"
|
|
46
|
+
},
|
|
47
|
+
"./models": {
|
|
48
|
+
"types": "./dist/models/index.d.ts",
|
|
49
|
+
"require": "./dist/models/index.js",
|
|
50
|
+
"default": "./dist/models/index.js"
|
|
51
|
+
},
|
|
52
|
+
"./optional/throttler": {
|
|
53
|
+
"types": "./dist/optional/throttler.d.ts",
|
|
54
|
+
"require": "./dist/optional/throttler.js",
|
|
55
|
+
"default": "./dist/optional/throttler.js"
|
|
21
56
|
}
|
|
22
57
|
},
|
|
23
58
|
"files": [
|