public static synchronized SecurityTokenFactory getInstance() throws XMLSecurityException {
        if (securityTokenFactory == null) {
            String stf = ConfigurationProperties.getProperty("securityTokenFactory");
            if (stf == null) {
                throw new XMLSecurityException("algorithm.ClassDoesNotExist", "null");
            }
            Class<?> callingClass = ConfigurationProperties.getCallingClass();
            if (callingClass == null) {
                callingClass = SecurityTokenFactory.class;
            }
            try {
                @SuppressWarnings("unchecked")
                Class<SecurityTokenFactory> securityTokenFactoryClass =
                        (Class<SecurityTokenFactory>) ClassLoaderUtils.loadClass(stf, callingClass);
                securityTokenFactory = securityTokenFactoryClass.newInstance();
            } catch (ClassNotFoundException e) {
                throw new XMLSecurityException("algorithm.ClassDoesNotExist", new Object[]{stf}, e);
            } catch (InstantiationException e) {
                throw new XMLSecurityException("algorithm.ClassDoesNotExist", new Object[]{stf}, e);
            } catch (IllegalAccessException e) {
                throw new XMLSecurityException("algorithm.ClassDoesNotExist", new Object[]{stf}, e);
            }
        }
        return securityTokenFactory;
    }