karaf-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jbono...@apache.org
Subject karaf git commit: KARAF-4293 - Set content-type header in Syncope login module
Date Mon, 01 Feb 2016 09:04:54 GMT
Repository: karaf
Updated Branches:
  refs/heads/karaf-4.0.x 338582652 -> 18043105d


KARAF-4293 - Set content-type header in Syncope login module


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

Branch: refs/heads/karaf-4.0.x
Commit: 18043105d44a12a0d6ba518fcc316969f1e3b42f
Parents: 3385826
Author: Jean-Baptiste Onofré <jbonofre@apache.org>
Authored: Mon Feb 1 08:30:54 2016 +0100
Committer: Jean-Baptiste Onofré <jbonofre@apache.org>
Committed: Mon Feb 1 08:31:40 2016 +0100

----------------------------------------------------------------------
 .../apache/karaf/jaas/modules/syncope/SyncopeBackingEngine.java  | 4 ++++
 .../apache/karaf/jaas/modules/syncope/SyncopeLoginModule.java    | 1 +
 2 files changed, 5 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/karaf/blob/18043105/jaas/modules/src/main/java/org/apache/karaf/jaas/modules/syncope/SyncopeBackingEngine.java
----------------------------------------------------------------------
diff --git a/jaas/modules/src/main/java/org/apache/karaf/jaas/modules/syncope/SyncopeBackingEngine.java
b/jaas/modules/src/main/java/org/apache/karaf/jaas/modules/syncope/SyncopeBackingEngine.java
index d935230..d3121ca 100644
--- a/jaas/modules/src/main/java/org/apache/karaf/jaas/modules/syncope/SyncopeBackingEngine.java
+++ b/jaas/modules/src/main/java/org/apache/karaf/jaas/modules/syncope/SyncopeBackingEngine.java
@@ -59,6 +59,7 @@ public class SyncopeBackingEngine implements BackingEngine {
             throw new IllegalArgumentException("Group prefix " + GROUP_PREFIX + " not permitted
with Syncope backend");
         }
         HttpPost request = new HttpPost(address + "/users");
+        request.setHeader("Content-Type", "application/xml");
         String userTO = "<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"yes\"?>"
+
                 "<user>" +
                 "<attributes>" +
@@ -84,6 +85,7 @@ public class SyncopeBackingEngine implements BackingEngine {
             throw new IllegalArgumentException("Group prefix " + GROUP_PREFIX + " not permitted
with Syncope backend");
         }
         HttpDelete request = new HttpDelete(address + "/users/" + username);
+        request.setHeader("Content-Type", "application/xml");
         try {
             client.execute(request);
         } catch (Exception e) {
@@ -95,6 +97,7 @@ public class SyncopeBackingEngine implements BackingEngine {
     public List<UserPrincipal> listUsers() {
         List<UserPrincipal> users = new ArrayList<>();
         HttpGet request = new HttpGet(address + "/users");
+        request.setHeader("Content-Type", "application/xml");
         try {
             HttpResponse response = client.execute(request);
             String responseTO = EntityUtils.toString(response.getEntity());
@@ -122,6 +125,7 @@ public class SyncopeBackingEngine implements BackingEngine {
     public List<RolePrincipal> listRoles(Principal principal) {
         List<RolePrincipal> roles = new ArrayList<>();
         HttpGet request = new HttpGet(address + "/users?username=" + principal.getName());
+        request.setHeader("Content-Type", "application/xml");
         try {
             HttpResponse response  = client.execute(request);
             String responseTO = EntityUtils.toString(response.getEntity());

http://git-wip-us.apache.org/repos/asf/karaf/blob/18043105/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 248512d..ea5b94d 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
@@ -81,6 +81,7 @@ public class SyncopeLoginModule extends AbstractKarafLoginModule {
         Credentials creds = new UsernamePasswordCredentials(user, password);
         client.getCredentialsProvider().setCredentials(AuthScope.ANY, creds);
         HttpGet get = new HttpGet(address + "/users/self");
+        get.setHeader("Content-Type", "application/xml");
         List<String> roles = new ArrayList<String>();
         try {
             CloseableHttpResponse response = client.execute(get);


Mime
View raw message