use of org.jbehave.example.spring.security.domain.Organization in project jbehave-core by jbehave.
the class OrganizationSteps method updateOrganizationWithDefaultAuthPolicy.
@Given("authentication policy for $orgName: $authPolicyTable")
public void updateOrganizationWithDefaultAuthPolicy(String orgName, ExamplesTable table) {
Organization org = organizationDao.findByName(orgName);
Map<String, String> row = table.getRow(0);
org.setAuthenticationPolicy(new AuthenticationPolicyBuilder(row).build());
organizationDao.persist(org);
}
use of org.jbehave.example.spring.security.domain.Organization 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.Organization 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.Organization 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.Organization 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