@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.js
CHANGED
|
@@ -977,26 +977,15 @@ const wellKnownOpenIdConfigurationServerSuffix = ".well-known/openid-configurati
|
|
|
977
977
|
* a 404, the openid-configuration metadata will be fetched.
|
|
978
978
|
*/
|
|
979
979
|
async function fetchAuthorizationServerMetadata(issuer, fetch) {
|
|
980
|
-
const openIdConfigurationWellKnownMetadataUrl = (0, __openid4vc_utils.joinUriParts)(issuer, [wellKnownOpenIdConfigurationServerSuffix]);
|
|
981
980
|
const parsedIssuerUrl = new __openid4vc_utils.URL(issuer);
|
|
981
|
+
const openIdConfigurationWellKnownMetadataUrl = (0, __openid4vc_utils.joinUriParts)(issuer, [wellKnownOpenIdConfigurationServerSuffix]);
|
|
982
982
|
const authorizationServerWellKnownMetadataUrl = (0, __openid4vc_utils.joinUriParts)(parsedIssuerUrl.origin, [wellKnownAuthorizationServerSuffix, parsedIssuerUrl.pathname]);
|
|
983
|
-
const authorizationServerResult = await fetchWellKnownMetadata(authorizationServerWellKnownMetadataUrl, zAuthorizationServerMetadata, fetch);
|
|
984
|
-
if (authorizationServerResult) {
|
|
985
|
-
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}'.`);
|
|
986
|
-
return authorizationServerResult;
|
|
987
|
-
}
|
|
988
983
|
const nonCompliantAuthorizationServerWellKnownMetadataUrl = (0, __openid4vc_utils.joinUriParts)(issuer, [wellKnownAuthorizationServerSuffix]);
|
|
989
|
-
|
|
990
|
-
if (
|
|
991
|
-
|
|
992
|
-
|
|
993
|
-
|
|
994
|
-
const openIdConfigurationResult = await fetchWellKnownMetadata(openIdConfigurationWellKnownMetadataUrl, zAuthorizationServerMetadata, fetch);
|
|
995
|
-
if (openIdConfigurationResult) {
|
|
996
|
-
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}'.`);
|
|
997
|
-
return openIdConfigurationResult;
|
|
998
|
-
}
|
|
999
|
-
return null;
|
|
984
|
+
let authorizationServerResult = await fetchWellKnownMetadata(authorizationServerWellKnownMetadataUrl, zAuthorizationServerMetadata, fetch);
|
|
985
|
+
if (!authorizationServerResult && nonCompliantAuthorizationServerWellKnownMetadataUrl !== authorizationServerWellKnownMetadataUrl) authorizationServerResult = await fetchWellKnownMetadata(nonCompliantAuthorizationServerWellKnownMetadataUrl, zAuthorizationServerMetadata, fetch);
|
|
986
|
+
if (!authorizationServerResult) authorizationServerResult = await fetchWellKnownMetadata(openIdConfigurationWellKnownMetadataUrl, zAuthorizationServerMetadata, fetch);
|
|
987
|
+
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}'.`);
|
|
988
|
+
return authorizationServerResult;
|
|
1000
989
|
}
|
|
1001
990
|
function getAuthorizationServerMetadataFromList(authorizationServersMetadata, issuer) {
|
|
1002
991
|
const authorizationServerMetadata = authorizationServersMetadata.find((authorizationServerMetadata$1) => authorizationServerMetadata$1.issuer === issuer);
|