Repository: cxf-fediz Updated Branches: refs/heads/1.1.x-fixes b6fc8ee74 -> bd1832b02
[FEDIZ-79] Encoding of SignInResponse configurable git-svn-id: https://svn.apache.org/repos/asf/cxf/fediz/trunk@1574223 13f79535-47bb-0310-9956-ffa450edef68 Conflicts: plugins/jetty/src/main/java/org/apache/cxf/fediz/jetty/FederationAuthenticator.java Project: http://git-wip-us.apache.org/repos/asf/cxf-fediz/repo Commit: http://git-wip-us.apache.org/repos/asf/cxf-fediz/commit/bd1832b0 Tree: http://git-wip-us.apache.org/repos/asf/cxf-fediz/tree/bd1832b0 Diff: http://git-wip-us.apache.org/repos/asf/cxf-fediz/diff/bd1832b0 Branch: refs/heads/1.1.x-fixes Commit: bd1832b02f20ef5dfdda848a1880f8f383fd2255 Parents: b6fc8ee Author: owulff <owulff@unknown> Authored: Tue Mar 4 22:12:55 2014 +0000 Committer: Colm O hEigeartaigh <[email protected]> Committed: Tue May 27 17:35:01 2014 +0100 ---------------------------------------------------------------------- .../cxf/fediz/jetty/FederationAuthenticator.java | 17 +++++++++++++++++ .../cxf/fediz/tomcat/FederationAuthenticator.java | 11 +++++++++++ 2 files changed, 28 insertions(+) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/cxf-fediz/blob/bd1832b0/plugins/jetty/src/main/java/org/apache/cxf/fediz/jetty/FederationAuthenticator.java ---------------------------------------------------------------------- diff --git a/plugins/jetty/src/main/java/org/apache/cxf/fediz/jetty/FederationAuthenticator.java b/plugins/jetty/src/main/java/org/apache/cxf/fediz/jetty/FederationAuthenticator.java index fc52999..97d9a3c 100644 --- a/plugins/jetty/src/main/java/org/apache/cxf/fediz/jetty/FederationAuthenticator.java +++ b/plugins/jetty/src/main/java/org/apache/cxf/fediz/jetty/FederationAuthenticator.java @@ -21,6 +21,7 @@ package org.apache.cxf.fediz.jetty; import java.io.File; import java.io.IOException; +import java.io.UnsupportedEncodingException; import java.security.cert.X509Certificate; import javax.servlet.ServletRequest; @@ -81,6 +82,7 @@ public class FederationAuthenticator extends LoginAuthenticator { private String configFile; private FederationConfigurator configurator; + private String encoding = "UTF-8"; public FederationAuthenticator() { } @@ -128,9 +130,24 @@ public class FederationAuthenticator extends LoginAuthenticator { 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 { + + 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(); http://git-wip-us.apache.org/repos/asf/cxf-fediz/blob/bd1832b0/plugins/tomcat/src/main/java/org/apache/cxf/fediz/tomcat/FederationAuthenticator.java ---------------------------------------------------------------------- diff --git a/plugins/tomcat/src/main/java/org/apache/cxf/fediz/tomcat/FederationAuthenticator.java b/plugins/tomcat/src/main/java/org/apache/cxf/fediz/tomcat/FederationAuthenticator.java index 7216f17..083ba49 100644 --- a/plugins/tomcat/src/main/java/org/apache/cxf/fediz/tomcat/FederationAuthenticator.java +++ b/plugins/tomcat/src/main/java/org/apache/cxf/fediz/tomcat/FederationAuthenticator.java @@ -73,6 +73,7 @@ public class FederationAuthenticator extends FormAuthenticator { */ protected String configFile; protected boolean tokenExpirationValidation = true; + protected String encoding = "UTF-8"; private FederationConfigurator configurator; @@ -96,6 +97,14 @@ public class FederationAuthenticator extends FormAuthenticator { this.configFile = configFile; } + public String getEncoding() { + return encoding; + } + + public void setEncoding(String encoding) { + this.encoding = encoding; + } + public boolean isTokenExpirationValidation() { return tokenExpirationValidation; } @@ -163,6 +172,8 @@ public class FederationAuthenticator extends FormAuthenticator { 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");
