diff --git a/adobe-esign-connector-demo/processes/Demo.p.json b/adobe-esign-connector-demo/processes/Demo.p.json index 06312e3..d403e27 100644 --- a/adobe-esign-connector-demo/processes/Demo.p.json +++ b/adobe-esign-connector-demo/processes/Demo.p.json @@ -53,9 +53,9 @@ "type" : "Script", "name" : "log", "config" : { + "security" : "system", "output" : { "code" : [ - "ivy.log.info(\"uploaded document with id {0}\", in.fileId);", "if(in.#error is initialized) {", " ivy.log.error(in.error);", "}" @@ -139,9 +139,9 @@ "type" : "Script", "name" : "log", "config" : { + "security" : "system", "output" : { "code" : [ - "ivy.log.info(\"create agreement with id {0}\", in.agreementId);", "if(in.#error is initialized) {", " ivy.log.error(in.error);", "}" diff --git a/adobe-esign-connector-demo/src_hd/com/axonivy/connector/adobe/esign/connector/demo/Demo/DemoProcess.p.json b/adobe-esign-connector-demo/src_hd/com/axonivy/connector/adobe/esign/connector/demo/Demo/DemoProcess.p.json index c215a2a..9942e5f 100644 --- a/adobe-esign-connector-demo/src_hd/com/axonivy/connector/adobe/esign/connector/demo/Demo/DemoProcess.p.json +++ b/adobe-esign-connector-demo/src_hd/com/axonivy/connector/adobe/esign/connector/demo/Demo/DemoProcess.p.json @@ -146,7 +146,6 @@ "code" : [ "import api.rest.v6.client.SigningUrlResponseSigningUrls;", "import api.rest.v6.client.SigningUrlResponseSigningUrlSetInfos;", - "ivy.log.info(result.signingURIs);", "", "for(SigningUrlResponseSigningUrlSetInfos signingInfos : result.signingURIs) {", " for(SigningUrlResponseSigningUrls signingUrls : signingInfos.getSigningUrls()) {", @@ -363,7 +362,6 @@ "code" : [ "import api.rest.v6.client.SigningUrlResponseSigningUrls;", "import api.rest.v6.client.SigningUrlResponseSigningUrlSetInfos;", - "ivy.log.info(result.signingURIs);", "", "for(SigningUrlResponseSigningUrlSetInfos signingInfos : result.signingURIs) {", " for(SigningUrlResponseSigningUrls signingUrls : signingInfos.getSigningUrls()) {", diff --git a/adobe-esign-connector/src/com/axonivy/connector/adobe/esign/connector/auth/OAuth2Feature.java b/adobe-esign-connector/src/com/axonivy/connector/adobe/esign/connector/auth/OAuth2Feature.java index 3ae84bc..6cd100a 100644 --- a/adobe-esign-connector/src/com/axonivy/connector/adobe/esign/connector/auth/OAuth2Feature.java +++ b/adobe-esign-connector/src/com/axonivy/connector/adobe/esign/connector/auth/OAuth2Feature.java @@ -23,7 +23,6 @@ import com.axonivy.connector.adobe.esign.connector.enums.AdobeVariable; import ch.ivyteam.ivy.bpm.error.BpmPublicErrorBuilder; -import ch.ivyteam.ivy.environment.Ivy; import ch.ivyteam.ivy.rest.client.FeatureConfig; import ch.ivyteam.ivy.rest.client.oauth2.OAuth2RedirectErrorBuilder; import ch.ivyteam.ivy.rest.client.oauth2.uri.OAuth2CallbackUriBuilder; @@ -195,7 +194,6 @@ private static BpmPublicErrorBuilder authRedirectError(FeatureConfig config, OAu .queryParam("client_id", config.readMandatory(Property.CLIENT_ID)) .queryParam("scope", getScope(config)) .build(); - Ivy.log().debug("created oauth URI: " + uri); return OAuth2RedirectErrorBuilder .create(uri) .withMessage("Missing permission from user to act in his name."); 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 bd0a6f8..ed332e3 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 @@ -20,7 +20,9 @@ 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 "; @@ -34,8 +36,6 @@ 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; @@ -63,12 +63,12 @@ protected final String getAccessToken(ClientRequestContext context) { FeatureConfig config = new FeatureConfig(context.getConfiguration(), getSource()); VarTokenStore refreshTokenStore = VarTokenStore.get(REFRESH_TOKEN_VAR.getVariableName()); var refreshToken = refreshTokenStore.getToken(); - + VarTokenStore accessTokenStore = VarTokenStore.get(ACCESS_TOKEN_VAR.getVariableName()); var accessToken = accessTokenStore.getToken(); - + String resultToken = null; - + if(accessToken == null || accessToken.isExpired()) { // refresh access token if(refreshToken != null && refreshToken.hasRefreshToken()) { @@ -86,7 +86,7 @@ protected final String getAccessToken(ClientRequestContext context) { else { // use existing token resultToken = accessToken.accessToken(); } - + if (accessToken != null && !accessToken.hasAccessToken()) { accessTokenStore.setToken(null); authError().withMessage("Failed to read 'access_token' from " + refreshToken).throwError(); @@ -128,7 +128,7 @@ private Token getRefreshedAccessToken(Client client, FeatureConfig config, Strin private Token getAccessToken(Client client, FeatureConfig config, String refreshToken) { GenericType> map = new GenericType<>(Map.class); - + // use refresh uri for refresh token var tokenUri = StringUtils.isNotBlank(refreshToken) ? uriFactory.getRefreshUri() : uriFactory.getTokenUri(); String authCode = getAuthCode(); @@ -155,6 +155,6 @@ protected String getAuthCode() { } private static BpmPublicErrorBuilder authError() { - return BpmError.create(OAUTH2_ERROR_CODE); + return BpmError.create(RedirectToIdentityProvider.OAUTH2_ERROR_CODE); } } diff --git a/adobe-esign-connector/src/com/axonivy/connector/adobe/esign/connector/service/AdminSetupService.java b/adobe-esign-connector/src/com/axonivy/connector/adobe/esign/connector/service/AdminSetupService.java index fddf322..b548f19 100644 --- a/adobe-esign-connector/src/com/axonivy/connector/adobe/esign/connector/service/AdminSetupService.java +++ b/adobe-esign-connector/src/com/axonivy/connector/adobe/esign/connector/service/AdminSetupService.java @@ -83,7 +83,6 @@ public static void authRedirect() .queryParam("client_id", clientId) .queryParam("scope", scope) .build(); - Ivy.log().debug("created oauth URI: " + uri); PrimeFaces.current().executeScript("window.open('" + uri.toString() + "', '_top')"); }