cancel
Showing results for 
Search instead for 
Did you mean: 

Custom web.xml

fo1337
Champ in-the-making
Champ in-the-making
What is the best way to customize web.xml? I'd like to NOT change the original web.xml file, but rather provide a customized version outside of the .war. I've attempted to create a custom-web-context.xml in the classPath but somehow it doesn't work… Thank you.
5 REPLIES 5

fo1337
Champ in-the-making
Champ in-the-making
Anybody? I'm trying to find a way to add elements to web.xml, outside of the WEB-INF folder, so I can redeploy without worrying about my custom configuration. In this case I'm trying to modify the authentication filter…

dward
Champ on-the-rise
Champ on-the-rise
In v3.2 there should be no need to change the authentication filters in web.xml. It now declares some standard proxy filters that call through to your selected authentication subsystem. So if one of the off-the-shelf authentication subsystems is suitable for you, you shouldn't need a custom web.xml anymore. Just an alfresco-global.properties with the appropriate settings.

See

http://wiki.alfresco.com/wiki/Alfresco_Authentication_Subsystems

If working with v3.2 isn't yet a possibility or you want to use a different filter that hasn't been packaged into a subystem, then I'm afraid the only option would be to write your own scripts (e.g. using ant) to transform web.xml and add in your desired changes.

fo1337
Champ in-the-making
Champ in-the-making
I'm trying to use HTTPRequestAuthenticationFilter as per the Wiki at http://wiki.alfresco.com/wiki/SSO, so I can use my CAS to auth my users. For that it seems my only option is to change web.xml, even with 3.2. I wish the HTTP filter would make it to the subsystems.

Anyway, the HTTP filter works great with Alfresco but not with Share. I've tried to apply the same config to Share's web.xml to no avail (I get some 404 error for some reason). Here is Share's web.xml:

<?xml version='1.0' encoding='UTF-8'?><!DOCTYPE web-app PUBLIC "-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN" "http://java.sun.com/dtd/web-app_2_3.dtd"><web-app>   <display-name>Alfresco Project Slingshot</display-name>   <description>Alfresco Project Slingshot application</description>   <context-param>      <param-name>org.jboss.jbossfaces.WAR_BUNDLES_JSF_IMPL</param-name>      <param-value>true</param-value>   </context-param>   <context-param>      <param-name>contextConfigLocation</param-name>      <param-value>         classpath:alfresco/webscript-framework-application-context.xml         classpath:alfresco/web-framework-model-context.xml         classpath:alfresco/web-framework-application-context.xml         classpath*:alfresco/web-extension/custom-web-framework-application-context.xml         classpath:alfresco/slingshot-application-context.xml         classpath*:alfresco/web-extension/custom-slingshot-application-context.xml      </param-value>      <description>Spring config file locations</description>   </context-param>   <context-param>      <param-name>contextClass</param-name>      <param-value>org.alfresco.config.JBossEnabledWebApplicationContext</param-value>      <description>Spring context class</description>   </context-param>   <filter>      <filter-name>Authentication Filter</filter-name>      <filter-class>org.alfresco.web.app.servlet.HTTPRequestAuthenticationFilter</filter-class>      <init-param>         <param-name>httpServletRequestAuthHeaderName</param-name>         <param-value>REMOTE_USER</param-value>      </init-param>   </filter>   <filter-mapping>      <filter-name>Authentication Filter</filter-name>      <url-pattern>/page/*</url-pattern>   </filter-mapping>   <filter-mapping>      <filter-name>Authentication Filter</filter-name>      <url-pattern>/p/*</url-pattern>   </filter-mapping>   <filter-mapping>      <filter-name>Authentication Filter</filter-name>      <url-pattern>/s/*</url-pattern>   </filter-mapping>   <listener>      <listener-class>org.springframework.web.context.ContextLoaderListener</listener-class>   </listener>   <servlet>      <servlet-name>apiServlet</servlet-name>      <servlet-class>org.alfresco.web.scripts.servlet.WebScriptServlet</servlet-class>      <init-param>         <param-name>container</param-name>         <param-value>webframework.webscripts.container</param-value>      </init-param>      <!–      <init-param>         <param-name>authenticator</param-name>         <param-value>webscripts.authenticator.basic</param-value>      </init-param>      –>   </servlet>   <servlet>      <servlet-name>feedApiServlet</servlet-name>      <servlet-class>org.alfresco.web.site.servlet.WebScriptFeedServlet</servlet-class>      <init-param>         <param-name>container</param-name>         <param-value>webframework.webscripts.container</param-value>      </init-param>      <init-param>         <param-name>authenticator</param-name>         <param-value>webscripts.authenticator.delegatingbasic</param-value>      </init-param>   </servlet>   <servlet>      <servlet-name>proxyServlet</servlet-name>      <servlet-class>org.alfresco.web.scripts.servlet.EndPointProxyServlet</servlet-class>   </servlet>   <servlet>      <servlet-name>uriTemplateServlet</servlet-name>      <servlet-class>org.alfresco.web.uri.UriTemplateServlet</servlet-class>   </servlet>   <!– The Web Framework Dispatcher Servlet –>   <servlet>      <servlet-name>pageRendererServlet</servlet-name>      <servlet-class>org.alfresco.web.site.servlet.DispatcherServlet</servlet-class>      <load-on-startup>1</load-on-startup>   </servlet>   <servlet>      <servlet-name>frameworkControlServlet</servlet-name>      <servlet-class>org.alfresco.web.site.servlet.FrameworkControlServlet</servlet-class>   </servlet>   <servlet>      <servlet-name>loginServlet</servlet-name>      <servlet-class>org.alfresco.web.site.servlet.LoginServlet</servlet-class>   </servlet>   <servlet>      <servlet-name>logoutServlet</servlet-name>      <servlet-class>org.alfresco.web.site.servlet.LogoutServlet</servlet-class>   </servlet>   <servlet-mapping>      <servlet-name>logoutServlet</servlet-name>      <url-pattern>/logout</url-pattern>   </servlet-mapping>   <servlet-mapping>      <servlet-name>loginServlet</servlet-name>      <url-pattern>/login/*</url-pattern>   </servlet-mapping>   <servlet-mapping>      <servlet-name>apiServlet</servlet-name>      <url-pattern>/service/*</url-pattern>   </servlet-mapping>   <servlet-mapping>      <servlet-name>feedApiServlet</servlet-name>      <url-pattern>/feedservice/*</url-pattern>   </servlet-mapping>   <servlet-mapping>      <servlet-name>proxyServlet</servlet-name>      <url-pattern>/proxy/*</url-pattern>   </servlet-mapping>   <servlet-mapping>      <servlet-name>pageRendererServlet</servlet-name>      <url-pattern>/page/*</url-pattern>   </servlet-mapping>   <servlet-mapping>      <servlet-name>pageRendererServlet</servlet-name>      <url-pattern>/p/*</url-pattern>   </servlet-mapping>   <servlet-mapping>      <servlet-name>uriTemplateServlet</servlet-name>      <url-pattern>/s/*</url-pattern>   </servlet-mapping>   <servlet-mapping>      <servlet-name>frameworkControlServlet</servlet-name>      <url-pattern>/control/*</url-pattern>   </servlet-mapping>   <session-config>      <session-timeout>60</session-timeout>   </session-config>   <!– welcome file list precedence order is index.jsp, then index.html –>   <welcome-file-list>      <welcome-file>index.jsp</welcome-file>      <welcome-file>index.html</welcome-file>   </welcome-file-list></web-app>‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍

kbonnet
Champ in-the-making
Champ in-the-making
Did you get this any further? For a customer i'm in the same need.

Thanks,

Koen

kbonnet
Champ in-the-making
Champ in-the-making
Hi fo1337,

The HTTP Header filter can now be replaced with the External Authentication Subsystem, which you can configure from the alfresco-global.properties.

Please note that there are still minor problems with this subsystem and you need at least 3.2r2.

Good luck,
Koen