5htp-core 0.3.6-7 → 0.3.6-8

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "5htp-core",
3
3
  "description": "Convenient TypeScript framework designed for Performance and Productivity.",
4
- "version": "0.3.6-7",
4
+ "version": "0.3.6-8",
5
5
  "author": "Gaetan Le Gac (https://github.com/gaetanlegac)",
6
6
  "repository": "git://github.com/gaetanlegac/5htp-core.git",
7
7
  "license": "MIT",
@@ -93,7 +93,7 @@ export default abstract class UsersManagementService<
93
93
  ----------------------------------*/
94
94
 
95
95
  public abstract login( ...args: any[] ): Promise<{ user: TUser, token: string }>;
96
- public abstract decodeSession( jwt: TJwtSession, req: THttpRequest ): Promise<TUser>;
96
+ public abstract decodeSession( jwt: TJwtSession, req: THttpRequest ): Promise<TUser | null>;
97
97
 
98
98
  protected abstract displayName(user?: TUser | null): string;
99
99
  protected abstract displaySessionName(session: TJwtSession): string;
@@ -134,6 +134,11 @@ export default abstract class UsersManagementService<
134
134
  // Deserialize full user data
135
135
  this.config.debug && console.log(LogPrefix, `Deserialize user ${sessionName}`);
136
136
  const user = await this.decodeSession(session, req);
137
+
138
+ // User not found
139
+ if (user === null)
140
+ return null;
141
+
137
142
  this.config.debug && console.log(LogPrefix, `Deserialized user ${sessionName}:`, this.displayName(user));
138
143
 
139
144
  return {