You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@syncope.apache.org by il...@apache.org on 2022/09/01 13:53:24 UTC
[syncope] 01/02: [SYNCOPE-1693] Ensure to cleanup client headers in case of missing AccessToken
This is an automated email from the ASF dual-hosted git repository.
ilgrosso pushed a commit to branch 2_1_X
in repository https://gitbox.apache.org/repos/asf/syncope.git
commit 3e5564e0e9710b4fe847c82bf8bad12a12108653
Author: Francesco Chicchiriccò <il...@apache.org>
AuthorDate: Thu Sep 1 12:55:44 2022 +0200
[SYNCOPE-1693] Ensure to cleanup client headers in case of missing AccessToken
---
.../main/java/org/apache/syncope/client/lib/SyncopeClient.java | 10 +++++++++-
1 file changed, 9 insertions(+), 1 deletion(-)
diff --git a/client/lib/src/main/java/org/apache/syncope/client/lib/SyncopeClient.java b/client/lib/src/main/java/org/apache/syncope/client/lib/SyncopeClient.java
index 1c72fea081..927f488de6 100644
--- a/client/lib/src/main/java/org/apache/syncope/client/lib/SyncopeClient.java
+++ b/client/lib/src/main/java/org/apache/syncope/client/lib/SyncopeClient.java
@@ -54,6 +54,8 @@ import org.apache.syncope.common.rest.api.service.AccessTokenService;
import org.apache.syncope.common.rest.api.service.AnyService;
import org.apache.syncope.common.rest.api.service.ExecutableService;
import org.apache.syncope.common.rest.api.service.UserSelfService;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
/**
* Entry point for client access to all REST services exposed by Syncope core; obtain instances via
@@ -61,6 +63,8 @@ import org.apache.syncope.common.rest.api.service.UserSelfService;
*/
public class SyncopeClient {
+ private static final Logger LOG = LoggerFactory.getLogger(SyncopeClient.class);
+
private static final String HEADER_SPLIT_PROPERTY = "org.apache.cxf.http.header.split";
private static final ObjectMapper OBJECT_MAPPER = new ObjectMapper();
@@ -166,7 +170,11 @@ public class SyncopeClient {
* Invalidates the JWT currently in use.
*/
public void logout() {
- getService(AccessTokenService.class).logout();
+ try {
+ getService(AccessTokenService.class).logout();
+ } catch (Exception e) {
+ LOG.error("While logging out, cleaning up anyway", e);
+ }
cleanup();
}