@openid4vc/oauth2 0.3.0-alpha-20251017092354 → 0.3.0-alpha-20251017121147
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/index.d.mts +3877 -3877
- package/dist/index.d.ts +3877 -3877
- package/dist/index.js +6 -17
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +6 -17
- package/dist/index.mjs.map +1 -1
- package/package.json +2 -2
package/dist/index.mjs
CHANGED
|
@@ -952,26 +952,15 @@ const wellKnownOpenIdConfigurationServerSuffix = ".well-known/openid-configurati
|
|
|
952
952
|
* a 404, the openid-configuration metadata will be fetched.
|
|
953
953
|
*/
|
|
954
954
|
async function fetchAuthorizationServerMetadata(issuer, fetch) {
|
|
955
|
-
const openIdConfigurationWellKnownMetadataUrl = joinUriParts(issuer, [wellKnownOpenIdConfigurationServerSuffix]);
|
|
956
955
|
const parsedIssuerUrl = new URL(issuer);
|
|
956
|
+
const openIdConfigurationWellKnownMetadataUrl = joinUriParts(issuer, [wellKnownOpenIdConfigurationServerSuffix]);
|
|
957
957
|
const authorizationServerWellKnownMetadataUrl = joinUriParts(parsedIssuerUrl.origin, [wellKnownAuthorizationServerSuffix, parsedIssuerUrl.pathname]);
|
|
958
|
-
const authorizationServerResult = await fetchWellKnownMetadata(authorizationServerWellKnownMetadataUrl, zAuthorizationServerMetadata, fetch);
|
|
959
|
-
if (authorizationServerResult) {
|
|
960
|
-
if (authorizationServerResult.issuer !== issuer) throw new Oauth2Error(`The 'issuer' parameter '${authorizationServerResult.issuer}' in the well known authorization server metadata at '${authorizationServerWellKnownMetadataUrl}' does not match the provided issuer '${issuer}'.`);
|
|
961
|
-
return authorizationServerResult;
|
|
962
|
-
}
|
|
963
958
|
const nonCompliantAuthorizationServerWellKnownMetadataUrl = joinUriParts(issuer, [wellKnownAuthorizationServerSuffix]);
|
|
964
|
-
|
|
965
|
-
if (
|
|
966
|
-
|
|
967
|
-
|
|
968
|
-
|
|
969
|
-
const openIdConfigurationResult = await fetchWellKnownMetadata(openIdConfigurationWellKnownMetadataUrl, zAuthorizationServerMetadata, fetch);
|
|
970
|
-
if (openIdConfigurationResult) {
|
|
971
|
-
if (openIdConfigurationResult.issuer !== issuer) throw new Oauth2Error(`The 'issuer' parameter '${openIdConfigurationResult.issuer}' in the well known openid configuration metadata at '${openIdConfigurationWellKnownMetadataUrl}' does not match the provided issuer '${issuer}'.`);
|
|
972
|
-
return openIdConfigurationResult;
|
|
973
|
-
}
|
|
974
|
-
return null;
|
|
959
|
+
let authorizationServerResult = await fetchWellKnownMetadata(authorizationServerWellKnownMetadataUrl, zAuthorizationServerMetadata, fetch);
|
|
960
|
+
if (!authorizationServerResult && nonCompliantAuthorizationServerWellKnownMetadataUrl !== authorizationServerWellKnownMetadataUrl) authorizationServerResult = await fetchWellKnownMetadata(nonCompliantAuthorizationServerWellKnownMetadataUrl, zAuthorizationServerMetadata, fetch);
|
|
961
|
+
if (!authorizationServerResult) authorizationServerResult = await fetchWellKnownMetadata(openIdConfigurationWellKnownMetadataUrl, zAuthorizationServerMetadata, fetch);
|
|
962
|
+
if (authorizationServerResult && authorizationServerResult.issuer !== issuer) throw new Oauth2Error(`The 'issuer' parameter '${authorizationServerResult.issuer}' in the well known authorization server metadata at '${authorizationServerWellKnownMetadataUrl}' does not match the provided issuer '${issuer}'.`);
|
|
963
|
+
return authorizationServerResult;
|
|
975
964
|
}
|
|
976
965
|
function getAuthorizationServerMetadataFromList(authorizationServersMetadata, issuer) {
|
|
977
966
|
const authorizationServerMetadata = authorizationServersMetadata.find((authorizationServerMetadata$1) => authorizationServerMetadata$1.issuer === issuer);
|