private static void startShibbolethSNAA(
      String path,
      String prefix,
      String secretKeyURL,
      IUserAuthorization authorization,
      Injector injector,
      ShibbolethProxy shibbolethProxy) {

    log.debug(
        "Starting Shibboleth SNAA, path ["
            + path
            + "], prefix["
            + prefix
            + "], secretKeyURL["
            + secretKeyURL
            + "]");

    Set<String> prefixes = new HashSet<String>();
    prefixes.add(prefix);

    ShibbolethSNAAImpl shibSnaa =
        new ShibbolethSNAAImpl(prefixes, secretKeyURL, authorization, injector, shibbolethProxy);

    HttpContext context = server.createContext(path);
    Endpoint endpoint = Endpoint.create(shibSnaa);
    endpoint.publish(context);

    log.debug("Started shibboleth SNAA on " + server.getAddress() + path);
  }
 private static Set<String> parseCSV(String str) {
   String[] split = str.split(",");
   Set<String> trimmedSplit = new HashSet<String>();
   for (String string : split) {
     trimmedSplit.add(string.trim());
   }
   return trimmedSplit;
 }
예제 #3
0
  protected Map<String, Set<AuthenticationTriple>> getIntersectionPrefixSetAT(
      List<AuthenticationTriple> authenticationData) throws SNAAExceptionException {

    if (authenticationData == null) {
      throw createSNAAException("Argument authenticationData must not be null!");
    }

    // WS Endpoint URL -> Set<URN Prefixes> for intersection of authenticationData
    Map<String, Set<AuthenticationTriple>> intersectionPrefixSet =
        new HashMap<String, Set<AuthenticationTriple>>();

    for (AuthenticationTriple authenticationTriple : authenticationData) {

      for (Entry<String, Set<String>> entry : prefixSet.entrySet()) {
        if (entry.getValue().contains(authenticationTriple.getUrnPrefix())) {
          Set<AuthenticationTriple> set =
              intersectionPrefixSet.get(authenticationTriple.getUrnPrefix());
          if (set == null) {
            set = new HashSet<AuthenticationTriple>();
            intersectionPrefixSet.put(entry.getKey(), set);
          }
          set.add(authenticationTriple);
        }
      }

      // check if federator federates the urn prefix found in the authentication triple
      boolean found = false;
      for (Set<AuthenticationTriple> triples : intersectionPrefixSet.values()) {
        for (AuthenticationTriple triple : triples) {
          if (triple.getUrnPrefix().equals(authenticationTriple.getUrnPrefix())) {
            found = true;
          }
        }
      }

      if (!found) {
        throw createSNAAException(
            "No endpoint known for URN prefix " + authenticationTriple.getUrnPrefix());
      }
    }

    return intersectionPrefixSet;
  }
예제 #4
0
  protected Map<String, Set<SecretAuthenticationKey>> getIntersectionPrefixSetSAK(
      List<SecretAuthenticationKey> authenticationKeys) throws SNAAExceptionException {

    // WS Endpoint URL -> Set<URN Prefixes> for intersection of
    // authenticationData
    Map<String, Set<SecretAuthenticationKey>> intersectionPrefixSet =
        new HashMap<String, Set<SecretAuthenticationKey>>();

    for (SecretAuthenticationKey secretAuthenticationKey : authenticationKeys) {

      for (Entry<String, Set<String>> entry : prefixSet.entrySet()) {
        if (entry.getValue().contains(secretAuthenticationKey.getUrnPrefix())) {
          Set<SecretAuthenticationKey> set =
              intersectionPrefixSet.get(secretAuthenticationKey.getUrnPrefix());
          if (set == null) {
            set = new HashSet<SecretAuthenticationKey>();
            intersectionPrefixSet.put(secretAuthenticationKey.getUrnPrefix(), set);
          }
          set.add(secretAuthenticationKey);
        }
      }

      // check if federator federates the urn prefix found in the authentication triple
      boolean found = false;
      for (Set<SecretAuthenticationKey> triples : intersectionPrefixSet.values()) {
        for (SecretAuthenticationKey triple : triples) {
          if (triple.getUrnPrefix().equals(secretAuthenticationKey.getUrnPrefix())) {
            found = true;
          }
        }
      }

      if (!found) {
        throw createSNAAException(
            "No endpoint known for URN prefix " + secretAuthenticationKey.getUrnPrefix());
      }
    }

    return intersectionPrefixSet;
  }