-
FEATURED COMPONENTS
First time here? Check out the FAQ!
Is there any step by step tutorial available for ZK + Hibernate + Spring Security Login
In order to use Hibernate to retrieve and validate the user, you may want to implement the org.springframework.security.authentication.AuthenticationProvider interface.
E.g.:
@Override
public Authentication authenticate(Authentication authentication) throws AuthenticationException {
Authentication auth = null;
String login = authentication.getName();
String password = authentication.getCredentials().toString();
MyUser user = myHibernateSession.findByLogin();
....
if (user == null || !MyPasswordChecker.passwordMatches(user, password)){
return null;
}else{
List<GrantedAuthority> grantedAuths = new ArrayList<GrantedAuthority>();
grantedAuths.add(new SimpleGrantedAuthority("ROLE_USER"));
return new Authentication(user, null, grantedAuths);
}
}
PS: The code above is super simple and it's purpose is just to clarify how to implement a custom spring security authenticator.
I hope this help.
Gyo
Thank you. But it is very old question of mine. After , i created several examples and you can check here
Hello, may be this thread is old, but I face some problem here.
I do my code using ZK Spring Core 3.1.1, ZK Spring Security 3.1.1 and finally ZK EE 7.0.6.1.
I've been looking for same question, but didn't find what I looking for.
Then I found this forum, like gywanny answered above, we can implement this class: org.springframework.security.authentication.AuthenticationProvider.
But, I don't find that mentioned class.
Asked: 2012-11-17 08:06:00 +0800
Seen: 156 times
Last updated: Sep 11 '15