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 2018/04/03 09:50:10 UTC

[4/5] syncope git commit: [SYNCOPE-1291] Clean up cached services in case of session invalidation

[SYNCOPE-1291] Clean up cached services in case of session invalidation


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

Branch: refs/heads/2_0_X
Commit: 82ffa80d4b80a1ed2e591017ace2919d91d84249
Parents: f920f07
Author: Francesco Chicchiriccò <il...@apache.org>
Authored: Tue Apr 3 11:49:48 2018 +0200
Committer: Francesco Chicchiriccò <il...@apache.org>
Committed: Tue Apr 3 11:49:48 2018 +0200

----------------------------------------------------------------------
 .../client/console/SyncopeConsoleSession.java        | 15 ++++-----------
 .../syncope/client/console/panels/AnyTypesPanel.java |  2 +-
 2 files changed, 5 insertions(+), 12 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/syncope/blob/82ffa80d/client/console/src/main/java/org/apache/syncope/client/console/SyncopeConsoleSession.java
----------------------------------------------------------------------
diff --git a/client/console/src/main/java/org/apache/syncope/client/console/SyncopeConsoleSession.java b/client/console/src/main/java/org/apache/syncope/client/console/SyncopeConsoleSession.java
index 9f7c634..627f508 100644
--- a/client/console/src/main/java/org/apache/syncope/client/console/SyncopeConsoleSession.java
+++ b/client/console/src/main/java/org/apache/syncope/client/console/SyncopeConsoleSession.java
@@ -148,10 +148,6 @@ public class SyncopeConsoleSession extends AuthenticatedWebSession {
         return client == null ? null : client.getJWT();
     }
 
-    private void afterAuthentication() {
-        refreshAuthorization();
-    }
-
     @Override
     public boolean authenticate(final String username, final String password) {
         boolean authenticated = false;
@@ -159,7 +155,7 @@ public class SyncopeConsoleSession extends AuthenticatedWebSession {
         try {
             client = clientFactory.setDomain(getDomain()).create(username, password);
 
-            afterAuthentication();
+            refreshAuth();
 
             authenticated = true;
         } catch (Exception e) {
@@ -175,7 +171,7 @@ public class SyncopeConsoleSession extends AuthenticatedWebSession {
         try {
             client = clientFactory.setDomain(getDomain()).create(jwt);
 
-            afterAuthentication();
+            refreshAuth();
 
             authenticated = true;
         } catch (Exception e) {
@@ -194,6 +190,7 @@ public class SyncopeConsoleSession extends AuthenticatedWebSession {
         client = null;
         auth = null;
         selfTO = null;
+        services.clear();
     }
 
     @Override
@@ -270,14 +267,10 @@ public class SyncopeConsoleSession extends AuthenticatedWebSession {
     }
 
     public void refreshAuth() {
-        client.refresh();
-        roles = null;
-    }
-
-    public void refreshAuthorization() {
         Pair<Map<String, Set<String>>, UserTO> self = client.self();
         auth = self.getLeft();
         selfTO = self.getRight();
+        roles = null;
     }
 
     @SuppressWarnings("unchecked")

http://git-wip-us.apache.org/repos/asf/syncope/blob/82ffa80d/client/console/src/main/java/org/apache/syncope/client/console/panels/AnyTypesPanel.java
----------------------------------------------------------------------
diff --git a/client/console/src/main/java/org/apache/syncope/client/console/panels/AnyTypesPanel.java b/client/console/src/main/java/org/apache/syncope/client/console/panels/AnyTypesPanel.java
index 1d0e1d8..07b0fbf 100644
--- a/client/console/src/main/java/org/apache/syncope/client/console/panels/AnyTypesPanel.java
+++ b/client/console/src/main/java/org/apache/syncope/client/console/panels/AnyTypesPanel.java
@@ -80,8 +80,8 @@ public class AnyTypesPanel extends TypesDirectoryPanel<AnyTypeTO, AnyTypesPanel.
                             } else {
                                 restClient.update(modelObject);
                             }
+
                             SyncopeConsoleSession.get().info(getString(Constants.OPERATION_SUCCEEDED));
-                            SyncopeConsoleSession.get().refreshAuthorization();
                             AnyTypesPanel.this.updateResultTable(target);
                             modal.close(target);
                         } catch (Exception e) {