From ca0658229b29786b5880ad7fb29164eeb6c9fd04 Mon Sep 17 00:00:00 2001 From: Chris Beams Date: Thu, 23 Apr 2020 10:35:04 +0200 Subject: [PATCH] Rename AuthenticationInterceptor => TokenAuthInterceptor --- cli/src/main/java/bisq/cli/app/BisqCallCredentials.java | 2 +- core/src/main/java/bisq/core/grpc/BisqGrpcServer.java | 2 +- ...enticationInterceptor.java => TokenAuthInterceptor.java} | 6 +++--- 3 files changed, 5 insertions(+), 5 deletions(-) rename core/src/main/java/bisq/core/grpc/{AuthenticationInterceptor.java => TokenAuthInterceptor.java} (87%) diff --git a/cli/src/main/java/bisq/cli/app/BisqCallCredentials.java b/cli/src/main/java/bisq/cli/app/BisqCallCredentials.java index d35caf1e78..b3e92079c4 100644 --- a/cli/src/main/java/bisq/cli/app/BisqCallCredentials.java +++ b/cli/src/main/java/bisq/cli/app/BisqCallCredentials.java @@ -28,7 +28,7 @@ public class BisqCallCredentials extends CallCredentials { appExecutor.execute(() -> { try { Metadata headers = new Metadata(); - Key creds = Key.of("bisqd-creds", ASCII_STRING_MARSHALLER); + Key creds = Key.of("bisq-api-token", ASCII_STRING_MARSHALLER); headers.put(creds, encodeCredentials()); metadataApplier.apply(headers); } catch (Throwable ex) { diff --git a/core/src/main/java/bisq/core/grpc/BisqGrpcServer.java b/core/src/main/java/bisq/core/grpc/BisqGrpcServer.java index aeee2cf9e2..df185fa35c 100644 --- a/core/src/main/java/bisq/core/grpc/BisqGrpcServer.java +++ b/core/src/main/java/bisq/core/grpc/BisqGrpcServer.java @@ -217,7 +217,7 @@ public class BisqGrpcServer { .addService(new GetPaymentAccountsImpl()) .addService(new PlaceOfferImpl()) .addService(new StopServerImpl()) - .intercept(new AuthenticationInterceptor(rpcUser, rpcPassword)) + .intercept(new TokenAuthInterceptor(rpcUser, rpcPassword)) .build() .start(); diff --git a/core/src/main/java/bisq/core/grpc/AuthenticationInterceptor.java b/core/src/main/java/bisq/core/grpc/TokenAuthInterceptor.java similarity index 87% rename from core/src/main/java/bisq/core/grpc/AuthenticationInterceptor.java rename to core/src/main/java/bisq/core/grpc/TokenAuthInterceptor.java index d3b6d91a6c..13733ef6f4 100644 --- a/core/src/main/java/bisq/core/grpc/AuthenticationInterceptor.java +++ b/core/src/main/java/bisq/core/grpc/TokenAuthInterceptor.java @@ -16,12 +16,12 @@ import static io.grpc.Status.UNAUTHENTICATED; * Simple authentication interceptor to validate a cleartext token in username:password format. */ @Slf4j -public class AuthenticationInterceptor implements ServerInterceptor { +public class TokenAuthInterceptor implements ServerInterceptor { private final String rpcUser; private final String rpcPassword; - public AuthenticationInterceptor(String rpcUser, String rpcPassword) { + public TokenAuthInterceptor(String rpcUser, String rpcPassword) { this.rpcUser = rpcUser; this.rpcPassword = rpcPassword; } @@ -29,7 +29,7 @@ public class AuthenticationInterceptor implements ServerInterceptor { @Override public ServerCall.Listener interceptCall(ServerCall serverCall, Metadata metadata, ServerCallHandler serverCallHandler) { - authenticate(metadata.get(Key.of("bisqd-creds", ASCII_STRING_MARSHALLER))); + authenticate(metadata.get(Key.of("bisq-api-token", ASCII_STRING_MARSHALLER))); return serverCallHandler.startCall(serverCall, metadata); }