Note that there are some explanatory texts on larger screens.

plurals
  1. POAccess a controller before authentication Spring Security
    primarykey
    data
    text
    <p>I've been trying to implement a solution for multiple login pages. I currently have a unique LoginController, and all it does is to retrieve the login jsp when somebody request /app_name/login.htm. I want that to stay that way, but also add two more locations: /app_name/customers/login.htm and /app_name/employees/login.htm each one with an individual controller CustomerLoginController and EmployeeLoginController. </p> <p>So my idea is that employees access through their URL and customer using theirs, but if someone try to access the old login.htm the controller redirects him/her to their respective login using an stored cookie and customer as default.</p> <p>To me it sounds good, but when I tried to access /app_name/customers/login.htm or /app_name/employees/login.htm it just redirects me to login.htm when I'm not authenticated.</p> <p>I really don't know why it's not resolving them. Any opinion, suggestion, guide, tutorial, example code or link would be helpful.</p> <p>The project I'm working on has this configs</p> <p><strong>Web.xml</strong> </p> <pre><code>&lt;!-- Spring Security --&gt; &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; </code></pre> <p><strong>servlet-config.xml</strong></p> <pre><code>&lt;!-- Controllers Mapping --&gt; &lt;context:component-scan base-package="com.company.project.controllers"&gt; &lt;context:include-filter type="annotation" expression="org.springframework.stereotype.Controller"/&gt; &lt;/context:component-scan&gt; </code></pre> <p><strong>security-context.xml</strong></p> <pre><code>&lt;sec:http auto-config="false" entry-point-ref="authenticationProcessingFilterEntryPoint" access-denied-page="/warning/accessDenied.htm" &gt; &lt;sec:intercept-url pattern="/employees/login.htm" filters="none" /&gt; &lt;sec:intercept-url pattern="/customers/login.htm" filters="none" /&gt; &lt;sec:intercept-url pattern="/login**" filters="none" /&gt; &lt;/sec:http&gt; &lt;bean id="authenticationProcessingFilterEntryPoint" class="org.springframework.security.ui.webapp.AuthenticationProcessingFilterEntryPoint"&gt; &lt;property name="loginFormUrl" value="/login.htm" /&gt; &lt;property name="forceHttps" value="false" /&gt; &lt;/bean&gt; &lt;bean id="authenticationProcessingFilter" class="org.springframework.security.ui.webapp.AuthenticationProcessingFilter"&gt; &lt;property name="authenticationFailureUrl" value="/login.htm?login_error=1"/&gt; &lt;property name="defaultTargetUrl" value="/home.htm"/&gt; &lt;property name="alwaysUseDefaultTargetUrl" value="true"/&gt; &lt;property name="filterProcessesUrl" value="/j_spring_security_check"/&gt; &lt;/bean&gt; </code></pre> <p>PD: using Spring 2.5.4 and Spring Security 2.0.4 -_- I Know, but is a fairly sized project and it's been in production for a while</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

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