@trudb/tru-common-lib 0.0.723 → 0.0.725
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/esm2020/lib/components/login/classes/tru-auth-config.mjs +1 -1
- package/esm2020/lib/components/login/classes/tru-auth-jwt-strategy.mjs +6 -5
- package/esm2020/lib/components/login/classes/tru-auth-session-strategy.mjs +4 -2
- package/esm2020/lib/components/login/services/tru-auth.mjs +12 -7
- package/fesm2015/trudb-tru-common-lib.mjs +17 -11
- package/fesm2015/trudb-tru-common-lib.mjs.map +1 -1
- package/fesm2020/trudb-tru-common-lib.mjs +17 -11
- package/fesm2020/trudb-tru-common-lib.mjs.map +1 -1
- package/lib/components/login/classes/tru-auth-config.d.ts +2 -1
- package/lib/components/login/classes/tru-auth-jwt-strategy.d.ts +2 -1
- package/lib/components/login/classes/tru-auth-session-strategy.d.ts +2 -1
- package/package.json +1 -1
|
@@ -3726,7 +3726,7 @@ class TruAuth {
|
|
|
3726
3726
|
}));
|
|
3727
3727
|
}
|
|
3728
3728
|
setUser() {
|
|
3729
|
-
this.auth.
|
|
3729
|
+
this.auth.createUser(this.user);
|
|
3730
3730
|
}
|
|
3731
3731
|
logout() {
|
|
3732
3732
|
this.http
|
|
@@ -3735,11 +3735,16 @@ class TruAuth {
|
|
|
3735
3735
|
});
|
|
3736
3736
|
}
|
|
3737
3737
|
userClaims() {
|
|
3738
|
-
|
|
3739
|
-
|
|
3740
|
-
|
|
3741
|
-
|
|
3742
|
-
|
|
3738
|
+
if (this.appEnvironment.authType === 'session') {
|
|
3739
|
+
return this.http
|
|
3740
|
+
.get(`${this.baseUrl}${TRU_AUTH_CONFIG.authUrl}/userClaims`)
|
|
3741
|
+
.pipe(tap((userClaims) => {
|
|
3742
|
+
this.user.create(userClaims);
|
|
3743
|
+
}));
|
|
3744
|
+
}
|
|
3745
|
+
else {
|
|
3746
|
+
return this.auth.createUser(this.user);
|
|
3747
|
+
}
|
|
3743
3748
|
}
|
|
3744
3749
|
get isLoggedIn() {
|
|
3745
3750
|
if (!this.loggedIn.value) {
|
|
@@ -5996,7 +6001,7 @@ class TruAuthJwtStrategy {
|
|
|
5996
6001
|
isLoggedIn() {
|
|
5997
6002
|
return !!this.getJwtToken();
|
|
5998
6003
|
}
|
|
5999
|
-
|
|
6004
|
+
createUser(user) {
|
|
6000
6005
|
let jwtData = this.getDecodedJwtJsonData();
|
|
6001
6006
|
console.log(jwtData);
|
|
6002
6007
|
let userData = {
|
|
@@ -6007,7 +6012,7 @@ class TruAuthJwtStrategy {
|
|
|
6007
6012
|
username: jwtData['http://schemas.xmlsoap.org/ws/2005/05/identity/claims/name'],
|
|
6008
6013
|
roles: jwtData['http://schemas.microsoft.com/ws/2008/06/identity/claims/role']
|
|
6009
6014
|
};
|
|
6010
|
-
user.create(userData);
|
|
6015
|
+
return of(user.create(userData));
|
|
6011
6016
|
}
|
|
6012
6017
|
getJwtToken() {
|
|
6013
6018
|
try {
|
|
@@ -6018,7 +6023,7 @@ class TruAuthJwtStrategy {
|
|
|
6018
6023
|
}
|
|
6019
6024
|
}
|
|
6020
6025
|
getDecodedJwtJsonData() {
|
|
6021
|
-
let token =
|
|
6026
|
+
let token = this.getJwtToken();
|
|
6022
6027
|
let payload = {};
|
|
6023
6028
|
if (token && token !== "undefined") {
|
|
6024
6029
|
const encodedPayload = token.split(".")[1];
|
|
@@ -6028,7 +6033,7 @@ class TruAuthJwtStrategy {
|
|
|
6028
6033
|
return payload;
|
|
6029
6034
|
}
|
|
6030
6035
|
getToken() {
|
|
6031
|
-
var token =
|
|
6036
|
+
var token = this.getJwtToken();
|
|
6032
6037
|
if (token && token !== "undefined") {
|
|
6033
6038
|
const encodedPayload = token.split(".")[1];
|
|
6034
6039
|
const payloadStr = window.atob(encodedPayload);
|
|
@@ -6090,7 +6095,8 @@ class TruAuthSessionStrategy {
|
|
|
6090
6095
|
doLogoutUser() {
|
|
6091
6096
|
this.loggedUser = undefined;
|
|
6092
6097
|
}
|
|
6093
|
-
|
|
6098
|
+
createUser(user) {
|
|
6099
|
+
return of({});
|
|
6094
6100
|
}
|
|
6095
6101
|
isLoggedIn() {
|
|
6096
6102
|
return false; //todo, implement this
|