コード例 #1
0
  {
    try {
      if (Velocity.getProperty(Velocity.FILE_RESOURCE_LOADER_PATH) != null) {
        logger.debug(
            String.format(
                "Resource Loader Path: %s",
                Velocity.getProperty(Velocity.FILE_RESOURCE_LOADER_PATH).toString()));
        shibbolethTemplate = Velocity.getTemplate("shibboleth/interface.vm");
      }
      JsonSimpleConfig config = new JsonSimpleConfig();

      SHIB_ATTRIBUTE_DELIMITER = config.getString(";", SHIBBOLETH_PLUGIN_ID, SHIBBOLETH_DELIMITER);

      SHIB_SESSION_ID =
          config.getString("Shib-Session-ID", SHIBBOLETH_PLUGIN_ID, SHIBBOLETH_SESSION_ATTR);
      SHIB_ATTRIBUTES.add(SHIB_SESSION_ID);
      SHIB_IDP =
          config.getString("Shib-Identity-Provide", SHIBBOLETH_PLUGIN_ID, SHIBBOLETH_IDP_ATTRIBUTE);
      SHIB_ATTRIBUTES.add(SHIB_IDP);
      SHIB_COMMON_NAME = config.getString("cn", SHIBBOLETH_PLUGIN_ID, SHIBBOLETH_CN_ATTRIBUTE);
      SHIB_ATTRIBUTES.add(SHIB_COMMON_NAME);
      SHIB_USER_NAME =
          config.getString("eppn", SHIBBOLETH_PLUGIN_ID, SHIBBOLETH_USERNAME_ATTRIBUTE);
      SHIB_ATTRIBUTES.add(SHIB_USER_NAME);

      List attrs = config.getArray(SHIBBOLETH_PLUGIN_ID, SHIBBOLETH_ATTRIBUTES);
      SHIB_ATTRIBUTES.addAll(attrs);

      SHIB_USE_HEADERS =
          config.getBoolean(SHIB_USE_HEADERS, SHIBBOLETH_PLUGIN_ID, SHIBBOLETH_USE_HEADERS);

      logger.debug(String.format("Session ID Attribute: %s", SHIB_SESSION_ID));
      logger.debug(String.format("Shib Identity Provider Attribute: %s", SHIB_IDP));
      logger.debug(String.format("Shib Common Name Attribute: %s", SHIB_COMMON_NAME));
      logger.debug(String.format("Shib Username Attribute: %s", SHIB_USER_NAME));
      logger.debug(String.format("Shib Attributes: %s", attrs));
      logger.debug(String.format("Shib Attribute split: %s", SHIB_ATTRIBUTE_DELIMITER));

      ServiceLoader<ShibbolethRoleManager> providers =
          ServiceLoader.load(ShibbolethRoleManager.class);
      List plugins = config.getArray(SHIBBOLETH_PLUGIN_ID, "rolePlugins");
      for (Object plugin : plugins) {
        for (ShibbolethRoleManager provider : providers) {
          if (provider.getId().equals(plugin.toString())) {
            logger.debug(String.format("Added Role Manager: %s", provider.getId()));
            roleManagers.add(provider);
          }
        }
      }

      serverUrlBase = config.getString(null, "urlBase");
    } catch (Exception e) {
      logger.error(e.getMessage(), e);
    }
  }
コード例 #2
0
  /** Reset the transformer in preparation for a new object */
  private void reset() throws TransformerException {
    if (firstRun) {
      firstRun = false;
      // Output directory
      String outputPath = config.getString(null, "outputPath");
      if (outputPath == null) {
        throw new TransformerException("Output path not specified!");
      }
      outputDir = new File(outputPath);
      outputDir.mkdirs();

      // Rendition exclusions
      excludeList =
          Arrays.asList(StringUtils.split(config.getString(null, "excludeRenditionExt"), ','));

      // Conversion Service URL
      convertUrl = config.getString(null, "url");
      if (convertUrl == null) {
        throw new TransformerException("No ICE URL provided!");
      }
    }

    // Priority
    Boolean testResponse = itemConfig.getBoolean(null, "priority");
    if (testResponse != null) {
      // We found it in item config
      priority = testResponse;
    } else {
      // Try system config
      priority = config.getBoolean(true, "priority");
    }

    // Clear the old SAX reader
    reader = new SafeSAXReader();

    // Remove the last object
    thumbnails = null;
    previews = null;
  }