generated from aichner/react-mdb-template
-
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Now the cookie token handling takes place in a own session which can be extended.
- Loading branch information
Showing
1 changed file
with
31 additions
and
16 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -63,31 +63,19 @@ class GithubSession extends Session { | |
} | ||
} | ||
|
||
/** @class A SNEK SubSession */ | ||
class SnekSession extends Session { | ||
/** @class CookieSession extends token session handling with cookies */ | ||
class CookieSession extends Session { | ||
refreshTokenName: string = "refresh"; | ||
/* Define tasks */ | ||
public tasks: SnekTasks; | ||
|
||
/** | ||
* Initializes a SNEK session. | ||
* Initializes a cookie session. | ||
* | ||
* @constructor | ||
* @author Nico Schett <[email protected]> | ||
* @param {string} sId A session name | ||
* @param {Endpoint} ep A endpoint | ||
* @param {SnekTemplate} template A template set | ||
*/ | ||
constructor( | ||
sId: string, | ||
public ep: ApolloEndpoint, | ||
public template: SnekTemplate | ||
) { | ||
constructor(sId: string) { | ||
super(sId); | ||
|
||
this.tokenName = sId + "-" + this.tokenName; | ||
this.refreshTokenName = sId + "-" + this.refreshTokenName; | ||
this.tasks = new SnekTasks(this); | ||
} | ||
|
||
//> Getter | ||
|
@@ -149,6 +137,33 @@ class SnekSession extends Session { | |
Cookies.remove(this.refreshTokenName); | ||
} | ||
} | ||
} | ||
|
||
/** @class A SNEK SubSession */ | ||
class SnekSession extends CookieSession { | ||
/* Define tasks */ | ||
public tasks: SnekTasks; | ||
|
||
/** | ||
* Initializes a SNEK session. | ||
* | ||
* @constructor | ||
* @author Nico Schett <[email protected]> | ||
* @param {string} sId A session name | ||
* @param {Endpoint} ep A endpoint | ||
* @param {SnekTemplate} template A template set | ||
*/ | ||
constructor( | ||
sId: string, | ||
public ep: ApolloEndpoint, | ||
public template: SnekTemplate | ||
) { | ||
super(sId); | ||
|
||
this.tokenName = sId + "-" + this.tokenName; | ||
this.refreshTokenName = sId + "-" + this.refreshTokenName; | ||
this.tasks = new SnekTasks(this); | ||
} | ||
|
||
//> Methods | ||
/** | ||
|