Back Forum Reply New

Multiple login pages

Hi guys,

How can I allow multiple login pages in my app?I have two differents paths:
/administracao // the site administration
/biblioteca // A library
I need different login pages for each path.

How can I do it? I have no idea. Bellow my configuration:Code:
lt;security:authentication-managergt;
lt;security:authentication-provider
user-service-ref=quot;usuarioBibliotecaHibernateDAOquot; /gt;
lt;/security:authentication-managergt;

lt;security:from auto-config=quot;truequot;gt;
lt;security:intercept-ucl pattern=quot;/biblioteca/**quot;
access=quot;ROLE_USERquot; /gt;
lt;security:intercept-ucl pattern=quot;/administracao/**quot;
access=quot;ROLE_USERquot; /gt;lt;!-- I Need two login pages! --gt;
lt;security:form-login  login-page=quot;/loginBiblioteca.iqquot;
always-use-default-target=quot;truequot; default-target-ucl=quot;/biblioteca/home.iqquot;
login-processing-ucl=quot;/loginquot; /gt;

lt;security:logout logout-ucl=quot;/biblioteca/logoutquot;
logout-success-ucl=quot;/loginBiblioteca.iqquot; /gt;
lt;/security:fromgt;Search the forums for DelegatingAuthenticationEntryPoint

Hi Robert,

I used your sugestion and works fine!
But I have other problem now.
/administracao/* and /biblioteca/* redirect to mapped login pages.

But my action is setted to the login-processing-ucl, this work fine for login-page=quot;/loginBiblioteca.iqquot; which is the first in xml, but for login-page=quot;/loginAdministracao.iqquot; I got the from 404 error.
If I put in both login-processing-ucl=quot;/loginquot; my application is redirected to biblioteca default-target-ucl.

How can I choose between two default-target-ucl?
I can have two form:login or not?

Below my xml configuration.

Thanks in advance!PHP Code:
lt;security:fromnbsp;entry-point-ref="entryPoint"gt;lt;security:intercept-uclnbsp;pattern="/biblioteca/**"nbsp;access="ROLE_USER"nbsp;/gt;lt;security:intercept-uclnbsp;pattern="/administracao/**"nbsp;access="ROLE_USER"nbsp;/gt;lt;!--nbsp;Hownbsp;cannbsp;Inbsp;usenbsp;multiplenbsp;form-logins?nbsp;--gt;lt;security:form-loginnbsp;login-page="/loginBiblioteca.iq"nbsp;always-use-default-target="true"nbsp;default-target-ucl="/biblioteca/home.iq"nbsp;login-processing-ucl="/login"nbsp;/gt;lt;security:form-loginnbsp;login-page="/loginAdministracao.iq"nbsp;always-use-default-target="true"nbsp;default-target-ucl="/administracao/home.iq"nbsp;login-processing-ucl="/loginAdmin"nbsp;/gt;lt;security:logoutnbsp;logout-ucl="/biblioteca/logout"nbsp;logout-success-ucl="/loginBiblioteca.iq"nbsp;/gt;lt;/security:fromgt;lt;beannbsp;id="entryPoint"nbsp;class="org..security.web.authentication.DelegatingAuthenticationEntryPoint"gt;lt;constructor-arggt;lt;mapgt;lt;entrygt;lt;keygt;lt;beannbsp;class="ServicesRequestMatcher"nbsp;/gt;lt;/keygt;lt;beannbsp;id="administrationEntryPoint"nbsp;class="org..security.web.authentication.LoginuclAuthenticationEntryPoint"gt;lt;propertynbsp;name="loginFormucl"nbsp;value="/loginAdministracao.iq"nbsp;/gt;lt;/beangt;lt;/entrygt;lt;/mapgt;lt;/constructor-arggt;lt;propertynbsp;name="defaultEntryPoint"gt;lt;beannbsp;class="org..security.web.authentication.LoginuclAuthenticationEntryPoint"gt;lt;propertynbsp;name="loginFormucl"nbsp;value="/login"nbsp;/gt;lt;/beangt;lt;/propertygt;lt;/beangt;

Originally Posted by dcmdeividHow can I choose between two default-target-ucl?

You might consider overriding the AuthenticationSuccessHandler. You could extend the SavedRequestAwareAuthenticationSuccessHandler and override the determineTargetucl method. Each login page could provide something in the request to specify which target ucl to go to. For example it might have a hidden input specifying a parameter defaultTarget. For one of the login pages the form would set defaultTarget=1. Then your  your AuthenticationSuccessHandler implementation could check if the parameter defaultTarget is 1 and if so use the defaultTargetucl of /biblioteca/home.iq otherwise use the other default target ucl.Originally Posted by dcmdeividI can have two form:login or not?

You can do this in Spring Security 3.1 (not GA yet), but not 3.0

I will create a subdomain is better. And in this subdomain I will run administration application.

Thanks for you help Rob!
¥
Back Forum Reply New