You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@karaf.apache.org by cs...@apache.org on 2017/08/17 14:30:13 UTC

[21/27] karaf git commit: Extract common code

Extract common code


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

Branch: refs/heads/model_features
Commit: db2bf32c780aadae38136e6ea6adeb8ed38950c4
Parents: c79e2ba
Author: Christian Schneider <ch...@die-schneider.net>
Authored: Wed Aug 16 18:00:43 2017 +0200
Committer: Christian Schneider <ch...@die-schneider.net>
Committed: Wed Aug 16 18:00:43 2017 +0200

----------------------------------------------------------------------
 .../apache/karaf/jaas/modules/syncope/SyncopeLoginModule.java  | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/karaf/blob/db2bf32c/jaas/modules/src/main/java/org/apache/karaf/jaas/modules/syncope/SyncopeLoginModule.java
----------------------------------------------------------------------
diff --git a/jaas/modules/src/main/java/org/apache/karaf/jaas/modules/syncope/SyncopeLoginModule.java b/jaas/modules/src/main/java/org/apache/karaf/jaas/modules/syncope/SyncopeLoginModule.java
index 3d6eb66..1e194b6 100644
--- a/jaas/modules/src/main/java/org/apache/karaf/jaas/modules/syncope/SyncopeLoginModule.java
+++ b/jaas/modules/src/main/java/org/apache/karaf/jaas/modules/syncope/SyncopeLoginModule.java
@@ -101,10 +101,11 @@ public class SyncopeLoginModule extends AbstractKarafLoginModule {
             LOGGER.debug("Populating principals with user");
             principals.add(new UserPrincipal(user));
             LOGGER.debug("Retrieving user {} roles", user);
+            String responseSt = EntityUtils.toString(response.getEntity());
             if (version.equals("2.x") || version.equals("2")) {
-                roles = extractingRolesSyncope2(EntityUtils.toString(response.getEntity()));
+                roles = extractingRolesSyncope2(responseSt);
             } else {
-                roles = extractingRolesSyncope1(EntityUtils.toString(response.getEntity()));
+                roles = extractingRolesSyncope1(responseSt);
             }
         } catch (Exception e) {
             LOGGER.error("User {} authentication failed", user, e);
@@ -162,6 +163,7 @@ public class SyncopeLoginModule extends AbstractKarafLoginModule {
      * @return the list of user roles.
      * @throws Exception in case of extractiong failure.
      */
+    @SuppressWarnings("unchecked")
     protected List<String> extractingRolesSyncope2(String response) throws Exception {
         List<String> roles = new ArrayList<>();
         if (response != null && !response.isEmpty()) {