I am trying to implement sha password encoding in my application, but it does not seem to work for some reason. Passwords are encoded in the database, but I cannot log in: Your login attempt was not successful, try again. Reason: Bad credentials .
Here is what I have so far:
applicatioContext-security.xml
and under <authentication-provider>Code:<beans:bean id="passwordEncoder" class="org.springframework.security.authentication.encoding.ShaPasswordEncoder"> <beans:constructor-arg value="256"/> </beans:bean>
applicationContext.xmlCode:<password-encoder hash="sha-256"/>
And under User.javaCode:<bean id="PasswordEncoder" class="com.dissertation.webtools.domain.PasswordEncoder"> </bean>
Do you know why I cannot log in?Code:public void setPassword(String password) { PasswordEncoder enc = new PasswordEncoder(); System.out.println(password); this.password = enc.setEncrypt(password); }


Reply With Quote