private String createMessage(Map<String, String> messageMap) {
   StringBuilder sb = new StringBuilder();
   Map<String, String> contextMap = MDC.getCopyOfContextMap();
   if (contextMap != null) {
     for (Map.Entry<String, String> e : contextMap.entrySet()) {
       sb.append("MDC-").append(e.getKey()).append(": ").append(e.getValue()).append('\n');
     }
   }
   for (Map.Entry<String, String> e : messageMap.entrySet()) {
     sb.append(e.getKey()).append(": ").append(e.getValue()).append('\n');
   }
   return sb.toString();
 }
Example #2
0
  /**
   * Configures VOMS extension validation, XACML service location, local id caching and storage
   * resource information.
   */
  public XACMLPlugin(Properties properties)
      throws ClassNotFoundException, GSSException, SocketException, CertificateException,
          CRLException, IOException {
    _properties = properties;

    /*
     * VOMS setup
     */
    String pki = properties.getProperty(VATTR_VALIDATE);
    if (pki != null) {
      _vomsAttrValidate = Boolean.parseBoolean(pki);
    }

    String caDir = properties.getProperty(CADIR);
    String vomsDir = properties.getProperty(VOMSDIR);

    _pkiVerifier = GSSUtils.getPkiVerifier(vomsDir, caDir, MDC.getCopyOfContextMap());

    /*
     * Adds SSL system properties required by privilege library.
     */
    System.setProperty("sslCAFiles", properties.getProperty(SERVICE_CA) + "/*.0");
    System.setProperty("sslCertfile", properties.getProperty(SERVICE_CERT));
    System.setProperty("sslKey", properties.getProperty(SERVICE_KEY));

    /*
     * XACML setup
     */
    _mappingServiceURL = properties.getProperty(SERVICE_URL_PROPERTY);
    checkArgument(_mappingServiceURL != null, "Undefined property: " + SERVICE_URL_PROPERTY);
    setClientType(properties.getProperty(CLIENT_TYPE_PROPERTY));
    configureTargetServiceInfo();
    configureResourceDNSHostName();

    /*
     * LocalId Cache setup
     */
    configureCache();

    logger.debug("XACML plugin now loaded for URL {}", _mappingServiceURL);
  }