use of org.jbehave.example.spring.security.domain.User in project jbehave-core by jbehave.
the class UserSteps method setUserExpired.
@Given("user for $orgName $username is expired")
public void setUserExpired(String orgName, String username) {
Organization org = organizationDao.findByName(orgName);
User user = userDao.findUserByOrganizationAndUsername(org.getId(), username);
user.setExpired(true);
userDao.persist(user);
}
use of org.jbehave.example.spring.security.domain.User in project jbehave-core by jbehave.
the class UserSteps method setUserEnabled.
@Given("user for $orgName $username is enabled")
public void setUserEnabled(String orgName, String username) {
Organization org = organizationDao.findByName(orgName);
User user = userDao.findUserByOrganizationAndUsername(org.getId(), username);
user.setEnabled(true);
userDao.persist(user);
}
use of org.jbehave.example.spring.security.domain.User in project jbehave-core by jbehave.
the class UserSteps method setUserDisabled.
@Given("user for $orgName $username is disabled")
public void setUserDisabled(String orgName, String username) {
Organization org = organizationDao.findByName(orgName);
User user = userDao.findUserByOrganizationAndUsername(org.getId(), username);
user.setEnabled(false);
userDao.persist(user);
}
use of org.jbehave.example.spring.security.domain.User in project jbehave-core by jbehave.
the class UserSteps method createUserWithUsernameAndPassword.
@Given("a user for $orgName with username $username and password $password")
public void createUserWithUsernameAndPassword(String orgName, String username, String password) {
Organization org = organizationDao.findByName(orgName);
User user = new User();
user.setOrganization(org);
user.setUsername(username);
user.setPasswordCleartext(password);
userDao.persist(user);
}
use of org.jbehave.example.spring.security.domain.User in project jbehave-core by jbehave.
the class AuthenticationEventListener method onAuthenticationFailure.
protected void onAuthenticationFailure(AbstractAuthenticationFailureEvent event) {
// on failure - principal is a username
String username = (String) event.getAuthentication().getPrincipal();
if (!StringUtils.isBlank(username)) {
Long orgId = organizationManager.getOrganization().getId();
User user = userDao.findUserByOrganizationAndUsername(orgId, username);
if (user != null) {
int loginFailureCount = user.getLoginFailureCount();
user.setLoginFailureCount(++loginFailureCount);
userDao.persist(user);
}
}
}
Aggregations