syncope-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ilgro...@apache.org
Subject [5/5] syncope git commit: [SYNCOPE-1291] Clean up cached services in case of session invalidation
Date Tue, 03 Apr 2018 09:50:11 GMT
[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/a8eff1cc
Tree: http://git-wip-us.apache.org/repos/asf/syncope/tree/a8eff1cc
Diff: http://git-wip-us.apache.org/repos/asf/syncope/diff/a8eff1cc

Branch: refs/heads/master
Commit: a8eff1cc21d4dd6768472dde169836793080f7a1
Parents: 0a53225
Author: Francesco Chicchiriccò <ilgrosso@apache.org>
Authored: Tue Apr 3 11:49:48 2018 +0200
Committer: Francesco Chicchiriccò <ilgrosso@apache.org>
Committed: Tue Apr 3 11:49:58 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/a8eff1cc/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 8df6ae2..faf75a4 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
@@ -146,10 +146,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;
@@ -157,7 +153,7 @@ public class SyncopeConsoleSession extends AuthenticatedWebSession {
         try {
             client = clientFactory.setDomain(getDomain()).create(username, password);
 
-            afterAuthentication();
+            refreshAuth();
 
             authenticated = true;
         } catch (Exception e) {
@@ -173,7 +169,7 @@ public class SyncopeConsoleSession extends AuthenticatedWebSession {
         try {
             client = clientFactory.setDomain(getDomain()).create(jwt);
 
-            afterAuthentication();
+            refreshAuth();
 
             authenticated = true;
         } catch (Exception e) {
@@ -192,6 +188,7 @@ public class SyncopeConsoleSession extends AuthenticatedWebSession {
         client = null;
         auth = null;
         selfTO = null;
+        services.clear();
     }
 
     @Override
@@ -262,14 +259,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/a8eff1cc/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 736bb7d..030be02 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) {


Mime
View raw message