@openid4vc/oauth2 0.3.0-alpha-20250315153009 → 0.3.0-alpha-20250315153126
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.js +19 -1
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +22 -4
- package/dist/index.mjs.map +1 -1
- package/package.json +2 -2
package/dist/index.js
CHANGED
|
@@ -682,7 +682,12 @@ var wellKnownAuthorizationServerSuffix = ".well-known/oauth-authorization-server
|
|
|
682
682
|
var wellKnownOpenIdConfigurationServerSuffix = ".well-known/openid-configuration";
|
|
683
683
|
async function fetchAuthorizationServerMetadata(issuer, fetch) {
|
|
684
684
|
const openIdConfigurationWellKnownMetadataUrl = (0, import_utils9.joinUriParts)(issuer, [wellKnownOpenIdConfigurationServerSuffix]);
|
|
685
|
-
const
|
|
685
|
+
const parsedIssuerUrl = new import_utils9.URL(issuer);
|
|
686
|
+
const authorizationServerWellKnownMetadataUrl = (0, import_utils9.joinUriParts)(parsedIssuerUrl.origin, [
|
|
687
|
+
wellKnownAuthorizationServerSuffix,
|
|
688
|
+
parsedIssuerUrl.pathname
|
|
689
|
+
]);
|
|
690
|
+
const nonCompliantAuthorizationServerWellKnownMetadataUrl = (0, import_utils9.joinUriParts)(issuer, [wellKnownAuthorizationServerSuffix]);
|
|
686
691
|
const authorizationServerResult = await fetchWellKnownMetadata(
|
|
687
692
|
authorizationServerWellKnownMetadataUrl,
|
|
688
693
|
zAuthorizationServerMetadata,
|
|
@@ -696,6 +701,19 @@ async function fetchAuthorizationServerMetadata(issuer, fetch) {
|
|
|
696
701
|
}
|
|
697
702
|
return authorizationServerResult;
|
|
698
703
|
}
|
|
704
|
+
const alternativeAuthorizationServerResult = await fetchWellKnownMetadata(
|
|
705
|
+
nonCompliantAuthorizationServerWellKnownMetadataUrl,
|
|
706
|
+
zAuthorizationServerMetadata,
|
|
707
|
+
fetch
|
|
708
|
+
);
|
|
709
|
+
if (alternativeAuthorizationServerResult) {
|
|
710
|
+
if (alternativeAuthorizationServerResult.issuer !== issuer) {
|
|
711
|
+
throw new Oauth2Error(
|
|
712
|
+
`The 'issuer' parameter '${alternativeAuthorizationServerResult.issuer}' in the well known authorization server metadata at '${nonCompliantAuthorizationServerWellKnownMetadataUrl}' does not match the provided issuer '${issuer}'.`
|
|
713
|
+
);
|
|
714
|
+
}
|
|
715
|
+
return alternativeAuthorizationServerResult;
|
|
716
|
+
}
|
|
699
717
|
const openIdConfigurationResult = await fetchWellKnownMetadata(
|
|
700
718
|
openIdConfigurationWellKnownMetadataUrl,
|
|
701
719
|
zAuthorizationServerMetadata,
|