@spinajs/rbac-http-user 2.0.474 → 2.0.476
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/lib/cjs/controllers/LoginController.d.ts +4 -27
- package/lib/cjs/controllers/LoginController.d.ts.map +1 -1
- package/lib/cjs/controllers/LoginController.js +27 -46
- package/lib/cjs/controllers/LoginController.js.map +1 -1
- package/lib/cjs/index.d.ts +0 -5
- package/lib/cjs/index.d.ts.map +1 -1
- package/lib/cjs/index.js +0 -5
- package/lib/cjs/index.js.map +1 -1
- package/lib/mjs/controllers/LoginController.d.ts +4 -27
- package/lib/mjs/controllers/LoginController.d.ts.map +1 -1
- package/lib/mjs/controllers/LoginController.js +29 -48
- package/lib/mjs/controllers/LoginController.js.map +1 -1
- package/lib/mjs/index.d.ts +0 -5
- package/lib/mjs/index.d.ts.map +1 -1
- package/lib/mjs/index.js +0 -5
- package/lib/mjs/index.js.map +1 -1
- package/lib/tsconfig.cjs.tsbuildinfo +1 -1
- package/lib/tsconfig.mjs.tsbuildinfo +1 -1
- package/package.json +11 -11
- package/lib/cjs/controllers/ActiveRoleController.d.ts +0 -41
- package/lib/cjs/controllers/ActiveRoleController.d.ts.map +0 -1
- package/lib/cjs/controllers/ActiveRoleController.js +0 -135
- package/lib/cjs/controllers/ActiveRoleController.js.map +0 -1
- package/lib/cjs/controllers/ImpersonationController.d.ts +0 -72
- package/lib/cjs/controllers/ImpersonationController.d.ts.map +0 -1
- package/lib/cjs/controllers/ImpersonationController.js +0 -277
- package/lib/cjs/controllers/ImpersonationController.js.map +0 -1
- package/lib/cjs/dto/impersonate-dto.d.ts +0 -24
- package/lib/cjs/dto/impersonate-dto.d.ts.map +0 -1
- package/lib/cjs/dto/impersonate-dto.js +0 -34
- package/lib/cjs/dto/impersonate-dto.js.map +0 -1
- package/lib/cjs/dto/switchRole-dto.d.ts +0 -24
- package/lib/cjs/dto/switchRole-dto.d.ts.map +0 -1
- package/lib/cjs/dto/switchRole-dto.js +0 -34
- package/lib/cjs/dto/switchRole-dto.js.map +0 -1
- package/lib/cjs/handlers/DefaultLogoutHandler.d.ts +0 -14
- package/lib/cjs/handlers/DefaultLogoutHandler.d.ts.map +0 -1
- package/lib/cjs/handlers/DefaultLogoutHandler.js +0 -61
- package/lib/cjs/handlers/DefaultLogoutHandler.js.map +0 -1
- package/lib/cjs/handlers/ImpersonationLogoutHandler.d.ts +0 -18
- package/lib/cjs/handlers/ImpersonationLogoutHandler.d.ts.map +0 -1
- package/lib/cjs/handlers/ImpersonationLogoutHandler.js +0 -66
- package/lib/cjs/handlers/ImpersonationLogoutHandler.js.map +0 -1
- package/lib/cjs/logout.d.ts +0 -51
- package/lib/cjs/logout.d.ts.map +0 -1
- package/lib/cjs/logout.js +0 -29
- package/lib/cjs/logout.js.map +0 -1
- package/lib/mjs/controllers/ActiveRoleController.d.ts +0 -41
- package/lib/mjs/controllers/ActiveRoleController.d.ts.map +0 -1
- package/lib/mjs/controllers/ActiveRoleController.js +0 -132
- package/lib/mjs/controllers/ActiveRoleController.js.map +0 -1
- package/lib/mjs/controllers/ImpersonationController.d.ts +0 -72
- package/lib/mjs/controllers/ImpersonationController.d.ts.map +0 -1
- package/lib/mjs/controllers/ImpersonationController.js +0 -274
- package/lib/mjs/controllers/ImpersonationController.js.map +0 -1
- package/lib/mjs/dto/impersonate-dto.d.ts +0 -24
- package/lib/mjs/dto/impersonate-dto.d.ts.map +0 -1
- package/lib/mjs/dto/impersonate-dto.js +0 -31
- package/lib/mjs/dto/impersonate-dto.js.map +0 -1
- package/lib/mjs/dto/switchRole-dto.d.ts +0 -24
- package/lib/mjs/dto/switchRole-dto.d.ts.map +0 -1
- package/lib/mjs/dto/switchRole-dto.js +0 -31
- package/lib/mjs/dto/switchRole-dto.js.map +0 -1
- package/lib/mjs/handlers/DefaultLogoutHandler.d.ts +0 -14
- package/lib/mjs/handlers/DefaultLogoutHandler.d.ts.map +0 -1
- package/lib/mjs/handlers/DefaultLogoutHandler.js +0 -58
- package/lib/mjs/handlers/DefaultLogoutHandler.js.map +0 -1
- package/lib/mjs/handlers/ImpersonationLogoutHandler.d.ts +0 -18
- package/lib/mjs/handlers/ImpersonationLogoutHandler.d.ts.map +0 -1
- package/lib/mjs/handlers/ImpersonationLogoutHandler.js +0 -63
- package/lib/mjs/handlers/ImpersonationLogoutHandler.js.map +0 -1
- package/lib/mjs/logout.d.ts +0 -51
- package/lib/mjs/logout.d.ts.map +0 -1
- package/lib/mjs/logout.js +0 -25
- package/lib/mjs/logout.js.map +0 -1
|
@@ -4,7 +4,6 @@ import { AuthProvider, SessionProvider, AccessControl } from '@spinajs/rbac';
|
|
|
4
4
|
import { Configuration } from '@spinajs/configuration';
|
|
5
5
|
import { ILoginResponse } from '@spinajs/rbac-http';
|
|
6
6
|
import { User } from '@spinajs/rbac';
|
|
7
|
-
import type { ISession } from '@spinajs/rbac';
|
|
8
7
|
/**
|
|
9
8
|
* Authentication endpoints.
|
|
10
9
|
* Handles user login, logout, and current-session inspection.
|
|
@@ -34,41 +33,19 @@ export declare class LoginController extends BaseController {
|
|
|
34
33
|
/**
|
|
35
34
|
* Logout
|
|
36
35
|
* Destroys the current session identified by the `ssid` cookie and clears the cookie on the client.
|
|
37
|
-
* If an impersonation is active, the session is NOT destroyed — instead the
|
|
38
|
-
* impersonation is ended and the original user resumes their session.
|
|
39
36
|
* Requires the user to be logged in (session exists), but full authorization (2FA) is not required.
|
|
40
37
|
* @security cookieAuth
|
|
41
38
|
* @response 401 No active session
|
|
42
39
|
*/
|
|
43
|
-
logout(ssid: string
|
|
40
|
+
logout(ssid: string): Promise<Ok<any>>;
|
|
44
41
|
/**
|
|
45
42
|
* Get current user
|
|
46
|
-
* Returns the user object associated with the current session
|
|
47
|
-
* currently active role and the full list of roles the user may switch to.
|
|
43
|
+
* Returns the user object associated with the current session.
|
|
48
44
|
* Requires the user to be logged in (session exists), but full authorization (2FA) is not required.
|
|
49
45
|
* @security cookieAuth
|
|
50
|
-
* @returns {
|
|
46
|
+
* @returns {IUserProfile} User data from the current session
|
|
51
47
|
* @response 401 No active session
|
|
52
48
|
*/
|
|
53
|
-
whoami(User: User
|
|
54
|
-
ActiveRole: string;
|
|
55
|
-
AvailableRoles: string[];
|
|
56
|
-
Email: string;
|
|
57
|
-
Password: string;
|
|
58
|
-
Id: number;
|
|
59
|
-
Uuid: string;
|
|
60
|
-
Login: string;
|
|
61
|
-
Role: string[];
|
|
62
|
-
CreatedAt: import("luxon").DateTime;
|
|
63
|
-
RegisteredAt: import("luxon").DateTime;
|
|
64
|
-
DeletedAt: import("luxon").DateTime;
|
|
65
|
-
LastLoginAt: import("luxon").DateTime;
|
|
66
|
-
IsActive: boolean;
|
|
67
|
-
IsGuest: boolean;
|
|
68
|
-
IsBanned: boolean;
|
|
69
|
-
IsDirty: boolean;
|
|
70
|
-
Metadata: Omit<import("@spinajs/orm").ModelDataWithRelationData<import("@spinajs/rbac").UserMetadataBase>, import("@spinajs/orm").ExcludedModelProperties>[];
|
|
71
|
-
PrimaryKeyValue: any;
|
|
72
|
-
}>>;
|
|
49
|
+
whoami(User: User): Promise<Ok<User>>;
|
|
73
50
|
}
|
|
74
51
|
//# sourceMappingURL=LoginController.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"LoginController.d.ts","sourceRoot":"","sources":["../../../src/controllers/LoginController.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,yBAAyB,CAAC;AACvD,OAAO,EAAE,cAAc,EAAwB,EAAE,EAAe,YAAY,EAAU,MAAM,eAAe,CAAC;AAC5G,OAAO,EAAE,YAAY,EAAE,eAAe,EAAsB,aAAa,EAAiB,MAAM,eAAe,CAAC;AAEhH,OAAO,EAA6B,aAAa,EAAE,MAAM,wBAAwB,CAAC;AAElF,OAAO,
|
|
1
|
+
{"version":3,"file":"LoginController.d.ts","sourceRoot":"","sources":["../../../src/controllers/LoginController.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,yBAAyB,CAAC;AACvD,OAAO,EAAE,cAAc,EAAwB,EAAE,EAAe,YAAY,EAAU,MAAM,eAAe,CAAC;AAC5G,OAAO,EAAE,YAAY,EAAE,eAAe,EAAsB,aAAa,EAAiB,MAAM,eAAe,CAAC;AAEhH,OAAO,EAA6B,aAAa,EAAE,MAAM,wBAAwB,CAAC;AAElF,OAAO,EAAsC,cAAc,EAAmB,MAAM,oBAAoB,CAAC;AACzG,OAAO,EAAE,IAAI,EAAE,MAAM,eAAe,CAAC;AAGrC;;;;;GAKG;AACH,qBACa,eAAgB,SAAQ,cAAc;IAEjD,SAAS,CAAC,aAAa,EAAE,aAAa,CAAC;IAGvC,SAAS,CAAC,YAAY,EAAE,YAAY,CAAC;IAGrC,SAAS,CAAC,eAAe,EAAE,eAAe,CAAC;IAK3C,SAAS,CAAC,qBAAqB,EAAE,MAAM,CAAC;IAKxC,SAAS,CAAC,oBAAoB,EAAE,OAAO,CAAC;IAMxC,SAAS,CAAC,sBAAsB,EAAE,OAAO,CAAC;IAG1C,SAAS,CAAC,mBAAmB,EAAE,GAAG,CAAC;IAGnC,SAAS,CAAC,EAAE,EAAE,aAAa,CAAC;IAE5B;;;;;;;;;OASG;IAEU,KAAK,CAAiB,MAAM,EAAE,IAAI,EAAgB,IAAI,EAAE,MAAM,EAAU,WAAW,EAAE,YAAY,GAAG,OAAO,CAAC,EAAE,CAAC,cAAc,CAAC,GAAG,YAAY,CAAC;IAwG3J;;;;;;OAMG;IAGU,MAAM,CAAe,IAAI,EAAE,MAAM;IA0B9C;;;;;;;OAOG;IAGU,MAAM,CAAiB,IAAI,EAAE,IAAI;CAK/C"}
|
|
@@ -20,7 +20,6 @@ const di_1 = require("@spinajs/di");
|
|
|
20
20
|
const configuration_1 = require("@spinajs/configuration");
|
|
21
21
|
const rbac_http_1 = require("@spinajs/rbac-http");
|
|
22
22
|
const rbac_2 = require("@spinajs/rbac");
|
|
23
|
-
const logout_js_1 = require("../logout.js");
|
|
24
23
|
/**
|
|
25
24
|
* Authentication endpoints.
|
|
26
25
|
* Handles user login, logout, and current-session inspection.
|
|
@@ -64,12 +63,6 @@ let LoginController = class LoginController extends http_1.BaseController {
|
|
|
64
63
|
];
|
|
65
64
|
let result;
|
|
66
65
|
session.Data.set('User', user.Uuid);
|
|
67
|
-
// Default active role = first role from the user's role list.
|
|
68
|
-
// Users with multiple roles can later switch via /auth/active-role.
|
|
69
|
-
const activeRole = user.Role?.[0];
|
|
70
|
-
if (activeRole) {
|
|
71
|
-
session.Data.set('ActiveRole', activeRole);
|
|
72
|
-
}
|
|
73
66
|
// we have two states for user
|
|
74
67
|
// LOGGED - when user use proper login/password and session is created
|
|
75
68
|
// AUTHORIZED - when user is atuhenticated eg. by 2fa check. If 2fa is disabled
|
|
@@ -97,12 +90,12 @@ let LoginController = class LoginController extends http_1.BaseController {
|
|
|
97
90
|
else {
|
|
98
91
|
session.Data.set('Authorized', true);
|
|
99
92
|
const grants = this.AC.getGrants();
|
|
100
|
-
const
|
|
93
|
+
const userGrants = user.Role.map(r => (0, rbac_1._unwindGrants)(r, grants));
|
|
94
|
+
const combinedGrants = Object.assign({}, ...userGrants);
|
|
101
95
|
// dehydrateWithRelations({ dateTimeFormat: 'iso' }) converts DateTime to ISO strings
|
|
102
96
|
// at runtime — the ORM types don't reflect the dateTimeFormat option in generics
|
|
103
97
|
result = {
|
|
104
98
|
...user.dehydrateWithRelations({ dateTimeFormat: "iso" }),
|
|
105
|
-
ActiveRole: activeRole,
|
|
106
99
|
Grants: combinedGrants,
|
|
107
100
|
};
|
|
108
101
|
}
|
|
@@ -127,52 +120,43 @@ let LoginController = class LoginController extends http_1.BaseController {
|
|
|
127
120
|
/**
|
|
128
121
|
* Logout
|
|
129
122
|
* Destroys the current session identified by the `ssid` cookie and clears the cookie on the client.
|
|
130
|
-
* If an impersonation is active, the session is NOT destroyed — instead the
|
|
131
|
-
* impersonation is ended and the original user resumes their session.
|
|
132
123
|
* Requires the user to be logged in (session exists), but full authorization (2FA) is not required.
|
|
133
124
|
* @security cookieAuth
|
|
134
125
|
* @response 401 No active session
|
|
135
126
|
*/
|
|
136
|
-
async logout(ssid
|
|
127
|
+
async logout(ssid) {
|
|
137
128
|
if (!ssid) {
|
|
138
129
|
return new http_1.Ok();
|
|
139
130
|
}
|
|
140
|
-
|
|
141
|
-
//
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
}
|
|
157
|
-
// No handler claimed the request — should not happen as long as the
|
|
158
|
-
// default handler is registered, but return a clean response anyway.
|
|
159
|
-
return new http_1.Ok();
|
|
131
|
+
await this.SessionProvider.delete(ssid);
|
|
132
|
+
// send empty cookie to confirm session deletion
|
|
133
|
+
return new http_1.Ok(null, {
|
|
134
|
+
Coockies: [
|
|
135
|
+
{
|
|
136
|
+
Name: 'ssid',
|
|
137
|
+
Value: '',
|
|
138
|
+
Options: {
|
|
139
|
+
httpOnly: true,
|
|
140
|
+
maxAge: 0,
|
|
141
|
+
// any optopnal cookie options
|
|
142
|
+
// or override default ones
|
|
143
|
+
...this.SessionCookieConfig
|
|
144
|
+
},
|
|
145
|
+
},
|
|
146
|
+
],
|
|
147
|
+
});
|
|
160
148
|
}
|
|
161
149
|
/**
|
|
162
150
|
* Get current user
|
|
163
|
-
* Returns the user object associated with the current session
|
|
164
|
-
* currently active role and the full list of roles the user may switch to.
|
|
151
|
+
* Returns the user object associated with the current session.
|
|
165
152
|
* Requires the user to be logged in (session exists), but full authorization (2FA) is not required.
|
|
166
153
|
* @security cookieAuth
|
|
167
|
-
* @returns {
|
|
154
|
+
* @returns {IUserProfile} User data from the current session
|
|
168
155
|
* @response 401 No active session
|
|
169
156
|
*/
|
|
170
|
-
async whoami(User
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
ActiveRole: ActiveRole ?? User.Role?.[0],
|
|
174
|
-
AvailableRoles: User.Role ?? [],
|
|
175
|
-
});
|
|
157
|
+
async whoami(User) {
|
|
158
|
+
// user is taken from session data
|
|
159
|
+
return new http_1.Ok(User);
|
|
176
160
|
}
|
|
177
161
|
};
|
|
178
162
|
exports.LoginController = LoginController;
|
|
@@ -227,19 +211,16 @@ __decorate([
|
|
|
227
211
|
(0, http_1.Get)(),
|
|
228
212
|
(0, http_1.Policy)(rbac_http_1.LoggedPolicy),
|
|
229
213
|
__param(0, (0, http_1.Cookie)(true)),
|
|
230
|
-
__param(1, (0, rbac_http_1.Session)()),
|
|
231
|
-
__param(2, (0, rbac_http_1.User)()),
|
|
232
214
|
__metadata("design:type", Function),
|
|
233
|
-
__metadata("design:paramtypes", [String
|
|
215
|
+
__metadata("design:paramtypes", [String]),
|
|
234
216
|
__metadata("design:returntype", Promise)
|
|
235
217
|
], LoginController.prototype, "logout", null);
|
|
236
218
|
__decorate([
|
|
237
219
|
(0, http_1.Get)(),
|
|
238
220
|
(0, http_1.Policy)(rbac_http_1.LoggedPolicy),
|
|
239
221
|
__param(0, (0, rbac_http_1.User)()),
|
|
240
|
-
__param(1, (0, rbac_http_1.FromSession)()),
|
|
241
222
|
__metadata("design:type", Function),
|
|
242
|
-
__metadata("design:paramtypes", [rbac_2.User
|
|
223
|
+
__metadata("design:paramtypes", [rbac_2.User]),
|
|
243
224
|
__metadata("design:returntype", Promise)
|
|
244
225
|
], LoginController.prototype, "whoami", null);
|
|
245
226
|
exports.LoginController = LoginController = __decorate([
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"LoginController.js","sourceRoot":"","sources":["../../../src/controllers/LoginController.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AAAA,8DAAuD;AACvD,wCAA4G;AAC5G,wCAAgH;AAChH,
|
|
1
|
+
{"version":3,"file":"LoginController.js","sourceRoot":"","sources":["../../../src/controllers/LoginController.ts"],"names":[],"mappings":";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;IAD3B,IAAA,eAAQ,EAAC,MAAM,CAAC;GACJ,eAAe,CAqM3B"}
|
package/lib/cjs/index.d.ts
CHANGED
|
@@ -1,11 +1,6 @@
|
|
|
1
1
|
import { Bootstrapper } from '@spinajs/di';
|
|
2
2
|
export * from './controllers/LoginController.js';
|
|
3
|
-
export * from './controllers/ActiveRoleController.js';
|
|
4
|
-
export * from './controllers/ImpersonationController.js';
|
|
5
3
|
export * from './controllers/UserController.js';
|
|
6
|
-
export * from './logout.js';
|
|
7
|
-
export * from './handlers/ImpersonationLogoutHandler.js';
|
|
8
|
-
export * from './handlers/DefaultLogoutHandler.js';
|
|
9
4
|
export * from './controllers/UserMetadataController.js';
|
|
10
5
|
export * from "./controllers/TwoFactorAuthController.js";
|
|
11
6
|
export * from "./cli/EnableUser2Fa.js";
|
package/lib/cjs/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAc,MAAM,aAAa,CAAC;AAIvD,cAAc,kCAAkC,CAAC;AACjD,cAAc,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAc,MAAM,aAAa,CAAC;AAIvD,cAAc,kCAAkC,CAAC;AACjD,cAAc,iCAAiC,CAAC;AAChD,cAAc,yCAAyC,CAAC;AACxD,cAAc,0CAA0C,CAAC;AAEzD,cAAc,wBAAwB,CAAC;AACvC,cAAc,0BAA0B,CAAC;AAEzC,cAAc,kBAAkB,CAAC;AAGjC,qBACa,wBAAyB,SAAQ,YAAY;IAC/C,SAAS,IAAI,IAAI;CAO3B"}
|
package/lib/cjs/index.js
CHANGED
|
@@ -25,12 +25,7 @@ const di_1 = require("@spinajs/di");
|
|
|
25
25
|
const rbac_1 = require("@spinajs/rbac");
|
|
26
26
|
const Default2FaToken_js_1 = require("./2fa/Default2FaToken.js");
|
|
27
27
|
__exportStar(require("./controllers/LoginController.js"), exports);
|
|
28
|
-
__exportStar(require("./controllers/ActiveRoleController.js"), exports);
|
|
29
|
-
__exportStar(require("./controllers/ImpersonationController.js"), exports);
|
|
30
28
|
__exportStar(require("./controllers/UserController.js"), exports);
|
|
31
|
-
__exportStar(require("./logout.js"), exports);
|
|
32
|
-
__exportStar(require("./handlers/ImpersonationLogoutHandler.js"), exports);
|
|
33
|
-
__exportStar(require("./handlers/DefaultLogoutHandler.js"), exports);
|
|
34
29
|
__exportStar(require("./controllers/UserMetadataController.js"), exports);
|
|
35
30
|
__exportStar(require("./controllers/TwoFactorAuthController.js"), exports);
|
|
36
31
|
__exportStar(require("./cli/EnableUser2Fa.js"), exports);
|
package/lib/cjs/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;AAAA,oCAAuD;AACvD,wCAAiD;AACjD,iEAAkE;AAElE,mEAAiD;AACjD,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;AAAA,oCAAuD;AACvD,wCAAiD;AACjD,iEAAkE;AAElE,mEAAiD;AACjD,kEAAgD;AAChD,0EAAwD;AACxD,2EAAyD;AAEzD,yDAAuC;AACvC,2DAAyC;AAEzC,mDAAiC;AAI1B,IAAM,wBAAwB,GAA9B,MAAM,wBAAyB,SAAQ,iBAAY;IAC/C,SAAS;QACZ,uBAAgB,CAAC,WAAW,GAAG;YAC3B,GAAG,uBAAgB,CAAC,WAAW;YAC/B,2CAAsB,CAAC,KAAK;YAC5B,2CAAsB,CAAC,GAAG;SAC7B,CAAA;IACL,CAAC;CACJ,CAAA;AARY,4DAAwB;mCAAxB,wBAAwB;IADpC,IAAA,eAAU,EAAC,iBAAY,CAAC;GACZ,wBAAwB,CAQpC"}
|
|
@@ -4,7 +4,6 @@ import { AuthProvider, SessionProvider, AccessControl } from '@spinajs/rbac';
|
|
|
4
4
|
import { Configuration } from '@spinajs/configuration';
|
|
5
5
|
import { ILoginResponse } from '@spinajs/rbac-http';
|
|
6
6
|
import { User } from '@spinajs/rbac';
|
|
7
|
-
import type { ISession } from '@spinajs/rbac';
|
|
8
7
|
/**
|
|
9
8
|
* Authentication endpoints.
|
|
10
9
|
* Handles user login, logout, and current-session inspection.
|
|
@@ -34,41 +33,19 @@ export declare class LoginController extends BaseController {
|
|
|
34
33
|
/**
|
|
35
34
|
* Logout
|
|
36
35
|
* Destroys the current session identified by the `ssid` cookie and clears the cookie on the client.
|
|
37
|
-
* If an impersonation is active, the session is NOT destroyed — instead the
|
|
38
|
-
* impersonation is ended and the original user resumes their session.
|
|
39
36
|
* Requires the user to be logged in (session exists), but full authorization (2FA) is not required.
|
|
40
37
|
* @security cookieAuth
|
|
41
38
|
* @response 401 No active session
|
|
42
39
|
*/
|
|
43
|
-
logout(ssid: string
|
|
40
|
+
logout(ssid: string): Promise<Ok<any>>;
|
|
44
41
|
/**
|
|
45
42
|
* Get current user
|
|
46
|
-
* Returns the user object associated with the current session
|
|
47
|
-
* currently active role and the full list of roles the user may switch to.
|
|
43
|
+
* Returns the user object associated with the current session.
|
|
48
44
|
* Requires the user to be logged in (session exists), but full authorization (2FA) is not required.
|
|
49
45
|
* @security cookieAuth
|
|
50
|
-
* @returns {
|
|
46
|
+
* @returns {IUserProfile} User data from the current session
|
|
51
47
|
* @response 401 No active session
|
|
52
48
|
*/
|
|
53
|
-
whoami(User: User
|
|
54
|
-
ActiveRole: string;
|
|
55
|
-
AvailableRoles: string[];
|
|
56
|
-
Email: string;
|
|
57
|
-
Password: string;
|
|
58
|
-
Id: number;
|
|
59
|
-
Uuid: string;
|
|
60
|
-
Login: string;
|
|
61
|
-
Role: string[];
|
|
62
|
-
CreatedAt: import("luxon").DateTime;
|
|
63
|
-
RegisteredAt: import("luxon").DateTime;
|
|
64
|
-
DeletedAt: import("luxon").DateTime;
|
|
65
|
-
LastLoginAt: import("luxon").DateTime;
|
|
66
|
-
IsActive: boolean;
|
|
67
|
-
IsGuest: boolean;
|
|
68
|
-
IsBanned: boolean;
|
|
69
|
-
IsDirty: boolean;
|
|
70
|
-
Metadata: Omit<import("@spinajs/orm").ModelDataWithRelationData<import("@spinajs/rbac").UserMetadataBase>, import("@spinajs/orm").ExcludedModelProperties>[];
|
|
71
|
-
PrimaryKeyValue: any;
|
|
72
|
-
}>>;
|
|
49
|
+
whoami(User: User): Promise<Ok<User>>;
|
|
73
50
|
}
|
|
74
51
|
//# sourceMappingURL=LoginController.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"LoginController.d.ts","sourceRoot":"","sources":["../../../src/controllers/LoginController.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,yBAAyB,CAAC;AACvD,OAAO,EAAE,cAAc,EAAwB,EAAE,EAAe,YAAY,EAAU,MAAM,eAAe,CAAC;AAC5G,OAAO,EAAE,YAAY,EAAE,eAAe,EAAsB,aAAa,EAAiB,MAAM,eAAe,CAAC;AAEhH,OAAO,EAA6B,aAAa,EAAE,MAAM,wBAAwB,CAAC;AAElF,OAAO,
|
|
1
|
+
{"version":3,"file":"LoginController.d.ts","sourceRoot":"","sources":["../../../src/controllers/LoginController.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,yBAAyB,CAAC;AACvD,OAAO,EAAE,cAAc,EAAwB,EAAE,EAAe,YAAY,EAAU,MAAM,eAAe,CAAC;AAC5G,OAAO,EAAE,YAAY,EAAE,eAAe,EAAsB,aAAa,EAAiB,MAAM,eAAe,CAAC;AAEhH,OAAO,EAA6B,aAAa,EAAE,MAAM,wBAAwB,CAAC;AAElF,OAAO,EAAsC,cAAc,EAAmB,MAAM,oBAAoB,CAAC;AACzG,OAAO,EAAE,IAAI,EAAE,MAAM,eAAe,CAAC;AAGrC;;;;;GAKG;AACH,qBACa,eAAgB,SAAQ,cAAc;IAEjD,SAAS,CAAC,aAAa,EAAE,aAAa,CAAC;IAGvC,SAAS,CAAC,YAAY,EAAE,YAAY,CAAC;IAGrC,SAAS,CAAC,eAAe,EAAE,eAAe,CAAC;IAK3C,SAAS,CAAC,qBAAqB,EAAE,MAAM,CAAC;IAKxC,SAAS,CAAC,oBAAoB,EAAE,OAAO,CAAC;IAMxC,SAAS,CAAC,sBAAsB,EAAE,OAAO,CAAC;IAG1C,SAAS,CAAC,mBAAmB,EAAE,GAAG,CAAC;IAGnC,SAAS,CAAC,EAAE,EAAE,aAAa,CAAC;IAE5B;;;;;;;;;OASG;IAEU,KAAK,CAAiB,MAAM,EAAE,IAAI,EAAgB,IAAI,EAAE,MAAM,EAAU,WAAW,EAAE,YAAY,GAAG,OAAO,CAAC,EAAE,CAAC,cAAc,CAAC,GAAG,YAAY,CAAC;IAwG3J;;;;;;OAMG;IAGU,MAAM,CAAe,IAAI,EAAE,MAAM;IA0B9C;;;;;;;OAOG;IAGU,MAAM,CAAiB,IAAI,EAAE,IAAI;CAK/C"}
|
|
@@ -13,11 +13,10 @@ var __param = (this && this.__param) || function (paramIndex, decorator) {
|
|
|
13
13
|
import { UserLoginDto } from '../dto/userLogin-dto.js';
|
|
14
14
|
import { BaseController, BasePath, Post, Body, Ok, Get, Cookie, Unauthorized, Policy } from '@spinajs/http';
|
|
15
15
|
import { AuthProvider, SessionProvider, login, UserSession, AccessControl, _unwindGrants } from '@spinajs/rbac';
|
|
16
|
-
import { Autoinject
|
|
16
|
+
import { Autoinject } from '@spinajs/di';
|
|
17
17
|
import { AutoinjectService, Config, Configuration } from '@spinajs/configuration';
|
|
18
|
-
import { LoggedPolicy, User as UserRouteArg
|
|
18
|
+
import { LoggedPolicy, User as UserRouteArg } from '@spinajs/rbac-http';
|
|
19
19
|
import { User } from '@spinajs/rbac';
|
|
20
|
-
import { LogoutHandler } from '../logout.js';
|
|
21
20
|
/**
|
|
22
21
|
* Authentication endpoints.
|
|
23
22
|
* Handles user login, logout, and current-session inspection.
|
|
@@ -61,12 +60,6 @@ let LoginController = class LoginController extends BaseController {
|
|
|
61
60
|
];
|
|
62
61
|
let result;
|
|
63
62
|
session.Data.set('User', user.Uuid);
|
|
64
|
-
// Default active role = first role from the user's role list.
|
|
65
|
-
// Users with multiple roles can later switch via /auth/active-role.
|
|
66
|
-
const activeRole = user.Role?.[0];
|
|
67
|
-
if (activeRole) {
|
|
68
|
-
session.Data.set('ActiveRole', activeRole);
|
|
69
|
-
}
|
|
70
63
|
// we have two states for user
|
|
71
64
|
// LOGGED - when user use proper login/password and session is created
|
|
72
65
|
// AUTHORIZED - when user is atuhenticated eg. by 2fa check. If 2fa is disabled
|
|
@@ -94,12 +87,12 @@ let LoginController = class LoginController extends BaseController {
|
|
|
94
87
|
else {
|
|
95
88
|
session.Data.set('Authorized', true);
|
|
96
89
|
const grants = this.AC.getGrants();
|
|
97
|
-
const
|
|
90
|
+
const userGrants = user.Role.map(r => _unwindGrants(r, grants));
|
|
91
|
+
const combinedGrants = Object.assign({}, ...userGrants);
|
|
98
92
|
// dehydrateWithRelations({ dateTimeFormat: 'iso' }) converts DateTime to ISO strings
|
|
99
93
|
// at runtime — the ORM types don't reflect the dateTimeFormat option in generics
|
|
100
94
|
result = {
|
|
101
95
|
...user.dehydrateWithRelations({ dateTimeFormat: "iso" }),
|
|
102
|
-
ActiveRole: activeRole,
|
|
103
96
|
Grants: combinedGrants,
|
|
104
97
|
};
|
|
105
98
|
}
|
|
@@ -124,52 +117,43 @@ let LoginController = class LoginController extends BaseController {
|
|
|
124
117
|
/**
|
|
125
118
|
* Logout
|
|
126
119
|
* Destroys the current session identified by the `ssid` cookie and clears the cookie on the client.
|
|
127
|
-
* If an impersonation is active, the session is NOT destroyed — instead the
|
|
128
|
-
* impersonation is ended and the original user resumes their session.
|
|
129
120
|
* Requires the user to be logged in (session exists), but full authorization (2FA) is not required.
|
|
130
121
|
* @security cookieAuth
|
|
131
122
|
* @response 401 No active session
|
|
132
123
|
*/
|
|
133
|
-
async logout(ssid
|
|
124
|
+
async logout(ssid) {
|
|
134
125
|
if (!ssid) {
|
|
135
126
|
return new Ok();
|
|
136
127
|
}
|
|
137
|
-
|
|
138
|
-
//
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
}
|
|
154
|
-
// No handler claimed the request — should not happen as long as the
|
|
155
|
-
// default handler is registered, but return a clean response anyway.
|
|
156
|
-
return new Ok();
|
|
128
|
+
await this.SessionProvider.delete(ssid);
|
|
129
|
+
// send empty cookie to confirm session deletion
|
|
130
|
+
return new Ok(null, {
|
|
131
|
+
Coockies: [
|
|
132
|
+
{
|
|
133
|
+
Name: 'ssid',
|
|
134
|
+
Value: '',
|
|
135
|
+
Options: {
|
|
136
|
+
httpOnly: true,
|
|
137
|
+
maxAge: 0,
|
|
138
|
+
// any optopnal cookie options
|
|
139
|
+
// or override default ones
|
|
140
|
+
...this.SessionCookieConfig
|
|
141
|
+
},
|
|
142
|
+
},
|
|
143
|
+
],
|
|
144
|
+
});
|
|
157
145
|
}
|
|
158
146
|
/**
|
|
159
147
|
* Get current user
|
|
160
|
-
* Returns the user object associated with the current session
|
|
161
|
-
* currently active role and the full list of roles the user may switch to.
|
|
148
|
+
* Returns the user object associated with the current session.
|
|
162
149
|
* Requires the user to be logged in (session exists), but full authorization (2FA) is not required.
|
|
163
150
|
* @security cookieAuth
|
|
164
|
-
* @returns {
|
|
151
|
+
* @returns {IUserProfile} User data from the current session
|
|
165
152
|
* @response 401 No active session
|
|
166
153
|
*/
|
|
167
|
-
async whoami(User
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
ActiveRole: ActiveRole ?? User.Role?.[0],
|
|
171
|
-
AvailableRoles: User.Role ?? [],
|
|
172
|
-
});
|
|
154
|
+
async whoami(User) {
|
|
155
|
+
// user is taken from session data
|
|
156
|
+
return new Ok(User);
|
|
173
157
|
}
|
|
174
158
|
};
|
|
175
159
|
__decorate([
|
|
@@ -223,19 +207,16 @@ __decorate([
|
|
|
223
207
|
Get(),
|
|
224
208
|
Policy(LoggedPolicy),
|
|
225
209
|
__param(0, Cookie(true)),
|
|
226
|
-
__param(1, SessionRouteArg()),
|
|
227
|
-
__param(2, UserRouteArg()),
|
|
228
210
|
__metadata("design:type", Function),
|
|
229
|
-
__metadata("design:paramtypes", [String
|
|
211
|
+
__metadata("design:paramtypes", [String]),
|
|
230
212
|
__metadata("design:returntype", Promise)
|
|
231
213
|
], LoginController.prototype, "logout", null);
|
|
232
214
|
__decorate([
|
|
233
215
|
Get(),
|
|
234
216
|
Policy(LoggedPolicy),
|
|
235
217
|
__param(0, UserRouteArg()),
|
|
236
|
-
__param(1, FromSession()),
|
|
237
218
|
__metadata("design:type", Function),
|
|
238
|
-
__metadata("design:paramtypes", [User
|
|
219
|
+
__metadata("design:paramtypes", [User]),
|
|
239
220
|
__metadata("design:returntype", Promise)
|
|
240
221
|
], LoginController.prototype, "whoami", null);
|
|
241
222
|
LoginController = __decorate([
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"LoginController.js","sourceRoot":"","sources":["../../../src/controllers/LoginController.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,yBAAyB,CAAC;AACvD,OAAO,EAAE,cAAc,EAAE,QAAQ,EAAE,IAAI,EAAE,IAAI,EAAE,EAAE,EAAE,GAAG,EAAE,MAAM,EAAE,YAAY,EAAE,MAAM,EAAE,MAAM,eAAe,CAAC;AAC5G,OAAO,EAAE,YAAY,EAAE,eAAe,EAAE,KAAK,EAAE,WAAW,EAAE,aAAa,EAAE,aAAa,EAAE,MAAM,eAAe,CAAC;AAChH,OAAO,EAAE,U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IADZ,IAAI,EAAE;IACa,WAAA,YAAY,EAAE,CAAA;IAAgB,WAAA,MAAM,CAAC,IAAI,CAAC,CAAA;IAAgB,WAAA,IAAI,EAAE,CAAA;;qCAAzC,IAAI,UAAmD,YAAY;;4CAsG7G;AAWY;IAFZ,GAAG,EAAE;IACL,MAAM,CAAC,YAAY,CAAC;IACA,WAAA,MAAM,CAAC,IAAI,CAAC,CAAA;;;;6CAwBhC;AAYY;IAFZ,GAAG,EAAE;IACL,MAAM,CAAC,YAAY,CAAC;IACA,WAAA,YAAY,EAAE,CAAA;;qCAAO,IAAI;;6CAI7C;AApMU,eAAe;IAD3B,QAAQ,CAAC,MAAM,CAAC;GACJ,eAAe,CAqM3B"}
|
package/lib/mjs/index.d.ts
CHANGED
|
@@ -1,11 +1,6 @@
|
|
|
1
1
|
import { Bootstrapper } from '@spinajs/di';
|
|
2
2
|
export * from './controllers/LoginController.js';
|
|
3
|
-
export * from './controllers/ActiveRoleController.js';
|
|
4
|
-
export * from './controllers/ImpersonationController.js';
|
|
5
3
|
export * from './controllers/UserController.js';
|
|
6
|
-
export * from './logout.js';
|
|
7
|
-
export * from './handlers/ImpersonationLogoutHandler.js';
|
|
8
|
-
export * from './handlers/DefaultLogoutHandler.js';
|
|
9
4
|
export * from './controllers/UserMetadataController.js';
|
|
10
5
|
export * from "./controllers/TwoFactorAuthController.js";
|
|
11
6
|
export * from "./cli/EnableUser2Fa.js";
|
package/lib/mjs/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAc,MAAM,aAAa,CAAC;AAIvD,cAAc,kCAAkC,CAAC;AACjD,cAAc,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAc,MAAM,aAAa,CAAC;AAIvD,cAAc,kCAAkC,CAAC;AACjD,cAAc,iCAAiC,CAAC;AAChD,cAAc,yCAAyC,CAAC;AACxD,cAAc,0CAA0C,CAAC;AAEzD,cAAc,wBAAwB,CAAC;AACvC,cAAc,0BAA0B,CAAC;AAEzC,cAAc,kBAAkB,CAAC;AAGjC,qBACa,wBAAyB,SAAQ,YAAY;IAC/C,SAAS,IAAI,IAAI;CAO3B"}
|
package/lib/mjs/index.js
CHANGED
|
@@ -8,12 +8,7 @@ import { Bootstrapper, Injectable } from '@spinajs/di';
|
|
|
8
8
|
import { UserMetadataBase } from '@spinajs/rbac';
|
|
9
9
|
import { TWO_FA_METATADATA_KEYS } from './2fa/Default2FaToken.js';
|
|
10
10
|
export * from './controllers/LoginController.js';
|
|
11
|
-
export * from './controllers/ActiveRoleController.js';
|
|
12
|
-
export * from './controllers/ImpersonationController.js';
|
|
13
11
|
export * from './controllers/UserController.js';
|
|
14
|
-
export * from './logout.js';
|
|
15
|
-
export * from './handlers/ImpersonationLogoutHandler.js';
|
|
16
|
-
export * from './handlers/DefaultLogoutHandler.js';
|
|
17
12
|
export * from './controllers/UserMetadataController.js';
|
|
18
13
|
export * from "./controllers/TwoFactorAuthController.js";
|
|
19
14
|
export * from "./cli/EnableUser2Fa.js";
|
package/lib/mjs/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":";;;;;;AAAA,OAAO,EAAE,YAAY,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AACvD,OAAO,EAAE,gBAAgB,EAAE,MAAM,eAAe,CAAC;AACjD,OAAO,EAAE,sBAAsB,EAAE,MAAM,0BAA0B,CAAC;AAElE,cAAc,kCAAkC,CAAC;AACjD,cAAc,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":";;;;;;AAAA,OAAO,EAAE,YAAY,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AACvD,OAAO,EAAE,gBAAgB,EAAE,MAAM,eAAe,CAAC;AACjD,OAAO,EAAE,sBAAsB,EAAE,MAAM,0BAA0B,CAAC;AAElE,cAAc,kCAAkC,CAAC;AACjD,cAAc,iCAAiC,CAAC;AAChD,cAAc,yCAAyC,CAAC;AACxD,cAAc,0CAA0C,CAAC;AAEzD,cAAc,wBAAwB,CAAC;AACvC,cAAc,0BAA0B,CAAC;AAEzC,cAAc,kBAAkB,CAAC;AAI1B,IAAM,wBAAwB,GAA9B,MAAM,wBAAyB,SAAQ,YAAY;IAC/C,SAAS;QACZ,gBAAgB,CAAC,WAAW,GAAG;YAC3B,GAAG,gBAAgB,CAAC,WAAW;YAC/B,sBAAsB,CAAC,KAAK;YAC5B,sBAAsB,CAAC,GAAG;SAC7B,CAAA;IACL,CAAC;CACJ,CAAA;AARY,wBAAwB;IADpC,UAAU,CAAC,YAAY,CAAC;GACZ,wBAAwB,CAQpC"}
|