From 999c290db6b084ece551cf1fddf9280b5f4fa1a3 Mon Sep 17 00:00:00 2001 From: vadimmanaev Date: Mon, 9 Apr 2018 23:17:58 +0300 Subject: [PATCH 1/3] Added authentication method to allow an easy way to generate BackstageAuthentication --- .../services/AuthenticationService.java | 10 +++++++++ .../services/AuthenticationServiceImpl.java | 21 ++++++++++++++++++- .../AuthenticationServiceImplTest.java | 18 ++++++++++++++++ 3 files changed, 48 insertions(+), 1 deletion(-) diff --git a/src/main/java/com/taboola/backstage/services/AuthenticationService.java b/src/main/java/com/taboola/backstage/services/AuthenticationService.java index 337044f..8c9edd7 100644 --- a/src/main/java/com/taboola/backstage/services/AuthenticationService.java +++ b/src/main/java/com/taboola/backstage/services/AuthenticationService.java @@ -59,6 +59,16 @@ public interface AuthenticationService { */ BackstageAuthentication reAuthenticate(BackstageAuthentication auth) throws BackstageAPIUnauthorizedException, BackstageAPIConnectivityException, BackstageAPIRequestException; + + /** + * Creates {@link BackstageAuthentication} based on received access token string. + *

Keep in mind after such authentication it is NOT possible to use {@link #reAuthenticate(BackstageAuthentication) reAuthenticate} method. Date: Mon, 9 Apr 2018 23:22:25 +0300 Subject: [PATCH 2/3] Fixed logger to not use object to string as it may collide with different type of logger --- .../java/com/taboola/backstage/internal/FieldsValidator.java | 2 +- .../internal/factories/BackstageEndpointsRetrofitFactory.java | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/main/java/com/taboola/backstage/internal/FieldsValidator.java b/src/main/java/com/taboola/backstage/internal/FieldsValidator.java index cca1260..4d1d72b 100644 --- a/src/main/java/com/taboola/backstage/internal/FieldsValidator.java +++ b/src/main/java/com/taboola/backstage/internal/FieldsValidator.java @@ -60,7 +60,7 @@ private static void validate(Object obj, Map, BiFunction A createAuthEndpoint(Class clazz) { Objects.requireNonNull(clazz, "clazz"); - logger.debug("creating authentication endpoint using retrofit for class [{}]", clazz); + logger.debug("creating authentication endpoint using retrofit for class [{}]", clazz::toString); return communicationFactory.createRetrofitAuthEndpoint(clazz); } @Override public E createEndpoint(Class clazz) { Objects.requireNonNull(clazz, "clazz"); - logger.debug("creating endpoint using retrofit for class [{}]", clazz); + logger.debug("creating endpoint using retrofit for class [{}]", clazz::toString); return communicationFactory.createRetrofitEndpoint(clazz); } } From 62f5fe5e09cdfb6b501e29a9397f735ee6f42b5b Mon Sep 17 00:00:00 2001 From: vadimmanaev Date: Mon, 9 Apr 2018 23:30:10 +0300 Subject: [PATCH 3/3] Fixed typo in javadoc element --- .../com/taboola/backstage/services/AuthenticationService.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/java/com/taboola/backstage/services/AuthenticationService.java b/src/main/java/com/taboola/backstage/services/AuthenticationService.java index 8c9edd7..8913dd8 100644 --- a/src/main/java/com/taboola/backstage/services/AuthenticationService.java +++ b/src/main/java/com/taboola/backstage/services/AuthenticationService.java @@ -62,7 +62,7 @@ public interface AuthenticationService { /** * Creates {@link BackstageAuthentication} based on received access token string. - *

Keep in mind after such authentication it is NOT possible to use {@link #reAuthenticate(BackstageAuthentication) reAuthenticate} method.Keep in mind after such authentication it is NOT possible to use {@link #reAuthenticate(BackstageAuthentication) reAuthenticate} method.

* * @param accessToken supplied by authentication {@link com.taboola.backstage.model.auth.Token Token} * @return {@link BackstageAuthentication} object which is being required by all services