syncope-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ilgro...@apache.org
Subject [3/6] syncope git commit: [SYNCOPE-1043] Enduser behavior fixed
Date Fri, 10 Mar 2017 12:51:33 GMT
[SYNCOPE-1043] Enduser behavior fixed


Project: http://git-wip-us.apache.org/repos/asf/syncope/repo
Commit: http://git-wip-us.apache.org/repos/asf/syncope/commit/4d25893a
Tree: http://git-wip-us.apache.org/repos/asf/syncope/tree/4d25893a
Diff: http://git-wip-us.apache.org/repos/asf/syncope/diff/4d25893a

Branch: refs/heads/2_0_X
Commit: 4d25893acfe4bf8a958dada24f589195bbec6644
Parents: 3ce8d1b
Author: Francesco Chicchiriccò <ilgrosso@apache.org>
Authored: Fri Mar 10 13:50:47 2017 +0100
Committer: Francesco Chicchiriccò <ilgrosso@apache.org>
Committed: Fri Mar 10 13:50:47 2017 +0100

----------------------------------------------------------------------
 .../client/enduser/SyncopeEnduserSession.java   | 33 ++++++++++----------
 .../enduser/resources/LogoutResource.java       |  3 +-
 2 files changed, 17 insertions(+), 19 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/syncope/blob/4d25893a/client/enduser/src/main/java/org/apache/syncope/client/enduser/SyncopeEnduserSession.java
----------------------------------------------------------------------
diff --git a/client/enduser/src/main/java/org/apache/syncope/client/enduser/SyncopeEnduserSession.java
b/client/enduser/src/main/java/org/apache/syncope/client/enduser/SyncopeEnduserSession.java
index 2d556ee..df2f73f 100644
--- a/client/enduser/src/main/java/org/apache/syncope/client/enduser/SyncopeEnduserSession.java
+++ b/client/enduser/src/main/java/org/apache/syncope/client/enduser/SyncopeEnduserSession.java
@@ -18,6 +18,7 @@
  */
 package org.apache.syncope.client.enduser;
 
+import java.security.AccessControlException;
 import java.util.List;
 import java.util.Map;
 import java.util.Set;
@@ -115,6 +116,21 @@ public class SyncopeEnduserSession extends WebSession {
         return authenticated;
     }
 
+    @Override
+    public void invalidate() {
+        if (isAuthenticated()) {
+            try {
+                client.logout();
+            } catch (AccessControlException e) {
+                LOG.debug("Unexpected exception while logging out", e);
+            } finally {
+                client = null;
+                selfTO = null;
+            }
+        }
+        super.invalidate();
+    }
+
     public <T> T getService(final Class<T> serviceClass) {
         return (client == null || !isAuthenticated())
                 ? anonymousClient.getService(serviceClass)
@@ -159,21 +175,4 @@ public class SyncopeEnduserSession extends WebSession {
     public void setXsrfTokenGenerated(final boolean xsrfTokenGenerated) {
         this.xsrfTokenGenerated = xsrfTokenGenerated;
     }
-
-    @Override
-    public void invalidate() {
-        if (isAuthenticated()) {
-            client.logout();
-        }
-        super.invalidate();
-    }
-
-    @Override
-    public void invalidateNow() {
-        if (isAuthenticated()) {
-            client.logout();
-        }
-        super.invalidateNow();
-    }
-
 }

http://git-wip-us.apache.org/repos/asf/syncope/blob/4d25893a/client/enduser/src/main/java/org/apache/syncope/client/enduser/resources/LogoutResource.java
----------------------------------------------------------------------
diff --git a/client/enduser/src/main/java/org/apache/syncope/client/enduser/resources/LogoutResource.java
b/client/enduser/src/main/java/org/apache/syncope/client/enduser/resources/LogoutResource.java
index 4f20d60..952091f 100644
--- a/client/enduser/src/main/java/org/apache/syncope/client/enduser/resources/LogoutResource.java
+++ b/client/enduser/src/main/java/org/apache/syncope/client/enduser/resources/LogoutResource.java
@@ -26,10 +26,9 @@ public class LogoutResource extends AbstractBaseResource {
 
     @Override
     protected ResourceResponse newResourceResponse(final Attributes attributes) {
-
         LOG.debug("Logout from enduser application");
 
-        SyncopeEnduserSession.get().invalidate();
+        SyncopeEnduserSession.get().invalidateNow();
 
         ResourceResponse response = new ResourceResponse();
         response.setStatusCode(204);


Mime
View raw message