From 3baa6348b220025285ea2f700b1f5f39bee60f30 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C5=A0tefan=20Ma=C5=A1ek?= Date: Wed, 27 Sep 2023 13:59:21 +0200 Subject: [PATCH] removed unused code, fix restriction warnings --- .../esign/connector/auth/oauth/OAuth2BearerFilter.java | 7 ++++--- .../adobe/esign/connector/rest/WebHookService.java | 8 -------- 2 files changed, 4 insertions(+), 11 deletions(-) diff --git a/adobe-esign-connector/src/com/axonivy/connector/adobe/esign/connector/auth/oauth/OAuth2BearerFilter.java b/adobe-esign-connector/src/com/axonivy/connector/adobe/esign/connector/auth/oauth/OAuth2BearerFilter.java index 21a5363..bd0a6f8 100644 --- a/adobe-esign-connector/src/com/axonivy/connector/adobe/esign/connector/auth/oauth/OAuth2BearerFilter.java +++ b/adobe-esign-connector/src/com/axonivy/connector/adobe/esign/connector/auth/oauth/OAuth2BearerFilter.java @@ -1,3 +1,4 @@ + package com.axonivy.connector.adobe.esign.connector.auth.oauth; import java.io.IOException; @@ -19,9 +20,7 @@ import ch.ivyteam.ivy.request.IRequest; import ch.ivyteam.ivy.rest.client.FeatureConfig; import ch.ivyteam.ivy.rest.client.RestClientFactoryConstants; -import ch.ivyteam.ivy.rest.client.internal.oauth2.RedirectToIdentityProvider; -@SuppressWarnings("restriction") public class OAuth2BearerFilter implements javax.ws.rs.client.ClientRequestFilter { private static final String AUTHORIZATION = "Authorization"; private static final String BEARER = "Bearer "; @@ -35,6 +34,8 @@ public class OAuth2BearerFilter implements javax.ws.rs.client.ClientRequestFilte public static final AdobeVariable REFRESH_TOKEN_VAR = AdobeVariable.OAUTH_TOKEN; public static final AdobeVariable ACCESS_TOKEN_VAR = AdobeVariable.ACCESS_TOKEN; + + private static final String OAUTH2_ERROR_CODE = "ivy:error:rest:client:oauth2"; private String property; private Supplier name = null; @@ -154,6 +155,6 @@ protected String getAuthCode() { } private static BpmPublicErrorBuilder authError() { - return BpmError.create(RedirectToIdentityProvider.OAUTH2_ERROR_CODE); + return BpmError.create(OAUTH2_ERROR_CODE); } } diff --git a/adobe-esign-connector/src/com/axonivy/connector/adobe/esign/connector/rest/WebHookService.java b/adobe-esign-connector/src/com/axonivy/connector/adobe/esign/connector/rest/WebHookService.java index f5cf621..b4c5e2c 100644 --- a/adobe-esign-connector/src/com/axonivy/connector/adobe/esign/connector/rest/WebHookService.java +++ b/adobe-esign-connector/src/com/axonivy/connector/adobe/esign/connector/rest/WebHookService.java @@ -1,7 +1,5 @@ package com.axonivy.connector.adobe.esign.connector.rest; -import java.util.Optional; - import javax.annotation.security.PermitAll; import javax.ws.rs.Consumes; import javax.ws.rs.GET; @@ -33,7 +31,6 @@ public class WebHookService { private static final String CLIENT_ID_HEADER = "X-ADOBESIGN-CLIENTID"; - private static final String CLIENT_ID_VAR = "ivy.var.adobe-sign-connector.clientId"; @GET @Produces("application/json") @@ -55,11 +52,6 @@ public void notification(JsonNode node) { Ivy.log().info(node); } - @SuppressWarnings("unused") - private boolean verifyClientId(String clientId) { - return Optional.ofNullable(Ivy.var().get(CLIENT_ID_VAR)).map(s -> s.compareTo(clientId) == 0).orElse(false); - } - private record ClientIdResponse(String xAdobeSignClientId) {}; }