From e27da7ffb4f509b95c40bbb377d5b503c870d338 Mon Sep 17 00:00:00 2001 From: Andreas Roth Date: Wed, 17 Apr 2024 11:42:28 +0200 Subject: [PATCH 1/2] Enforce UTF-8 encoding in response body parsing --- packages/oidc_core/lib/src/endpoints/facade.dart | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/oidc_core/lib/src/endpoints/facade.dart b/packages/oidc_core/lib/src/endpoints/facade.dart index 62ea43c..35176ca 100644 --- a/packages/oidc_core/lib/src/endpoints/facade.dart +++ b/packages/oidc_core/lib/src/endpoints/facade.dart @@ -19,7 +19,7 @@ class OidcEndpoints { required http.Response response, }) { try { - final body = jsonDecode(response.body) as Map; + final body = jsonDecode(utf8.decode(response.bodyBytes)) as Map; if (body.containsKey(OidcConstants_AuthParameters.error)) { final resp = OidcErrorResponse.fromJson(body); throw OidcException.serverError( From a337be0d08e85200304328548a0c2521a5be2c1d Mon Sep 17 00:00:00 2001 From: Ahmed Fwela Date: Sat, 8 Jun 2024 07:08:29 +0300 Subject: [PATCH 2/2] format --- packages/oidc_core/lib/src/endpoints/facade.dart | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/packages/oidc_core/lib/src/endpoints/facade.dart b/packages/oidc_core/lib/src/endpoints/facade.dart index 11756b8..0ccaeb0 100644 --- a/packages/oidc_core/lib/src/endpoints/facade.dart +++ b/packages/oidc_core/lib/src/endpoints/facade.dart @@ -19,7 +19,8 @@ class OidcEndpoints { required http.Response response, }) { try { - final body = jsonDecode(utf8.decode(response.bodyBytes)) as Map; + final body = + jsonDecode(utf8.decode(response.bodyBytes)) as Map; if (body.containsKey(OidcConstants_AuthParameters.error)) { final resp = OidcErrorResponse.fromJson(body); throw OidcException.serverError(