@muze-nl/metro-oidc 0.5.1 → 0.5.3
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 +15 -6
- package/dist/browser.js.map +2 -2
- package/dist/browser.min.js +1 -1
- package/dist/browser.min.js.map +2 -2
- package/package.json +2 -2
- package/src/oidc.register.mjs +10 -3
- package/src/oidcmw.mjs +3 -4
package/dist/browser.js
CHANGED
|
@@ -1173,7 +1173,8 @@
|
|
|
1173
1173
|
case "client_credentials":
|
|
1174
1174
|
break;
|
|
1175
1175
|
case "refresh_token":
|
|
1176
|
-
|
|
1176
|
+
const refreshToken = options.tokens.get("refresh_token");
|
|
1177
|
+
params2.refresh_token = refreshToken.value;
|
|
1177
1178
|
break;
|
|
1178
1179
|
default:
|
|
1179
1180
|
throw new Error("Unknown grant_type: ".oauth2.grant_type);
|
|
@@ -1681,9 +1682,18 @@
|
|
|
1681
1682
|
client_info: openid_client_metadata
|
|
1682
1683
|
});
|
|
1683
1684
|
const defaultOptions = {
|
|
1684
|
-
client: everything_default.client().with(throwermw()).with(jsonmw())
|
|
1685
|
+
client: everything_default.client().with(throwermw()).with(jsonmw()),
|
|
1686
|
+
client_info: {
|
|
1687
|
+
redirect_uris: [globalThis.document?.location.href]
|
|
1688
|
+
}
|
|
1685
1689
|
};
|
|
1686
1690
|
options = Object.assign({}, defaultOptions, options);
|
|
1691
|
+
if (!options.client_info) {
|
|
1692
|
+
options.client_info = {};
|
|
1693
|
+
}
|
|
1694
|
+
if (!options.client_info.redirect_uris) {
|
|
1695
|
+
options.client_info.redirect_uris = [globalThis.document?.location.href];
|
|
1696
|
+
}
|
|
1687
1697
|
let response2 = await options.client.post(options.registration_endpoint, {
|
|
1688
1698
|
body: options.client_info
|
|
1689
1699
|
});
|
|
@@ -1743,7 +1753,7 @@
|
|
|
1743
1753
|
if (!options.openid_configuration && options.store.has("openid_configuration")) {
|
|
1744
1754
|
options.openid_configuration = options.store.get("openid_configuration");
|
|
1745
1755
|
}
|
|
1746
|
-
if (!options.client_info
|
|
1756
|
+
if (!options.client_info?.client_id && options.store.has("client_info")) {
|
|
1747
1757
|
options.client_info = options.store.get("client_info");
|
|
1748
1758
|
}
|
|
1749
1759
|
return async (req, next) => {
|
|
@@ -1767,7 +1777,6 @@
|
|
|
1767
1777
|
options.store.set("openid_configuration", options.openid_configuration);
|
|
1768
1778
|
}
|
|
1769
1779
|
if (!options.client_info?.client_id) {
|
|
1770
|
-
assert(options.client_info?.client_name, Required());
|
|
1771
1780
|
if (!options.openid_configuration.registration_endpoint) {
|
|
1772
1781
|
throw metroError("metro.oidcmw: Error: issuer " + options.issuer + " does not support dynamic client registration, but you haven't specified a client_id");
|
|
1773
1782
|
}
|
|
@@ -1785,8 +1794,8 @@
|
|
|
1785
1794
|
force_authorization: true,
|
|
1786
1795
|
authorize_callback: options.authorize_callback,
|
|
1787
1796
|
oauth2_configuration: {
|
|
1788
|
-
client_id: options.client_info
|
|
1789
|
-
client_secret: options.client_info
|
|
1797
|
+
client_id: options.client_info?.client_id,
|
|
1798
|
+
client_secret: options.client_info?.client_secret,
|
|
1790
1799
|
grant_type: "authorization_code",
|
|
1791
1800
|
response_type: "code",
|
|
1792
1801
|
response_mode: "query",
|