use of org.jbehave.example.spring.security.domain.User in project jbehave-core by jbehave.
the class AuthenticationEventListener method onAuthenticationSuccess.
protected void onAuthenticationSuccess(AuthenticationSuccessEvent event) {
// on success - principal is a UserDetails
UserDetails details = (UserDetails) event.getAuthentication().getPrincipal();
String username = details.getUsername();
if (!StringUtils.isBlank(username)) {
Long orgId = organizationManager.getOrganization().getId();
User user = userDao.findUserByOrganizationAndUsername(orgId, username);
if (user != null) {
user.setLoginFailureCount(0);
userDao.persist(user);
}
}
}
use of org.jbehave.example.spring.security.domain.User in project jbehave-core by jbehave.
the class UserDetailsServiceImpl method loadUserByUsername.
public UserDetails loadUserByUsername(String username) throws UsernameNotFoundException, DataAccessException {
Organization org = organizationManager.getOrganization();
User user = userDao.findUserByOrganizationAndUsername(org.getId(), username);
if (user == null) {
throw new UsernameNotFoundException(username);
}
return new UserDetailsImpl(user, org.getAuthenticationPolicy());
}
Aggregations