not-node 6.0.1 → 6.0.2
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/package.json
CHANGED
package/src/identity/identity.js
CHANGED
|
@@ -23,6 +23,8 @@ module.exports = class IdentityProviderToken {
|
|
|
23
23
|
|
|
24
24
|
constructor(req) {
|
|
25
25
|
this.req = req;
|
|
26
|
+
this.#extractToken(req);
|
|
27
|
+
this.#extractTokenContent();
|
|
26
28
|
return this;
|
|
27
29
|
}
|
|
28
30
|
|
|
@@ -30,13 +32,14 @@ module.exports = class IdentityProviderToken {
|
|
|
30
32
|
const auth = req.get("Authorization");
|
|
31
33
|
if (auth && auth.length) {
|
|
32
34
|
const [, token] = auth.split(" ");
|
|
35
|
+
console.log("token found", token);
|
|
33
36
|
return token;
|
|
34
37
|
}
|
|
35
38
|
return null;
|
|
36
39
|
}
|
|
37
40
|
|
|
38
41
|
#extractToken(req) {
|
|
39
|
-
const token =
|
|
42
|
+
const token = IdentityProviderToken.getTokenFromRequest(req);
|
|
40
43
|
if (token) {
|
|
41
44
|
this.#token = token;
|
|
42
45
|
}
|
|
@@ -50,7 +53,7 @@ module.exports = class IdentityProviderToken {
|
|
|
50
53
|
#decodeTokenContent() {
|
|
51
54
|
try {
|
|
52
55
|
if (this.#token) {
|
|
53
|
-
const secret =
|
|
56
|
+
const secret = IdentityProviderToken.#getOptions().secret;
|
|
54
57
|
JWT.verify(this.#token, secret);
|
|
55
58
|
return JWT.decode(this.#token, secret);
|
|
56
59
|
}
|
|
@@ -64,7 +67,7 @@ module.exports = class IdentityProviderToken {
|
|
|
64
67
|
#encodeTokenContent() {
|
|
65
68
|
try {
|
|
66
69
|
if (this.#token) {
|
|
67
|
-
const secret =
|
|
70
|
+
const secret = IdentityProviderToken.#getOptions().secret;
|
|
68
71
|
return JWT.sign(this.#tokenContent, secret);
|
|
69
72
|
}
|
|
70
73
|
return null;
|