Search in sources :

Example 1 with Organization

use of org.jbehave.example.spring.security.domain.Organization in project jbehave-core by jbehave.

the class OrganizationSteps method setCurrentOrganization.

@When("current organization is $orgName")
public void setCurrentOrganization(String orgName) {
    Organization org = organizationDao.findByName(orgName);
    organizationManager.setOrganization(org);
}
Also used : Organization(org.jbehave.example.spring.security.domain.Organization) When(org.jbehave.core.annotations.When)

Example 2 with Organization

use of org.jbehave.example.spring.security.domain.Organization in project jbehave-core by jbehave.

the class OrganizationSteps method createOrganizationWithName.

@Given("an organization named $orgNames")
@Alias("organizations named $orgNames")
public void createOrganizationWithName(List<String> orgNames) {
    for (String orgName : orgNames) {
        Organization org = new Organization();
        org.setName(orgName);
        org.setAuthenticationPolicy(new AuthenticationPolicy());
        organizationDao.persist(org);
    }
}
Also used : Organization(org.jbehave.example.spring.security.domain.Organization) AuthenticationPolicy(org.jbehave.example.spring.security.domain.AuthenticationPolicy) Alias(org.jbehave.core.annotations.Alias) Given(org.jbehave.core.annotations.Given)

Example 3 with Organization

use of org.jbehave.example.spring.security.domain.Organization 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);
}
Also used : Organization(org.jbehave.example.spring.security.domain.Organization) User(org.jbehave.example.spring.security.domain.User) Given(org.jbehave.core.annotations.Given)

Example 4 with Organization

use of org.jbehave.example.spring.security.domain.Organization in project jbehave-core by jbehave.

the class UserSteps method createUsersFromTable.

@Given("the users for $orgName: $userTable")
public void createUsersFromTable(String orgName, ExamplesTable table) {
    Organization org = organizationDao.findByName(orgName);
    List<Parameters> parametersList = table.getRowsAsParameters(true);
    for (Parameters parameters : parametersList) {
        userDao.persist(new UserBuilder(org, parameters, table.getHeaders()).build());
    }
}
Also used : Organization(org.jbehave.example.spring.security.domain.Organization) Parameters(org.jbehave.core.steps.Parameters) UserBuilder(org.jbehave.example.spring.security.domain.UserBuilder) Given(org.jbehave.core.annotations.Given)

Example 5 with Organization

use of org.jbehave.example.spring.security.domain.Organization in project jbehave-core by jbehave.

the class OrganizationSteps method updateOrganizationWithDefaultAuthPolicy.

@Given("a default authentication policy for $orgName")
public void updateOrganizationWithDefaultAuthPolicy(String orgName) {
    Organization org = organizationDao.findByName(orgName);
    org.setAuthenticationPolicy(new AuthenticationPolicy());
    organizationDao.persist(org);
}
Also used : Organization(org.jbehave.example.spring.security.domain.Organization) AuthenticationPolicy(org.jbehave.example.spring.security.domain.AuthenticationPolicy) Given(org.jbehave.core.annotations.Given)

Aggregations

Organization (org.jbehave.example.spring.security.domain.Organization)10 Given (org.jbehave.core.annotations.Given)8 User (org.jbehave.example.spring.security.domain.User)5 AuthenticationPolicy (org.jbehave.example.spring.security.domain.AuthenticationPolicy)2 Alias (org.jbehave.core.annotations.Alias)1 When (org.jbehave.core.annotations.When)1 Parameters (org.jbehave.core.steps.Parameters)1 AuthenticationPolicyBuilder (org.jbehave.example.spring.security.domain.AuthenticationPolicyBuilder)1 UserBuilder (org.jbehave.example.spring.security.domain.UserBuilder)1 UsernameNotFoundException (org.springframework.security.core.userdetails.UsernameNotFoundException)1