コード例 #1
0
  @Test
  public void test05FetchFromDummy() throws Exception {
    log.trace(">test05FetchFromDummy()");
    ArrayList<Integer> userdatasources = new ArrayList<Integer>();
    userdatasources.add(
        Integer.valueOf(userDataSourceSession.getUserDataSourceId(admin, "TESTNEWDUMMYCUSTOM")));

    Collection<UserDataSourceVO> ret = userDataSourceSession.fetch(admin, userdatasources, "per");
    assertTrue("Fetching data from dummy userdatasource failed", ret.size() == 1);

    Iterator<UserDataSourceVO> iter = ret.iterator();
    UserDataSourceVO next = iter.next();
    assertTrue(
        "Didn't get epected user data", next.getEndEntityInformation().getUsername().equals("PER"));
    log.trace("<test05FetchFromDummy()");
  }
コード例 #2
0
 @Before
 public void setUp() throws Exception {
   admin =
       (TestX509CertificateAuthenticationToken)
           simpleAuthenticationProvider.authenticate(new AuthenticationSubject(null, null));
   RoleData role = roleManagementSessionRemote.create(internalAdmin, ROLENAME);
   Collection<AccessUserAspectData> subjects = new LinkedList<AccessUserAspectData>();
   subjects.add(
       new AccessUserAspectData(
           ROLENAME,
           CertTools.getIssuerDN(admin.getCertificate()).hashCode(),
           X500PrincipalAccessMatchValue.WITH_COMMONNAME,
           AccessMatchType.TYPE_EQUALCASEINS,
           CertTools.getPartFromDN(SimpleAuthenticationProviderSessionRemote.DEFAULT_DN, "CN")));
   role = roleManagementSessionRemote.addSubjectsToRole(internalAdmin, role, subjects);
   Collection<AccessRuleData> accessRules = new LinkedList<AccessRuleData>();
   accessRules.add(
       new AccessRuleData(
           ROLENAME, AccessRulesConstants.ROLE_ADMINISTRATOR, AccessRuleState.RULE_ACCEPT, false));
   accessRules.add(
       new AccessRuleData(
           ROLENAME,
           AccessRulesConstants.REGULAR_EDITUSERDATASOURCES,
           AccessRuleState.RULE_ACCEPT,
           false));
   accessRules.add(
       new AccessRuleData(
           ROLENAME,
           AccessRulesConstants.USERDATASOURCEPREFIX
               + Integer.valueOf(
                   userDataSourceSession.getUserDataSourceId(admin, "TESTNEWDUMMYCUSTOM"))
               + AccessRulesConstants.UDS_FETCH_RIGHTS,
           AccessRuleState.RULE_ACCEPT,
           false));
   role = roleManagementSessionRemote.addAccessRulesToRole(internalAdmin, role, accessRules);
 }