Note that there are some explanatory texts on larger screens.

plurals
  1. POSpring Security on a JSF 2.1 web app
    text
    copied!<p>I'm just getting started with Spring Security 3.1 and I haven't found a way to implment it on top of a JSF 2.1 web app. I currently have:</p> <p>A web.xml with:</p> <pre><code> &lt;context-param&gt; &lt;param-name&gt;contextConfigLocation&lt;/param-name&gt; &lt;param-value&gt;classpath:applicationContext-business.xml /WEB-INF/applicationContext-security.xml &lt;/param-value&gt; </code></pre> <p></p> <pre><code>&lt;filter&gt; &lt;filter-name&gt;springSecurityFilterChain&lt;/filter-name&gt; &lt;filter-class&gt;org.springframework.web.filter.DelegatingFilterProxy&lt;/filter-class&gt; &lt;/filter&gt; &lt;filter-mapping&gt; &lt;filter-name&gt;springSecurityFilterChain&lt;/filter-name&gt; &lt;url-pattern&gt;/*&lt;/url-pattern&gt; &lt;/filter-mapping&gt; &lt;listener&gt; &lt;listener-class&gt;org.springframework.web.context.ContextLoaderListener&lt;/listener-class&gt; &lt;/listener&gt; </code></pre> <p>And my applicationContext-security.xml:</p> <pre><code>&lt;beans:beans xmlns="http://www.springframework.org/schema/security" xmlns:beans="http://www.springframework.org/schema/beans" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.0.xsd http://www.springframework.org/schema/security http://www.springframework.org/schema/security/spring-security-3.1.xsd"&gt; &lt;http pattern="/resources/**" security="none" /&gt; &lt;http use-expressions="true"&gt; &lt;intercept-url pattern="/administracion/departamentos/**" access="recursoshumanos" /&gt; &lt;intercept-url pattern="/administracion/derechos/**" access="recursoshumanos" /&gt; &lt;intercept-url pattern="/administracion/diasfestivos/**" access="recursoshumanos" /&gt; &lt;intercept-url pattern="/administracion/dias/**" access="recursoshumanos" /&gt; &lt;intercept-url pattern="/administracion/solicitudes/**" access="recursoshumanos" /&gt; &lt;intercept-url pattern="/administracion/empleados/**" access="recursoshumanos" /&gt; &lt;/http&gt; &lt;authentication-manager&gt; &lt;authentication-provider&gt; &lt;user-service&gt; &lt;user name="rod" password="koala" authorities="recursoshumanos" /&gt; &lt;user name="dianne" password="emu" authorities="jefe" /&gt; &lt;user name="scott" password="wombat" authorities="jefe" /&gt; &lt;/user-service&gt; &lt;/authentication-provider&gt; &lt;/authentication-manager&gt; </code></pre> <p> </p> <p>I'm guessing this example would work with a regular .jsp but I'm probably missing additional steps to make it work with JSF, unfortunately, I haven't been able to find a fully working example so far. What do i need to do? Thanks!</p> <p>Edit: The problem is that i can still navigate freely to the secured areas of the application without needing to log in.</p> <p>Edit: BTW, I just noticed that a filter to the root of the web app does indeed trigger the authentication mechanism. It still fails everywhere else though. </p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload