Spring Security Custom Filter URL mapping is npt working with JdbcDAOImpl -
spring security.xml:
<!--form login--> <form-login login-page="/userlogin" default-target-url="/xplorehome" authentication-failure-handler-ref="exceptiontranslationfilter"/> <logout invalidate-session="true" logout-url="/logout" /> <!--exception filters--> <beans:bean id="exceptiontranslationfilter" class="org.springframework.security.web.authentication.exceptionmappingauthenticationfailurehandler"> <beans:property name="exceptionmappings"> <beans:props> <beans:prop key="org.springframework.security.authentication.badcredentialsexception">/userlogin?x=1</beans:prop> <beans:prop key="org.springframework.security.authentication.credentialsexpiredexception">/resetpasswd</beans:prop> <beans:prop key="org.springframework.security.authentication.lockedexception">/resetpasswd</beans:prop> <beans:prop key="org.springframework.secuirty.authentication.disabledexception">/resetpasswd</beans:prop> </beans:props> </beans:property> </beans:bean> <!--jdbc user service--> <jdbc-user-service data-source-ref="datasource" users-by-username-query="select emailaddress,password,active userdetails emailaddress=?" authorities-by-username-query="select ux.emailaddress,ax.authority userdetails ux,userauthority ax ux.pk_user_id=ax.pk_authority_id , ux.emailaddress=?" />
if active value in db column set 0 user disabled exception in browser instead of resetpassword page
resetpassword page accessible authenticated users.
how web app works or intended work:
when new user registers send temporary password email address , set active 0.
when uses password login first time need force him change password error
http status 401 - authentication failed: user disabled
and came across exception spring docs says if user account disabled never authenticate user , hence not able navigate resetpassword page, how resolve issue?and force user resetpassword page.
if works can apply logic forgotpwd logic too,where send temporary password user's email address , set active zero.
i hope make sense in above explanation!
Comments
Post a Comment