nodecommons-security
Advanced tools
Comparing version 3.0.2 to 3.1.0
@@ -6,5 +6,5 @@ import { ICommonsSession } from 'tscommons-session'; | ||
private pepper?; | ||
constructor(pepper?: string | undefined, allowMultipleSessionsForSameUser?: boolean); | ||
constructor(pepper?: string | undefined, allowMultipleSessionsForSameUser?: boolean, isEqualSubCheck?: (a: T, b: T) => boolean); | ||
generatePwHash(pw: string, salt: string): string; | ||
authenticateWithPwHash(user: T, pw: string): ICommonsSession<T> | undefined; | ||
} |
@@ -6,4 +6,4 @@ "use strict"; | ||
class CommonsUserPwHashSessionService extends commons_user_session_service_1.CommonsUserSessionService { | ||
constructor(pepper, allowMultipleSessionsForSameUser = false) { | ||
super(allowMultipleSessionsForSameUser); | ||
constructor(pepper, allowMultipleSessionsForSameUser = false, isEqualSubCheck) { | ||
super(allowMultipleSessionsForSameUser, isEqualSubCheck); | ||
this.pepper = pepper; | ||
@@ -10,0 +10,0 @@ } |
@@ -5,3 +5,4 @@ import { ICommonsSession } from 'tscommons-session'; | ||
export declare abstract class CommonsUserSessionService<T extends ICommonsUser> extends CommonsSessionService<T> { | ||
constructor(allowMultipleSessionsForSameUser?: boolean); | ||
private isEqualSubCheck?; | ||
constructor(allowMultipleSessionsForSameUser?: boolean, isEqualSubCheck?: ((a: T, b: T) => boolean) | undefined); | ||
protected isEqual(a: T, b: T): boolean; | ||
@@ -8,0 +9,0 @@ protected isStillValid(user: T): Promise<boolean>; |
@@ -14,10 +14,11 @@ "use strict"; | ||
class CommonsUserSessionService extends commons_session_service_1.CommonsSessionService { | ||
constructor(allowMultipleSessionsForSameUser = false) { | ||
constructor(allowMultipleSessionsForSameUser = false, isEqualSubCheck) { | ||
super(allowMultipleSessionsForSameUser); | ||
this.isEqualSubCheck = isEqualSubCheck; | ||
} | ||
isEqual(a, b) { | ||
if (a.namespace !== b.namespace) | ||
return false; | ||
if (a.username !== b.username) | ||
return false; | ||
if (this.isEqualSubCheck && !this.isEqualSubCheck(a, b)) | ||
return false; | ||
return true; | ||
@@ -24,0 +25,0 @@ } |
{ | ||
"name": "nodecommons-security", | ||
"version": "3.0.2", | ||
"version": "3.1.0", | ||
"description": "", | ||
@@ -14,4 +14,4 @@ "scripts": { | ||
"@types/node": "^13.13.4", | ||
"tscommons-core": "^2.0.0", | ||
"tscommons-session": "0.0.5" | ||
"tscommons-core": "^2.4.1", | ||
"tscommons-session": "1.0.0" | ||
}, | ||
@@ -18,0 +18,0 @@ "files": [ |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
17332
263
+ Addedtscommons-session@1.0.0(transitive)
- Removedtscommons-session@0.0.5(transitive)
Updatedtscommons-core@^2.4.1
Updatedtscommons-session@1.0.0