From 857615031e0174e381be16343346b9d79f0953ce Mon Sep 17 00:00:00 2001 From: scott Date: Mon, 8 Jan 2024 00:58:31 -0500 Subject: [PATCH] https://github.com/manifold-systems/manifold/issues/541 - fix withAuthorization() --- .../main/java/manifold/graphql/rt/api/request/Executor.java | 2 +- .../src/main/java/manifold/json/rt/api/Requester.java | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/manifold-deps-parent/manifold-graphql-rt/src/main/java/manifold/graphql/rt/api/request/Executor.java b/manifold-deps-parent/manifold-graphql-rt/src/main/java/manifold/graphql/rt/api/request/Executor.java index f257bcb70..afafe6752 100644 --- a/manifold-deps-parent/manifold-graphql-rt/src/main/java/manifold/graphql/rt/api/request/Executor.java +++ b/manifold-deps-parent/manifold-graphql-rt/src/main/java/manifold/graphql/rt/api/request/Executor.java @@ -180,7 +180,7 @@ public Executor withBearerAuthorization( String accessToken ) @SuppressWarnings("unused") public Executor withAuthorization( String tokenType, String accessToken ) { - return withHeader( "Authorization", "$tokenType $accessToken" ); + return withHeader( "Authorization", tokenType + " " + accessToken ); } /** * The connection timeout setting in milliseconds. If the timeout expires before the connection can be established, a diff --git a/manifold-deps-parent/manifold-json-rt/src/main/java/manifold/json/rt/api/Requester.java b/manifold-deps-parent/manifold-json-rt/src/main/java/manifold/json/rt/api/Requester.java index 18bfe1ee6..f693c279f 100644 --- a/manifold-deps-parent/manifold-json-rt/src/main/java/manifold/json/rt/api/Requester.java +++ b/manifold-deps-parent/manifold-json-rt/src/main/java/manifold/json/rt/api/Requester.java @@ -174,8 +174,8 @@ public Requester withParam( String name, String value ) public Requester withBasicAuthorization( String username, String password ) { String authorization = Base64.getEncoder() - .encodeToString(( "$username:$password" ).getBytes( StandardCharsets.UTF_8 ) ); - return withHeader( "Authorization", "Basic $authorization" ); + .encodeToString(( username + ":" + password ).getBytes( StandardCharsets.UTF_8 ) ); + return withHeader( "Authorization", "Basic " + authorization ); } /** @@ -194,7 +194,7 @@ public Requester withBearerAuthorization( String accessToken ) @SuppressWarnings("unused") public Requester withAuthorization( String tokenType, String accessToken ) { - return withHeader( "Authorization", "$tokenType $accessToken" ); + return withHeader( "Authorization", tokenType + " " + accessToken ); } /**