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 10:55:57 UTC
[syncope] 03/03: [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 master
in repository https://gitbox.apache.org/repos/asf/syncope.git
commit 4014601f040b4a48c46585e4259d968bce554ec8
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/idrepo/lib/src/main/java/org/apache/syncope/client/lib/SyncopeClient.java b/client/idrepo/lib/src/main/java/org/apache/syncope/client/lib/SyncopeClient.java
index d4c304c322..aecbfa49c0 100644
--- a/client/idrepo/lib/src/main/java/org/apache/syncope/client/lib/SyncopeClient.java
+++ b/client/idrepo/lib/src/main/java/org/apache/syncope/client/lib/SyncopeClient.java
@@ -61,6 +61,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
@@ -68,6 +70,8 @@ import org.apache.syncope.common.rest.api.service.UserSelfService;
*/
public class SyncopeClient {
+ protected static final Logger LOG = LoggerFactory.getLogger(SyncopeClient.class);
+
protected static final String HEADER_SPLIT_PROPERTY = "org.apache.cxf.http.header.split";
protected static final JsonMapper MAPPER = JsonMapper.builder().findAndAddModules().build();
@@ -228,7 +232,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();
}