Parcourir la source

Adds exception for preventing to send the JWT token

j8
hristoterezov il y a 9 ans
Parent
révision
c5eebcda98
1 fichiers modifiés avec 7 ajouts et 3 suppressions
  1. 7
    3
      modules/TokenData/TokenData.js

+ 7
- 3
modules/TokenData/TokenData.js Voir le fichier

@@ -67,9 +67,7 @@ class TokenData{
67 67
     constructor(jwt) {
68 68
         if(!jwt)
69 69
             return;
70
-        //Use jwt param as token if there is not other token set
71
-        if(!config.token)
72
-            config.token = jwt;
70
+
73 71
         this.jwt = jwt;
74 72
 
75 73
         //External API settings
@@ -77,6 +75,12 @@ class TokenData{
77 75
             enablePostis: true
78 76
         };
79 77
         this._decode();
78
+        // Use JWT param as token if there is not other token set and if the
79
+        // iss field is not anonymous. If you want to pass data with JWT token
80
+        // but you don't want to pass the JWT token for verification the iss
81
+        // field should be set to "anonymous"
82
+        if(!config.token && this.payload && this.payload.iss !== "anonymous")
83
+            config.token = jwt;
80 84
     }
81 85
 
82 86
     /**

Chargement…
Annuler
Enregistrer