public void initialize(Map<String, String> properties) {
    this.properties = properties;

    // Check for token registry
    String tokenRegistryOption = this.properties.get(TOKEN_REGISTRY);
    if (tokenRegistryOption == null) {
      logger.stsTokenRegistryNotSpecified();
    } else {
      // if a file is to be used as registry, check if the user has specified the file name.
      if ("FILE".equalsIgnoreCase(tokenRegistryOption)) {
        String tokenRegistryFile = this.properties.get(TOKEN_REGISTRY_FILE);
        if (tokenRegistryFile != null)
          this.tokenRegistry = new FileBasedTokenRegistry(tokenRegistryFile);
        else this.tokenRegistry = new FileBasedTokenRegistry();
      } else if ("JPA".equalsIgnoreCase(tokenRegistryOption)) {
        String tokenRegistryjpa = this.properties.get(TOKEN_REGISTRY_JPA);
        if (tokenRegistryjpa != null)
          this.tokenRegistry = new JPABasedTokenRegistry(tokenRegistryjpa);
        else this.tokenRegistry = new JPABasedTokenRegistry();
      } else if ("JDBC".equalsIgnoreCase(tokenRegistryOption)) {
        String tokenRegistryjdbc = this.properties.get(TOKEN_REGISTRY_JDBC);
        if (tokenRegistryjdbc != null)
          this.tokenRegistry = new JDBCTokenRegistry(tokenRegistryjdbc);
        else this.tokenRegistry = new JDBCTokenRegistry();
      }
      // the user has specified its own registry implementation class.
      else {
        try {
          Class<?> clazz = SecurityActions.loadClass(getClass(), tokenRegistryOption);
          if (clazz != null) {
            Object object = clazz.newInstance();
            if (object instanceof SecurityTokenRegistry)
              this.tokenRegistry = (SecurityTokenRegistry) object;
            else {
              logger.stsTokenRegistryInvalidType(tokenRegistryOption);
            }
          }
        } catch (Exception pae) {
          logger.stsTokenRegistryInstantiationError();
          pae.printStackTrace();
        }
      }
    }
    if (this.tokenRegistry == null) tokenRegistry = new DefaultTokenRegistry();

    // check if a revocation registry option has been set.
    String registryOption = this.properties.get(REVOCATION_REGISTRY);
    if (registryOption == null) {
      logger.stsRevocationRegistryNotSpecified();
    } else {
      // if a file is to be used as registry, check if the user has specified the file name.
      if ("FILE".equalsIgnoreCase(registryOption)) {
        String registryFile = this.properties.get(REVOCATION_REGISTRY_FILE);
        if (registryFile != null)
          this.revocationRegistry = new FileBasedRevocationRegistry(registryFile);
        else this.revocationRegistry = new FileBasedRevocationRegistry();
      }
      // another option is to use the default JPA registry to store the revoked ids.
      else if ("JPA".equalsIgnoreCase(registryOption)) {
        String configuration = this.properties.get(REVOCATION_REGISTRY_JPA_CONFIG);
        if (configuration != null)
          this.revocationRegistry = new JPABasedRevocationRegistry(configuration);
        else this.revocationRegistry = new JPABasedRevocationRegistry();
      } else if ("JDBC".equalsIgnoreCase(registryOption)) {
        String configuration = this.properties.get(REVOCATION_REGISTRY_JDBC_CONFIG);
        if (configuration != null)
          this.revocationRegistry = new JDBCRevocationRegistry(configuration);
        else this.revocationRegistry = new JDBCRevocationRegistry();
      }
      // the user has specified its own registry implementation class.
      else {
        try {
          Class<?> clazz = SecurityActions.loadClass(getClass(), registryOption);
          if (clazz != null) {
            Object object = clazz.newInstance();
            if (object instanceof RevocationRegistry)
              this.revocationRegistry = (RevocationRegistry) object;
            else {
              logger.stsRevocationRegistryInvalidType(registryOption);
            }
          }
        } catch (Exception pae) {
          logger.stsRevocationRegistryInstantiationError();
          pae.printStackTrace();
        }
      }
    }

    if (this.revocationRegistry == null) this.revocationRegistry = new DefaultRevocationRegistry();
  }