Skip to content

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Encoding filter for a Shibboleth-protected Tomcat

License

Copyright [2015] [Robert Führicht robert.fuehricht@jku.at]

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License here

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

Purpose

Shibboleth SP provides its attributes to Apache in UTF-8. Sadly, if they are passed on to Tomcat, it defaults to ISO 8859-1 and doesn't enumerate passed AJP attributes (when using ShibUseEnvironment On)

AJP 1.3 doesn't specify which encoding its strings should be in, so it relies on HTTP. The RFC covering this isn't conclusive:

Historically, HTTP has allowed field content with text in the ISO-8859-1 charset [ISO-8859-1], supporting other charsets only through use of [RFC2047] encoding. In practice, most HTTP header field values use only a subset of the US-ASCII charset [USASCII]. Newly defined header fields SHOULD limit their field values to US-ASCII octets. A recipient SHOULD treat other octets in field content (obs-text) as opaque data.

Furthermore, it fixes getAttributeNames(), which doesn't yield anything when using AJP.

Usage

Add this to your web.xml

<filter>
  <filter-name>my-encoding-filter</filter-name>
  <filter-class>at.jku.filters.SetCharacterEncodingFilter</filter-class>
  <init-param>
    <param-name>encoding</param-name>
    <param-value>UTF-8</param-value>
  </init-param>
</filter>
 
<filter-mapping>
  <filter-name>my-encoding-filter</filter-name>
  <url-pattern>/*</url-pattern>
</filter-mapping>

Acknowledgements

SetCharacterEncodingFilter was taken and modified from the Tomcat 7.0.x tree.

About

Encoding filter for a Shibboleth-protected Tomcat

Resources

Stars

0 stars

Watchers

1 watching

Forks

Releases

Packages

Contributors

Languages