Package org.jbehave.example.spring.security.domain

Examples of org.jbehave.example.spring.security.domain.Organization


  @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);
    }
  }
View Full Code Here


    }
  }

  @Given("a default authentication policy for $orgName")
  public void updateOrganizationWithDefaultAuthPolicy(String orgName) {
    Organization org = organizationDao.findByName(orgName);
    org.setAuthenticationPolicy(new AuthenticationPolicy());
    organizationDao.persist(org);
  }
View Full Code Here

    organizationDao.persist(org);
  }

  @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);
  }
View Full Code Here

    organizationDao.persist(org);
  }

  @When("current organization is $orgName")
  public void setCurrentOrganization(String orgName) {
    Organization org = organizationDao.findByName(orgName);
    organizationManager.setOrganization(org);
  }
View Full Code Here

  @Autowired
  private OrganizationDao organizationDao;

  @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);
View Full Code Here

    userDao.persist(user);
  }

  @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());
      }
  }
View Full Code Here

      }
  }

  @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);
  }
View Full Code Here

    userDao.persist(user);
  }

  @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);
  }
View Full Code Here

    userDao.persist(user);
  }

  @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);
  }
View Full Code Here

  @Autowired
  private OrganizationManager organizationManager;

  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());
  }
View Full Code Here

TOP

Related Classes of org.jbehave.example.spring.security.domain.Organization

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.