@wbce-d9/api 9.27.0 → 9.29.0
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.
|
@@ -13,6 +13,7 @@ export declare class OpenIDAuthDriver extends LocalAuthDriver {
|
|
|
13
13
|
generateAuthUrl(codeVerifier: string, prompt?: boolean): Promise<string>;
|
|
14
14
|
private fetchUserId;
|
|
15
15
|
getUserID(payload: Record<string, any>): Promise<string>;
|
|
16
|
+
logout(user: User): Promise<void>;
|
|
16
17
|
login(user: User): Promise<void>;
|
|
17
18
|
refresh(user: User): Promise<void>;
|
|
18
19
|
}
|
|
@@ -170,6 +170,30 @@ export class OpenIDAuthDriver extends LocalAuthDriver {
|
|
|
170
170
|
}
|
|
171
171
|
return (await this.fetchUserId(identifier));
|
|
172
172
|
}
|
|
173
|
+
async logout(user) {
|
|
174
|
+
let authData = user.auth_data;
|
|
175
|
+
if (typeof authData === 'string') {
|
|
176
|
+
try {
|
|
177
|
+
authData = parseJSON(authData);
|
|
178
|
+
}
|
|
179
|
+
catch {
|
|
180
|
+
logger.warn(`[OpenID] Session data isn't valid JSON: ${authData}`);
|
|
181
|
+
}
|
|
182
|
+
}
|
|
183
|
+
if (authData?.['refreshToken']) {
|
|
184
|
+
try {
|
|
185
|
+
const client = await this.client;
|
|
186
|
+
await client.revoke(authData['refreshToken']);
|
|
187
|
+
await this.usersService.updateOne(user.id, {
|
|
188
|
+
auth_data: null,
|
|
189
|
+
});
|
|
190
|
+
logger.info(`[OpenID] Session closed for user.`);
|
|
191
|
+
}
|
|
192
|
+
catch (e) {
|
|
193
|
+
throw handleError(e);
|
|
194
|
+
}
|
|
195
|
+
}
|
|
196
|
+
}
|
|
173
197
|
async login(user) {
|
|
174
198
|
return this.refresh(user);
|
|
175
199
|
}
|
|
@@ -195,6 +219,12 @@ export class OpenIDAuthDriver extends LocalAuthDriver {
|
|
|
195
219
|
}
|
|
196
220
|
}
|
|
197
221
|
catch (e) {
|
|
222
|
+
if (e.error === 'invalid_grant') {
|
|
223
|
+
// Remove invalid token from the user store
|
|
224
|
+
await this.usersService.updateOne(user.id, {
|
|
225
|
+
auth_data: null,
|
|
226
|
+
});
|
|
227
|
+
}
|
|
198
228
|
throw handleError(e);
|
|
199
229
|
}
|
|
200
230
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@wbce-d9/api",
|
|
3
|
-
"version": "9.
|
|
3
|
+
"version": "9.29.0",
|
|
4
4
|
"description": "Directus is a real-time API and App dashboard for managing SQL database content",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"keywords": [
|
|
@@ -143,20 +143,20 @@
|
|
|
143
143
|
"uuid-validate": "0.0.3",
|
|
144
144
|
"vm2": "^3.9.19",
|
|
145
145
|
"wellknown": "0.5.0",
|
|
146
|
-
"@wbce-d9/app": "9.
|
|
147
|
-
"@wbce-d9/exceptions": "9.26.3",
|
|
148
|
-
"@wbce-d9/extensions-sdk": "9.26.5",
|
|
146
|
+
"@wbce-d9/app": "9.29.0",
|
|
149
147
|
"@wbce-d9/constants": "9.26.3",
|
|
150
148
|
"@wbce-d9/schema": "9.26.3",
|
|
151
|
-
"@wbce-d9/
|
|
149
|
+
"@wbce-d9/extensions-sdk": "9.26.5",
|
|
150
|
+
"@wbce-d9/exceptions": "9.26.3",
|
|
152
151
|
"@wbce-d9/specs": "9.26.3",
|
|
152
|
+
"@wbce-d9/storage": "9.26.3",
|
|
153
|
+
"@wbce-d9/storage-driver-azure": "9.26.5",
|
|
153
154
|
"@wbce-d9/storage-driver-cloudinary": "9.26.5",
|
|
154
155
|
"@wbce-d9/storage-driver-gcs": "9.26.5",
|
|
155
156
|
"@wbce-d9/storage-driver-local": "9.26.5",
|
|
156
|
-
"@wbce-d9/
|
|
157
|
+
"@wbce-d9/utils": "9.28.0",
|
|
157
158
|
"@wbce-d9/storage-driver-s3": "9.26.7",
|
|
158
|
-
"@wbce-d9/update-check": "9.26.3"
|
|
159
|
-
"@wbce-d9/utils": "9.28.0"
|
|
159
|
+
"@wbce-d9/update-check": "9.26.3"
|
|
160
160
|
},
|
|
161
161
|
"devDependencies": {
|
|
162
162
|
"@ngneat/falso": "6.4.0",
|