cxf-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From owu...@apache.org
Subject svn commit: r1574223 - in /cxf/fediz/trunk/plugins: jetty/src/main/java/org/apache/cxf/fediz/jetty/FederationAuthenticator.java tomcat/src/main/java/org/apache/cxf/fediz/tomcat/FederationAuthenticator.java
Date Tue, 04 Mar 2014 22:12:55 GMT
Author: owulff
Date: Tue Mar  4 22:12:55 2014
New Revision: 1574223

URL: http://svn.apache.org/r1574223
Log:
[FEDIZ-79] Encoding of SignInResponse configurable

Modified:
    cxf/fediz/trunk/plugins/jetty/src/main/java/org/apache/cxf/fediz/jetty/FederationAuthenticator.java
    cxf/fediz/trunk/plugins/tomcat/src/main/java/org/apache/cxf/fediz/tomcat/FederationAuthenticator.java

Modified: cxf/fediz/trunk/plugins/jetty/src/main/java/org/apache/cxf/fediz/jetty/FederationAuthenticator.java
URL: http://svn.apache.org/viewvc/cxf/fediz/trunk/plugins/jetty/src/main/java/org/apache/cxf/fediz/jetty/FederationAuthenticator.java?rev=1574223&r1=1574222&r2=1574223&view=diff
==============================================================================
--- cxf/fediz/trunk/plugins/jetty/src/main/java/org/apache/cxf/fediz/jetty/FederationAuthenticator.java
(original)
+++ cxf/fediz/trunk/plugins/jetty/src/main/java/org/apache/cxf/fediz/jetty/FederationAuthenticator.java
Tue Mar  4 22:12:55 2014
@@ -22,6 +22,7 @@ package org.apache.cxf.fediz.jetty;
 import java.io.File;
 import java.io.IOException;
 import java.io.InputStream;
+import java.io.UnsupportedEncodingException;
 import java.security.cert.X509Certificate;
 
 import javax.servlet.ServletOutputStream;
@@ -83,6 +84,7 @@ public class FederationAuthenticator ext
        
     private String configFile;
     private FederationConfigurator configurator;
+    private String encoding = "UTF-8";
 
     public FederationAuthenticator() {
     }
@@ -130,6 +132,14 @@ public class FederationAuthenticator ext
         this.configFile = configFile;
     }
     
+    public String getEncoding() {
+        return encoding;
+    }
+
+    public void setEncoding(String encoding) {
+        this.encoding = encoding;
+    }
+    
     /* ------------------------------------------------------------ */
     public Authentication validateRequest(ServletRequest req, ServletResponse res, boolean
mandatory)
         throws ServerAuthException {
@@ -137,7 +147,13 @@ public class FederationAuthenticator ext
         if (!mandatory) {
             return new DeferredAuthentication(this);
         }
-
+        
+        try {
+            req.setCharacterEncoding(this.encoding);
+        } catch (UnsupportedEncodingException ex) {
+            LOG.warn("Unsupported encoding '" + this.encoding + "'", ex);
+        }
+        
         HttpServletRequest request = (HttpServletRequest)req;
         HttpServletResponse response = (HttpServletResponse)res;
         String uri = request.getRequestURI();

Modified: cxf/fediz/trunk/plugins/tomcat/src/main/java/org/apache/cxf/fediz/tomcat/FederationAuthenticator.java
URL: http://svn.apache.org/viewvc/cxf/fediz/trunk/plugins/tomcat/src/main/java/org/apache/cxf/fediz/tomcat/FederationAuthenticator.java?rev=1574223&r1=1574222&r2=1574223&view=diff
==============================================================================
--- cxf/fediz/trunk/plugins/tomcat/src/main/java/org/apache/cxf/fediz/tomcat/FederationAuthenticator.java
(original)
+++ cxf/fediz/trunk/plugins/tomcat/src/main/java/org/apache/cxf/fediz/tomcat/FederationAuthenticator.java
Tue Mar  4 22:12:55 2014
@@ -76,6 +76,7 @@ public class FederationAuthenticator ext
      */
     protected String configFile;
     protected boolean tokenExpirationValidation = true;
+    protected String encoding = "UTF-8";
 
     private FederationConfigurator configurator;
 
@@ -99,6 +100,14 @@ public class FederationAuthenticator ext
         this.configFile = configFile;
     }
     
+    public String getEncoding() {
+        return encoding;
+    }
+
+    public void setEncoding(String encoding) {
+        this.encoding = encoding;
+    }
+    
     public boolean isTokenExpirationValidation() {
         return tokenExpirationValidation;
     }
@@ -166,6 +175,8 @@ public class FederationAuthenticator ext
     ServletException {
 
         LOG.debug("WsFedAuthenticator:invoke()");
+        request.setCharacterEncoding(this.encoding);
+        
         if (request.getRequestURL().indexOf(FederationConstants.METADATA_PATH_URI) != -1)
{
             if (LOG.isInfoEnabled()) {
                 LOG.info("WS-Federation Metadata document requested");



Mime
View raw message