From 152cb381ea2c915c762416092337ce1d8589d1c6 Mon Sep 17 00:00:00 2001 From: Aijana Schumann Date: Mon, 6 Dec 2021 15:09:15 +0100 Subject: 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 Change-Id: I21137756b204287e25766a9646bf2faf7bad9d35 --- .../odlux/framework/src/models/authentication.ts | 28 +++++++++++++++++++++- 1 file changed, 27 insertions(+), 1 deletion(-) (limited to 'sdnr/wt/odlux/framework/src/models/authentication.ts') 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() { -- cgit 1.2.3-korg