Преглед изворни кода

Adds exception for preventing to send the JWT token

master
hristoterezov пре 9 година
родитељ
комит
c5eebcda98
1 измењених фајлова са 7 додато и 3 уклоњено
  1. 7
    3
      modules/TokenData/TokenData.js

+ 7
- 3
modules/TokenData/TokenData.js Прегледај датотеку

67
     constructor(jwt) {
67
     constructor(jwt) {
68
         if(!jwt)
68
         if(!jwt)
69
             return;
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
         this.jwt = jwt;
71
         this.jwt = jwt;
74
 
72
 
75
         //External API settings
73
         //External API settings
77
             enablePostis: true
75
             enablePostis: true
78
         };
76
         };
79
         this._decode();
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
     /**

Loading…
Откажи
Сачувај