@muze-nl/metro-oidc 0.3.5 → 0.4.0
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/dist/browser.js +16 -8
- package/dist/browser.js.map +2 -2
- package/dist/browser.min.js +1 -1
- package/dist/browser.min.js.map +3 -3
- package/package.json +2 -2
- package/src/oidcmw.mjs +1 -1
package/dist/browser.js
CHANGED
|
@@ -1093,13 +1093,14 @@
|
|
|
1093
1093
|
search.response_mode = oauth22.response_mode;
|
|
1094
1094
|
}
|
|
1095
1095
|
options.state.set(search.state);
|
|
1096
|
-
if (oauth22.client_secret) {
|
|
1097
|
-
search.client_secret = oauth22.client_secret;
|
|
1098
|
-
}
|
|
1099
1096
|
if (oauth22.code_verifier) {
|
|
1097
|
+
options.tokens.set("code_verifier", oauth22.code_verifier);
|
|
1100
1098
|
search.code_challenge = await generateCodeChallenge(oauth22.code_verifier);
|
|
1101
1099
|
search.code_challenge_method = "S256";
|
|
1102
1100
|
}
|
|
1101
|
+
if (oauth22.client_secret) {
|
|
1102
|
+
search.client_secret = oauth22.client_secret;
|
|
1103
|
+
}
|
|
1103
1104
|
if (oauth22.scope) {
|
|
1104
1105
|
search.scope = oauth22.scope;
|
|
1105
1106
|
}
|
|
@@ -1121,8 +1122,9 @@
|
|
|
1121
1122
|
grant_type: grant_type || oauth22.grant_type,
|
|
1122
1123
|
client_id: oauth22.client_id
|
|
1123
1124
|
};
|
|
1124
|
-
|
|
1125
|
-
|
|
1125
|
+
const code_verifier = options.tokens.get("code_verifier");
|
|
1126
|
+
if (code_verifier) {
|
|
1127
|
+
params2.code_verifier = code_verifier;
|
|
1126
1128
|
}
|
|
1127
1129
|
if (oauth22.client_secret) {
|
|
1128
1130
|
params2.client_secret = oauth22.client_secret;
|
|
@@ -1167,9 +1169,15 @@
|
|
|
1167
1169
|
throw new TypeError("Unknown expires type " + duration);
|
|
1168
1170
|
}
|
|
1169
1171
|
function generateCodeVerifier(size = 64) {
|
|
1170
|
-
|
|
1171
|
-
|
|
1172
|
-
|
|
1172
|
+
size = Math.min(43, Math.max(128, size));
|
|
1173
|
+
const allowed = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-._~";
|
|
1174
|
+
const random = new Uint8Array(size);
|
|
1175
|
+
globalThis.crypto.getRandomValues(random);
|
|
1176
|
+
const code_verifier = Array.from(random).map((b) => {
|
|
1177
|
+
let c = allowed[b % allowed.length];
|
|
1178
|
+
return c;
|
|
1179
|
+
}).join("");
|
|
1180
|
+
return code_verifier;
|
|
1173
1181
|
}
|
|
1174
1182
|
async function generateCodeChallenge(code_verifier) {
|
|
1175
1183
|
const encoder2 = new TextEncoder();
|