Skip to content

Commit

Permalink
feat: Update authorization server url #3003
Browse files Browse the repository at this point in the history
  • Loading branch information
bibash28 committed Oct 28, 2024
1 parent f6a2525 commit 1397201
Showing 1 changed file with 32 additions and 2 deletions.
34 changes: 32 additions & 2 deletions packages/oidc4vc/lib/src/oidc4vc.dart
Original file line number Diff line number Diff line change
Expand Up @@ -1781,8 +1781,6 @@ class OIDC4VC {
///the wallet is the authorization server the verifier metadata are in
////openid-configuration
final url = '$baseUrl/.well-known/openid-configuration';

if (!isAuthorizationServer) {
final data = await getOpenIdConfigSecondMethod(
baseUrl,
Expand All @@ -1793,6 +1791,8 @@ class OIDC4VC {
return data;
}

final url = '$baseUrl/.well-known/oauth-authorization-server';

try {
final response = await dioGet(
url,
Expand Down Expand Up @@ -1820,6 +1820,36 @@ class OIDC4VC {
required bool isCachingEnabled,
required Dio dio,
SecureStorageProvider? secureStorage,
}) async {
final url = '$baseUrl/.well-known/openid-configuration';

try {
final response = await dioGet(
url,
isCachingEnabled: isCachingEnabled,
dio: dio,
secureStorage: secureStorage,
);
final data = response is String
? jsonDecode(response) as Map<String, dynamic>
: response as Map<String, dynamic>;

return OpenIdConfiguration.fromJson(data);
} catch (e) {
final data = await getOpenIdConfigThirdMethod(
baseUrl,
isCachingEnabled: isCachingEnabled,
dio: dio,
);
return data;
}
}

Future<OpenIdConfiguration> getOpenIdConfigThirdMethod(
String baseUrl, {
required bool isCachingEnabled,
required Dio dio,
SecureStorageProvider? secureStorage,
}) async {
final url = '$baseUrl/.well-known/openid-credential-issuer';

Expand Down

0 comments on commit 1397201

Please sign in to comment.