1

I am looking some example for integration of latest Spring framework security with Hibernate based on annotation( ie JPA) with user credential from the DB. How can I do this? can I go for password encoding and decoding with Spring?

One of the solution available is with link here but this is based on Spring 2.5 with XML configuration. I want to avoid xml and use annotation.

Community
  • 1
  • 1
TechFind
  • 3,696
  • 18
  • 47
  • 62

1 Answers1

2

Use Spring source documentation. Everything you needed is given on documentation. And yeah! you can go with password encoding and decoding with spring. Just write your encoding class which will extend the org.springframework.security.authentication.encoding.MessageDigestPasswordEncoder.

public class MyPassEncoder extends org.springframework.security.authentication.encoding.MessageDigestPasswordEncoder
{
   MyPassEncoder(){
   super("MD5");
}
public String encodePassword(String rawPass, Object salt) {
   String encPass =  super.encodePassword(rawPass, salt);
   return encPass;
}
}
Nandkumar Tekale
  • 16,024
  • 8
  • 58
  • 85
  • there is no example given in that document for Spring security with Hibernate based on Annotation concept. – TechFind Dec 21 '11 at 07:19
  • download examples from spring security documentation - chapter no. 4 http://static.springsource.org/spring-security/site/docs/3.1.x/reference/springsecurity-single.html#sample-apps – Nandkumar Tekale Dec 21 '11 at 08:13