Skip to content

Commit

Permalink
[red] draft 13 attribute authorization_servers #2714
Browse files Browse the repository at this point in the history
  • Loading branch information
hawkbee1 committed Jun 18, 2024
1 parent ebd822a commit 8e55c50
Show file tree
Hide file tree
Showing 8 changed files with 703 additions and 72 deletions.
4 changes: 3 additions & 1 deletion lib/oidc4vc/get_authorization_uri_for_issuer.dart
Original file line number Diff line number Diff line change
Expand Up @@ -109,10 +109,12 @@ Future<void> getAuthorizationUriForIssuer({
final headers = <String, dynamic>{
'Content-Type': 'application/x-www-form-urlencoded',
};
final parUrl = openIdConfiguration.pushedAuthorizationRequestEndpoint ??
'$authorizationEndpoint/par';

/// error we shuld get it from
final response = await client.post(
'$authorizationEndpoint/par',
parUrl,
headers: headers,
data: authorizationRequestParemeters,
);
Expand Down
2 changes: 1 addition & 1 deletion packages/credential_manifest/pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ dependencies:
flutter:
sdk: flutter
json_annotation: ^4.8.1
json_path: ^0.4.4 #latest version creates test issue
json_path: ^0.7.2 #latest version creates test issue

dev_dependencies:
build_runner: ^2.4.4
Expand Down
3 changes: 3 additions & 0 deletions packages/oidc4vc/lib/src/models/openid_configuration.dart
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ class OpenIdConfiguration extends Equatable {
this.credentialsSupported,
this.credentialConfigurationsSupported,
this.credentialEndpoint,
this.pushedAuthorizationRequestEndpoint,
this.credentialIssuer,
this.subjectSyntaxTypesSupported,
this.tokenEndpoint,
Expand Down Expand Up @@ -47,6 +48,8 @@ class OpenIdConfiguration extends Equatable {
final String? batchEndpoint;
@JsonKey(name: 'authorization_endpoint')
final String? authorizationEndpoint;
@JsonKey(name: 'pushed_authorization_request_endpoint')
final String? pushedAuthorizationRequestEndpoint;
@JsonKey(name: 'subject_trust_frameworks_supported')
final List<dynamic>? subjectTrustFrameworksSupported;
@JsonKey(name: 'credentials_supported')
Expand Down
37 changes: 18 additions & 19 deletions packages/oidc4vc/lib/src/oidc4vc.dart
Original file line number Diff line number Diff line change
Expand Up @@ -899,32 +899,31 @@ class OIDC4VC {
authorizationEndpoint =
'${listOpenIDConfiguration.first}/authorize';
} else {
/// Extract the authorization endpoint from from
/// authorization_server in credentialOfferJson
final jsonPathCredentialOffer = JsonPath(
// ignore: lines_longer_than_80_chars
r'$..urn:ietf:params:oauth:grant-type:pre-authorized_code.authorization_server',
);
final data = jsonPathCredentialOffer
.read(credentialOfferJson)
.first
.value as List<String>;
if (data.isNotEmpty &&
listOpenIDConfiguration.contains(data.first)) {
authorizationEndpoint = '${data.first}/authorize';
}
if (authorizationEndpoint == null) {
try {
/// Extract the authorization endpoint from from
/// authorization_server in credentialOfferJson
final jsonPathCredentialOffer = JsonPath(
// ignore: lines_longer_than_80_chars
r'$..authorized_code.authorization_server',
);
final data = jsonPathCredentialOffer
.read(credentialOfferJson)
.first
.value! as String;
if (listOpenIDConfiguration.contains(data)) {
authorizationEndpoint = '$data/authorize';
}
} catch (e) {
final jsonPathCredentialOffer = JsonPath(
// ignore: lines_longer_than_80_chars
r'$..authorization_code.authorization_server',
);
final data = jsonPathCredentialOffer
.read(credentialOfferJson)
.first
.value as List<String>;
if (data.isNotEmpty &&
listOpenIDConfiguration.contains(data.first)) {
authorizationEndpoint = '${data.first}/authorize';
.value! as String;
if (data.isNotEmpty && listOpenIDConfiguration.contains(data)) {
authorizationEndpoint = '$data/authorize';
}
}
}
Expand Down
2 changes: 1 addition & 1 deletion packages/oidc4vc/pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ dependencies:
http_mock_adapter: ^0.6.0
jose_plus: ^0.4.5
json_annotation: ^4.8.1
json_path: ^0.4.4 #latest version creates test issue
json_path: ^0.7.2 #latest version creates test issue
secp256k1: ^0.3.0
secure_storage:
path: ../secure_storage
Expand Down
681 changes: 646 additions & 35 deletions packages/oidc4vc/test/src/oidc4vc_test.dart

Large diffs are not rendered by default.

44 changes: 30 additions & 14 deletions pubspec.lock
Original file line number Diff line number Diff line change
Expand Up @@ -973,10 +973,10 @@ packages:
dependency: "direct main"
description:
name: flutter_olm
sha256: f98cafb434b3858d46446a93eb269a8e97eb38ccc5f8e0281b167d66d95c15dc
sha256: "9233fd8699e1dec0e4d5cfb9b0d0f7293db3308daf412c57093b69b461bb4a18"
url: "https://pub.dev"
source: hosted
version: "1.4.1"
version: "1.4.2"
flutter_openssl_crypto:
dependency: "direct main"
description:
Expand Down Expand Up @@ -1307,6 +1307,14 @@ packages:
url: "https://pub.dev"
source: hosted
version: "1.0.4"
iregexp:
dependency: transitive
description:
name: iregexp
sha256: "143859dcaeecf6f683102786762d70a47ef8441a0d2287a158172d32d38799cf"
url: "https://pub.dev"
source: hosted
version: "0.1.2"
jose_plus:
dependency: "direct main"
description:
Expand Down Expand Up @@ -1335,10 +1343,10 @@ packages:
dependency: "direct main"
description:
name: json_path
sha256: "1f5a47f8d56f28ddfef5f5d7cd3d14f101dc9694aa2728e415d3d749f6abbddb"
sha256: dc25b4e2297a6bd39fb52b7d122a7787b7dab751fb278d315b54706b98bb76db
url: "https://pub.dev"
source: hosted
version: "0.4.4"
version: "0.7.2"
json_rpc_2:
dependency: transitive
description:
Expand Down Expand Up @@ -1505,6 +1513,14 @@ packages:
url: "https://pub.dev"
source: hosted
version: "1.7.4"
maybe_just_nothing:
dependency: transitive
description:
name: maybe_just_nothing
sha256: "0c06326e26d08f6ed43247404376366dc4d756cef23a4f1db765f546224c35e0"
url: "https://pub.dev"
source: hosted
version: "0.5.3"
memoize:
dependency: transitive
description:
Expand Down Expand Up @@ -1557,10 +1573,10 @@ packages:
dependency: "direct dev"
description:
name: mocktail
sha256: c4b5007d91ca4f67256e720cb1b6d704e79a510183a12fa551021f652577dce6
sha256: "890df3f9688106f25755f26b1c60589a92b3ab91a22b8b224947ad041bf172d8"
url: "https://pub.dev"
source: hosted
version: "1.0.3"
version: "1.0.4"
model_viewer_plus:
dependency: "direct main"
description:
Expand Down Expand Up @@ -1748,10 +1764,10 @@ packages:
dependency: transitive
description:
name: permission_handler_android
sha256: "8bb852cd759488893805c3161d0b2b5db55db52f773dbb014420b304055ba2c5"
sha256: b29a799ca03be9f999aa6c39f7de5209482d638e6f857f6b93b0875c618b7e54
url: "https://pub.dev"
source: hosted
version: "12.0.6"
version: "12.0.7"
permission_handler_apple:
dependency: transitive
description:
Expand Down Expand Up @@ -1788,10 +1804,10 @@ packages:
dependency: transitive
description:
name: petitparser
sha256: cb3798bef7fc021ac45b308f4b51208a152792445cce0448c9a4ba5879dd8750
sha256: c15605cd28af66339f8eb6fbe0e541bfe2d1b72d5825efc6598f3e0a31b9ad27
url: "https://pub.dev"
source: hosted
version: "5.4.0"
version: "6.0.2"
photo_view:
dependency: transitive
description:
Expand Down Expand Up @@ -1996,10 +2012,10 @@ packages:
dependency: transitive
description:
name: rfc_6901
sha256: "8d97680dada633146cf75ab9382f2ce2b7e4bd63ceecd867416cf43b5832b988"
sha256: df1bbfa3d023009598f19636d6114c6ac1e0b7bb7bf6a260f0e6e6ce91416820
url: "https://pub.dev"
source: hosted
version: "0.1.1"
version: "0.2.0"
rxdart:
dependency: transitive
description:
Expand Down Expand Up @@ -2689,10 +2705,10 @@ packages:
dependency: transitive
description:
name: xml
sha256: "5bc72e1e45e941d825fd7468b9b4cc3b9327942649aeb6fc5cdbf135f0a86e84"
sha256: b015a8ad1c488f66851d762d3090a21c600e479dc75e68328c52774040cf9226
url: "https://pub.dev"
source: hosted
version: "6.3.0"
version: "6.5.0"
yaml:
dependency: transitive
description:
Expand Down
2 changes: 1 addition & 1 deletion pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ dependencies:
image_picker: ^1.0.7
jose_plus: ^0.4.5
json_annotation: ^4.8.1
json_path: ^0.4.4 #latest version creates test issue
json_path: ^0.7.2 #latest version creates test issue
jwt_decode:
path: packages/jwt_decode
key_generator:
Expand Down

0 comments on commit 8e55c50

Please sign in to comment.