Pārlūkot izejas kodu

Adds exception for preventing to send the JWT token

j8
hristoterezov 9 gadus atpakaļ
vecāks
revīzija
c5eebcda98
1 mainītis faili ar 7 papildinājumiem un 3 dzēšanām
  1. 7
    3
      modules/TokenData/TokenData.js

+ 7
- 3
modules/TokenData/TokenData.js Parādīt failu

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
     /**

Notiek ielāde…
Atcelt
Saglabāt