I want to use Spring security in my pf mobile app, the problem is that after a successful login, the login page is showed again. I don't know what can be wrong, I appreciate any help...
Here is my Spring security xml config:
Code: Select all
<http auto-config="true" access-decision-manager-ref="accessDecisionManager">
<intercept-url pattern="/user_home/*" access="ROLE_USUARIO_BASE" />
<intercept-url pattern="/hoja_verificacion/*" access="ROLE_CONTROLADOR_QC" />
<form-login login-page="/login.jsf" default-target-url="/user_home/home.jsf" authentication-failure url="/fallo.jsf" always-use-default-target="true" />
</http>
<authentication-manager>
<authentication-provider user-service-ref="sgccUserDetailService">
</authentication-provider>
</authentication-manager>
<beans:bean id="sgccUserDetailService"
class="com.dbmobile.soft.web.sgcc.security.UserDetailsServiceImpl"></beans:bean>
<beans:bean id="loggerListener"
class="org.springframework.security.authentication.event.LoggerListener" />
Code: Select all
public String login() throws ServletException, IOException {
ExternalContext context = FacesContext.getCurrentInstance()
.getExternalContext();
RequestDispatcher dispatcher = ((ServletRequest) context.getRequest())
.getRequestDispatcher("/login_url");
dispatcher.forward((ServletRequest) context.getRequest(),
(ServletResponse) context.getResponse());
FacesContext.getCurrentInstance().responseComplete();
return null;
}
Code: Select all
<f:view xmlns="http://www.w3.org/1999/xhtml"
xmlns:f="http://java.sun.com/jsf/core"
xmlns:h="http://java.sun.com/jsf/html"
xmlns:p="http://primefaces.org/ui"
xmlns:pm="http://primefaces.org/mobile" contentType="text/html"
renderKitId="PRIMEFACES_MOBILE">
<pm:page title="Login" mini="true">
<pm:view id="login">
<pm:header title="Login" swatch="b">
</pm:header>
<pm:content>
<h:form prependId="false">
<p:messages showDetail="true" autoUpdate="true" sticky="true" />
<h:outputLabel value="Username:" />
<p:inputText id="j_username" required="true" />
<h:outputLabel value="Password:" />
<h:inputSecret id="j_password" required="true" />
<p:commandButton value="Login" action="#{loginBean.login}"
type="submit" />
</h:form>
</pm:content>
<pm:footer swatch="b" fixed="true">
<h:outputLabel value="Footer" />
</pm:footer>
</pm:view>
</pm:page>
</f:view>