java - Why would a Spring login form not reveal any error information for a failed login? -


my spring mvc app not allowing logins , can't figure out why.

i've added logging login controller nothing being outputted there.

the login page seems automatically redirect error page without going through login controller.

any ideas how debug problem?

<http auto-config="false" access-decision-manager-ref="accessdecisionmanager" use-expressions="true">     <intercept-url pattern="/login/**" access="hasrole('role_anonymous')" requires-channel="${application.securechannel}" />     <intercept-url pattern="/error/**" access="hasrole('role_anonymous')" requires-channel="http" />     <intercept-url pattern="/register/**" access="hasrole('role_anonymous')" requires-channel="${application.securechannel}" />     <intercept-url pattern="/" access="hasrole('role_anonymous')" requires-channel="http" />     <intercept-url pattern="/**" access="hasrole('role_user')" requires-channel="http" />     <form-login login-page="/login" login-processing-url="/login/submit" authentication-failure-url="/login/error" />     <logout logout-url="/logout" /> </http>  <authentication-manager alias="authenticationmanager">     <authentication-provider user-service-ref="userdetailsservice">         <password-encoder hash="sha-256" base64="true">             <salt-source user-property="salt" />         </password-encoder>     </authentication-provider> </authentication-manager>  <beans:bean id="userdetailsservice" class="com.my.userdetailsserviceimpl"> </beans:bean>  <beans:bean id="passwordencoder" class="org.springframework.security.authentication.encoding.shapasswordencoder">     <beans:constructor-arg value="256" />     <beans:property name="encodehashasbase64" value="true" /> </beans:bean>  <beans:bean id="rolehierarchy" class="org.springframework.security.access.hierarchicalroles.rolehierarchyimpl">     <beans:property name="hierarchy">         <beans:value>             role_admin > role_user             role_user > role_anonymous         </beans:value>     </beans:property> </beans:bean>  <beans:bean id="accessdecisionmanager" class="org.springframework.security.access.vote.affirmativebased">     <beans:property name="decisionvoters">         <beans:list>             <beans:bean class="org.springframework.security.web.access.expression.webexpressionvoter">                 <beans:property name="expressionhandler">                     <beans:bean class="org.springframework.security.web.access.expression.defaultwebsecurityexpressionhandler">                         <beans:property name="rolehierarchy" ref="rolehierarchy" />                     </beans:bean>                 </beans:property>             </beans:bean>         </beans:list>     </beans:property> </beans:bean> 

my spring mvc app not allowing logins , can't figure out why.

ensure have added following line in log4j.properties logging security related exception.

log4j.logger.org.springframework.security = debug 

if haven't added, it, after should able see like(shown below) in log file.

authentication request failed: org.springframework.security.authentication.badcredentialsexception: bad credentials 

in case want debug, put debug pointer in exceptiontranslationfilter.java in following method:

private void handleexception(httpservletrequest request, httpservletresponse response, filterchain chain,             runtimeexception exception) throws ioexception, servletexception {         if (exception instanceof authenticationexception) {             if (logger.isdebugenabled()) {                 logger.debug("authentication exception occurred; redirecting authentication entry point", exception);             }              sendstartauthentication(request, response, chain, (authenticationexception) exception);         }          ....     } 

i've added logging login controller nothing being outputted there.

your logincontroller not invoked till successful authentication.


Comments

Popular posts from this blog

c++ - Convert big endian to little endian when reading from a binary file -

C#: Application without a window or taskbar item (background app) that can still use Console.WriteLine() -

unicode - Are email addresses allowed to contain non-alphanumeric characters? -