@digipair/skill-keycloak 0.48.3 → 0.49.0
Sign up to get free protection for your applications and to get access to all the features.
- package/index.cjs.js +10 -5
- package/index.esm.js +15 -10
- package/package.json +1 -1
package/index.cjs.js
CHANGED
@@ -5629,8 +5629,10 @@ let KeycloakService = class KeycloakService {
|
|
5629
5629
|
});
|
5630
5630
|
return pinsSettings;
|
5631
5631
|
}
|
5632
|
-
async decodedToken(url, realm, token) {
|
5633
|
-
const response = await fetch(`${url}/realms/${realm}/protocol/openid-connect/certs
|
5632
|
+
async decodedToken(url, realm, token, signal) {
|
5633
|
+
const response = await fetch(`${url}/realms/${realm}/protocol/openid-connect/certs`, {
|
5634
|
+
signal
|
5635
|
+
});
|
5634
5636
|
const infos = await response.json();
|
5635
5637
|
const publicKey = `-----BEGIN CERTIFICATE-----\n${infos.keys.find(({ alg })=>alg === 'RS256').x5c[0]}\n-----END CERTIFICATE-----`;
|
5636
5638
|
const decodedtoken = jsonwebtoken.verify(token, publicKey, {
|
@@ -5689,9 +5691,10 @@ let KeycloakService = class KeycloakService {
|
|
5689
5691
|
const pinsSettingsList = ((_pinsSettings_properties = pinsSettings.properties) == null ? void 0 : _pinsSettings_properties['execute']) || [];
|
5690
5692
|
const token = /^Bearer /g.test(context.request.headers.authorization) && ((_context_request_headers_authorization = context.request.headers.authorization) == null ? void 0 : _context_request_headers_authorization.replace(/^Bearer /g, ''));
|
5691
5693
|
if (token) {
|
5694
|
+
var _context_protected;
|
5692
5695
|
context.keycloak = {
|
5693
5696
|
isLogged: true,
|
5694
|
-
decodedToken: await this.decodedToken(url, realm, context.request.headers.authorization.replace(/^Bearer /, ''))
|
5697
|
+
decodedToken: await this.decodedToken(url, realm, context.request.headers.authorization.replace(/^Bearer /, ''), (_context_protected = context.protected) == null ? void 0 : _context_protected.signal)
|
5695
5698
|
};
|
5696
5699
|
} else {
|
5697
5700
|
context.keycloak = {
|
@@ -5810,9 +5813,10 @@ let KeycloakService = class KeycloakService {
|
|
5810
5813
|
const { execute, secured = true, url = context.privates.KEYCLOAK_URL, realm = context.privates.KEYCLOAK_REALM } = params;
|
5811
5814
|
const token = /^Bearer /g.test(context.request.headers.authorization) && ((_context_request_headers_authorization = context.request.headers.authorization) == null ? void 0 : _context_request_headers_authorization.replace(/^Bearer /g, ''));
|
5812
5815
|
if (token) {
|
5816
|
+
var _context_protected;
|
5813
5817
|
context.keycloak = {
|
5814
5818
|
isLogged: true,
|
5815
|
-
decodedToken: await this.decodedToken(url, realm, context.request.headers.authorization.replace(/^Bearer /, ''))
|
5819
|
+
decodedToken: await this.decodedToken(url, realm, context.request.headers.authorization.replace(/^Bearer /, ''), (_context_protected = context.protected) == null ? void 0 : _context_protected.signal)
|
5816
5820
|
};
|
5817
5821
|
} else {
|
5818
5822
|
context.keycloak = {
|
@@ -5834,9 +5838,10 @@ let KeycloakService = class KeycloakService {
|
|
5834
5838
|
const { steps, secured = true, url = context.privates.KEYCLOAK_URL, realm = context.privates.KEYCLOAK_REALM } = params;
|
5835
5839
|
const token = /^Bearer /g.test(context.request.headers.authorization) && ((_context_request_headers_authorization = context.request.headers.authorization) == null ? void 0 : _context_request_headers_authorization.replace(/^Bearer /g, ''));
|
5836
5840
|
if (token) {
|
5841
|
+
var _context_protected;
|
5837
5842
|
context.keycloak = {
|
5838
5843
|
isLogged: true,
|
5839
|
-
decodedToken: await this.decodedToken(url, realm, context.request.headers.authorization.replace(/^Bearer /, ''))
|
5844
|
+
decodedToken: await this.decodedToken(url, realm, context.request.headers.authorization.replace(/^Bearer /, ''), (_context_protected = context.protected) == null ? void 0 : _context_protected.signal)
|
5840
5845
|
};
|
5841
5846
|
} else {
|
5842
5847
|
context.keycloak = {
|
package/index.esm.js
CHANGED
@@ -23905,14 +23905,14 @@ function indent(str, spaces) {
|
|
23905
23905
|
var match = parseIdentifier(input, i1, namePart) || namePart && parseAdditionalSymbol(input, i1) || maybeSpace && parseSpaces(input, i1);
|
23906
23906
|
// match is required
|
23907
23907
|
if (!match) {
|
23908
|
-
return i = i1,
|
23908
|
+
return i = i1, tokens = tokens1, nextMatch = nextMatch1, {
|
23909
23909
|
v: nextMatch1
|
23910
23910
|
};
|
23911
23911
|
}
|
23912
23912
|
var token = match.token, offset = match.offset;
|
23913
23913
|
i1 += offset;
|
23914
23914
|
if (token === " ") {
|
23915
|
-
return i = i1,
|
23915
|
+
return i = i1, tokens = tokens1, nextMatch = nextMatch1, "continue";
|
23916
23916
|
}
|
23917
23917
|
tokens1 = _to_consumable_array$3(tokens1).concat([
|
23918
23918
|
token
|
@@ -23931,7 +23931,7 @@ function indent(str, spaces) {
|
|
23931
23931
|
if (contextKeys.some(function(el) {
|
23932
23932
|
return el.startsWith(name);
|
23933
23933
|
})) {
|
23934
|
-
return i = i1,
|
23934
|
+
return i = i1, tokens = tokens1, nextMatch = nextMatch1, "continue";
|
23935
23935
|
}
|
23936
23936
|
if (dateTimeIdentifiers.some(function(el) {
|
23937
23937
|
return el === name;
|
@@ -23950,9 +23950,9 @@ function indent(str, spaces) {
|
|
23950
23950
|
if (dateTimeIdentifiers.some(function(el) {
|
23951
23951
|
return el.startsWith(name);
|
23952
23952
|
})) {
|
23953
|
-
return i = i1,
|
23953
|
+
return i = i1, tokens = tokens1, nextMatch = nextMatch1, "continue";
|
23954
23954
|
}
|
23955
|
-
return i = i1,
|
23955
|
+
return i = i1, tokens = tokens1, nextMatch = nextMatch1, {
|
23956
23956
|
v: nextMatch1
|
23957
23957
|
};
|
23958
23958
|
};
|
@@ -33629,8 +33629,10 @@ let KeycloakService = class KeycloakService {
|
|
33629
33629
|
});
|
33630
33630
|
return pinsSettings;
|
33631
33631
|
}
|
33632
|
-
async decodedToken(url, realm, token) {
|
33633
|
-
const response = await fetch(`${url}/realms/${realm}/protocol/openid-connect/certs
|
33632
|
+
async decodedToken(url, realm, token, signal) {
|
33633
|
+
const response = await fetch(`${url}/realms/${realm}/protocol/openid-connect/certs`, {
|
33634
|
+
signal
|
33635
|
+
});
|
33634
33636
|
const infos = await response.json();
|
33635
33637
|
const publicKey = `-----BEGIN CERTIFICATE-----\n${infos.keys.find(({ alg })=>alg === 'RS256').x5c[0]}\n-----END CERTIFICATE-----`;
|
33636
33638
|
const decodedtoken = jsonwebtoken.verify(token, publicKey, {
|
@@ -33689,9 +33691,10 @@ let KeycloakService = class KeycloakService {
|
|
33689
33691
|
const pinsSettingsList = ((_pinsSettings_properties = pinsSettings.properties) == null ? void 0 : _pinsSettings_properties['execute']) || [];
|
33690
33692
|
const token = /^Bearer /g.test(context.request.headers.authorization) && ((_context_request_headers_authorization = context.request.headers.authorization) == null ? void 0 : _context_request_headers_authorization.replace(/^Bearer /g, ''));
|
33691
33693
|
if (token) {
|
33694
|
+
var _context_protected;
|
33692
33695
|
context.keycloak = {
|
33693
33696
|
isLogged: true,
|
33694
|
-
decodedToken: await this.decodedToken(url, realm, context.request.headers.authorization.replace(/^Bearer /, ''))
|
33697
|
+
decodedToken: await this.decodedToken(url, realm, context.request.headers.authorization.replace(/^Bearer /, ''), (_context_protected = context.protected) == null ? void 0 : _context_protected.signal)
|
33695
33698
|
};
|
33696
33699
|
} else {
|
33697
33700
|
context.keycloak = {
|
@@ -33810,9 +33813,10 @@ let KeycloakService = class KeycloakService {
|
|
33810
33813
|
const { execute, secured = true, url = context.privates.KEYCLOAK_URL, realm = context.privates.KEYCLOAK_REALM } = params;
|
33811
33814
|
const token = /^Bearer /g.test(context.request.headers.authorization) && ((_context_request_headers_authorization = context.request.headers.authorization) == null ? void 0 : _context_request_headers_authorization.replace(/^Bearer /g, ''));
|
33812
33815
|
if (token) {
|
33816
|
+
var _context_protected;
|
33813
33817
|
context.keycloak = {
|
33814
33818
|
isLogged: true,
|
33815
|
-
decodedToken: await this.decodedToken(url, realm, context.request.headers.authorization.replace(/^Bearer /, ''))
|
33819
|
+
decodedToken: await this.decodedToken(url, realm, context.request.headers.authorization.replace(/^Bearer /, ''), (_context_protected = context.protected) == null ? void 0 : _context_protected.signal)
|
33816
33820
|
};
|
33817
33821
|
} else {
|
33818
33822
|
context.keycloak = {
|
@@ -33834,9 +33838,10 @@ let KeycloakService = class KeycloakService {
|
|
33834
33838
|
const { steps, secured = true, url = context.privates.KEYCLOAK_URL, realm = context.privates.KEYCLOAK_REALM } = params;
|
33835
33839
|
const token = /^Bearer /g.test(context.request.headers.authorization) && ((_context_request_headers_authorization = context.request.headers.authorization) == null ? void 0 : _context_request_headers_authorization.replace(/^Bearer /g, ''));
|
33836
33840
|
if (token) {
|
33841
|
+
var _context_protected;
|
33837
33842
|
context.keycloak = {
|
33838
33843
|
isLogged: true,
|
33839
|
-
decodedToken: await this.decodedToken(url, realm, context.request.headers.authorization.replace(/^Bearer /, ''))
|
33844
|
+
decodedToken: await this.decodedToken(url, realm, context.request.headers.authorization.replace(/^Bearer /, ''), (_context_protected = context.protected) == null ? void 0 : _context_protected.signal)
|
33840
33845
|
};
|
33841
33846
|
} else {
|
33842
33847
|
context.keycloak = {
|