You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by Marc Boorshtein <mb...@gmail.com> on 2011/06/01 13:15:08 UTC

Re: Request headers created in valve don't make it to application

So I tried moving the configuraiton of the valve into the app's
META-INF/context.xml with no success.  One thing I didn't mention that
is interesting is that the I do set the request's setUserPrincipal(..)
and that works.

Thanks
Marc

On Tue, May 31, 2011 at 5:27 PM, Marc Boorshtein <mb...@gmail.com> wrote:
>>
>> Do you have any filters or other valves that might be wrapping the request and choosing to ignore your extra headers?
>>
>
> No, the app is just a servlet that loops over all the headers and
> cookies and generates a properties response
>
>> 1) Show us your modified conf/context.xml.
>
> <!-- The contents of this file will be loaded for each web application -->
> <Context>
>
>    <!-- Default set of monitored resources -->
>    <WatchedResource>WEB-INF/web.xml</WatchedResource>
>
>    <!-- Uncomment this to disable session persistence across Tomcat
> restarts -->
>    <!--
>    <Manager pathname="" />
>    -->
>
>    <!-- Uncomment this to enable Comet connection tacking (provides events
>         on session expiration as well as webapp lifecycle) -->
>    <!--
>    <Valve className="org.apache.catalina.valves.CometConnectionManagerValve" />
>    -->
>    <!-- <Context path="/echo"> -->
>         <Valve className="com.tremolosecurity.valve.TremoloValve"
> headerName="autoidmrequest" userAttribute="from-assertion-uid"
> roleAttribute="role" createHeaders="true" encryptionKeyName="lastMile"
> ignoreURI="" pathToKeyStore="WEB-INF/autoIdmSession.jks"
> keyPass="start123" />
>    <!-- </Context> -->
> </Context>
>
>
>>
>> 2) Show us your Valve code.  (It is simple, right?)
>
> Iterator<Attribute> attribs = lastmile.getAttributes().iterator();
>                                while (attribs.hasNext()) {
>                                        Attribute attrib = attribs.next();
>                                                if (this.createHeaders) {
>                                                        logger.info("creating header");
>                                                for (String val : attrib.getValues()) {
>                                                        logger.info(attrib.getName() + "=" + val);
>                                                        request.addHeader(attrib.getName(), val);
>                                                }
>                                        }
> .
> .
> .
>
> [2011-05-31 15:22:11,262][http-8080-1] INFO  AutoIDMFilter - true
> [2011-05-31 15:22:11,262][http-8080-1] INFO  AutoIDMFilter - creating header
> [2011-05-31 15:22:11,263][http-8080-1] INFO  AutoIDMFilter -
> from-assertion-uid=testStaticGroupSucceed
> [2011-05-31 15:22:11,264][http-8080-1] INFO  AutoIDMFilter - creating header
> [2011-05-31 15:22:11,264][http-8080-1] INFO  AutoIDMFilter -
> from-assertion-sn=User
> [2011-05-31 15:22:11,264][http-8080-1] INFO  AutoIDMFilter - creating header
> [2011-05-31 15:22:11,265][http-8080-1] INFO  AutoIDMFilter -
> from-assertion-cn=Test User
>
>>
>> 3) Show us the WEB-INF/web.xml and <Context> element for your webapp.
> <?xml version="1.0"?>
> <web-app xmlns="http://java.sun.com/xml/ns/j2ee"
>         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
>         xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee
> http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd"
>         version="2.4">
>
> <servlet>
>      <servlet-name>echo</servlet-name>
>      <servlet-class>com.tremolosecurity.test.servlet.EchoServlet</servlet-class>
>    </servlet>
>
>
>
> <servlet-mapping>
>        <servlet-name>echo</servlet-name>
>        <url-pattern>/echo</url-pattern>
>    </servlet-mapping>
>
>    <servlet-mapping>
>        <servlet-name>echo</servlet-name>
>        <url-pattern>/echo and echo</url-pattern>
>    </servlet-mapping>
> </web-app>
>
> Thanks
> Marc
>

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org