summaryrefslogtreecommitdiffstats
path: root/sdnr/wt/odlux/framework/src/models/authentication.ts
diff options
context:
space:
mode:
authorAijana Schumann <aijana.schumann@highstreet-technologies.com>2021-12-06 15:09:15 +0100
committerAijana Schumann <aijana.schumann@highstreet-technologies.com>2021-12-06 15:12:24 +0100
commit152cb381ea2c915c762416092337ce1d8589d1c6 (patch)
tree63b71c8343f9292281f5d7f5eac14342fec06402 /sdnr/wt/odlux/framework/src/models/authentication.ts
parent8ea94e1210671b941f84abfe16e248cfa086fe49 (diff)
Update ODLUX
Update login view, add logout after user session ends, add user settings, several bugfixes Issue-ID: CCSDK-3540 Signed-off-by: Aijana Schumann <aijana.schumann@highstreet-technologies.com> Change-Id: I21137756b204287e25766a9646bf2faf7bad9d35
Diffstat (limited to 'sdnr/wt/odlux/framework/src/models/authentication.ts')
-rw-r--r--sdnr/wt/odlux/framework/src/models/authentication.ts28
1 files changed, 27 insertions, 1 deletions
diff --git a/sdnr/wt/odlux/framework/src/models/authentication.ts b/sdnr/wt/odlux/framework/src/models/authentication.ts
index b6840a0ce..f56538184 100644
--- a/sdnr/wt/odlux/framework/src/models/authentication.ts
+++ b/sdnr/wt/odlux/framework/src/models/authentication.ts
@@ -20,7 +20,19 @@ export type AuthToken = {
username: string;
access_token: string;
token_type: string;
+ /***
+ * datetime the token should expire in unix timestamp
+ *
+ * must be in seconds
+ */
expires: number;
+ /***
+ * time the token was issued in unix timestamp
+ *
+ * must be in seconds
+ *
+ */
+ issued: number;
}
export type AuthPolicy = {
@@ -52,8 +64,22 @@ export class User {
return this._bearerToken && this._bearerToken.token_type;
}
+ /***
+ * Time the user should be logged out, in unix timestamp in seconds
+ */
+ public get logoutAt(): number{
+ return this._bearerToken && this._bearerToken.expires;
+ }
+
+ /***
+ * Time the user logged in, in unix timestamp in seconds
+ */
+ public get loginAt(): number{
+ return this._bearerToken && this._bearerToken.issued;
+ }
+
public get isValid(): boolean {
- return (this._bearerToken && (new Date().valueOf()) < this._bearerToken.expires) || false;
+ return (this._bearerToken && (new Date().valueOf()) < this._bearerToken.expires*1000) || false;
}
public toString() {