Search in sources :

Example 26 with CredentialFactory

use of nl.nn.adapterframework.util.CredentialFactory in project iaf by ibissource.

the class SapSystem method initSystem.

private void initSystem() throws SapException {
    try {
        if (log.isDebugEnabled() && getTraceLevel() > 0) {
            String logPath = AppConstants.getInstance().getResolvedProperty("logging.path");
            JCO.setTracePath(logPath);
            JCO.setTraceLevel(getTraceLevel());
        }
        clearSystem();
        log.debug(getLogPrefix() + "creating ClientPool");
        CredentialFactory cf = new CredentialFactory(getAuthAlias(), getUserid(), getPasswd());
        // Add a connection pool to the specified system
        // The pool will be saved in the pool list to be used
        // from other threads by JCO.getClient(SID).
        // The pool must be explicitely removed by JCO.removeClientPool(SID)
        // Alias for this pool
        JCO.addClientPool(// Alias for this pool
        getName(), // Max. number of connections
        getMaxConnections(), getMandant(), cf.getUsername(), cf.getPassword(), getLanguage(), getGwhost(), getSystemnr());
        // Create a new repository
        // The repository caches the function and structure definitions
        // to be used for all calls to the system SID. The creation of
        // redundant instances cause performance and memory waste.
        log.debug(getLogPrefix() + "creating repository");
        jcoRepository = JCO.createRepository(getName() + "-Repository", getName());
    } catch (Throwable t) {
        throw new SapException(getLogPrefix() + "exception initializing", t);
    }
    if (jcoRepository == null) {
        throw new SapException(getLogPrefix() + "could not create repository");
    }
}
Also used : CredentialFactory(nl.nn.adapterframework.util.CredentialFactory)

Example 27 with CredentialFactory

use of nl.nn.adapterframework.util.CredentialFactory in project iaf by ibissource.

the class TibcoUtils method getConnection.

public static Connection getConnection(String provUrl, String authAlias, String userName, String password) throws JMSException {
    String url = StringUtils.replace(provUrl, "tibjmsnaming:", "tcp:");
    CredentialFactory cf = new CredentialFactory(authAlias, userName, password);
    ConnectionFactory factory = new com.tibco.tibjms.TibjmsConnectionFactory(url);
    return factory.createConnection(cf.getUsername(), cf.getPassword());
}
Also used : ConnectionFactory(javax.jms.ConnectionFactory) CredentialFactory(nl.nn.adapterframework.util.CredentialFactory)

Example 28 with CredentialFactory

use of nl.nn.adapterframework.util.CredentialFactory in project iaf by ibissource.

the class ShowConfigurationStatus method addCertificateInfo.

private Map<String, Object> addCertificateInfo(HttpSender s) {
    String certificate = s.getCertificate();
    if (certificate == null || StringUtils.isEmpty(certificate))
        return null;
    Map<String, Object> certElem = new HashMap<String, Object>(4);
    certElem.put("name", certificate);
    String certificateAuthAlias = s.getCertificateAuthAlias();
    certElem.put("authAlias", certificateAuthAlias);
    URL certificateUrl = ClassUtils.getResourceURL(this, certificate);
    if (certificateUrl == null) {
        certElem.put("url", "");
        certElem.put("info", "*** ERROR ***");
    } else {
        certElem.put("url", certificateUrl.toString());
        String certificatePassword = s.getCertificatePassword();
        CredentialFactory certificateCf = new CredentialFactory(certificateAuthAlias, null, certificatePassword);
        String keystoreType = s.getKeystoreType();
        certElem.put("info", getCertificateInfo(certificateUrl, certificateCf.getPassword(), keystoreType, "Certificate chain"));
    }
    return certElem;
}
Also used : HashMap(java.util.HashMap) LinkedHashMap(java.util.LinkedHashMap) CredentialFactory(nl.nn.adapterframework.util.CredentialFactory) URL(java.net.URL)

Example 29 with CredentialFactory

use of nl.nn.adapterframework.util.CredentialFactory in project iaf by ibissource.

the class ShowConfigurationStatus method addCertificateInfo.

private Map<String, Object> addCertificateInfo(WebServiceSender s) {
    String certificate = s.getCertificate();
    if (certificate == null || StringUtils.isEmpty(certificate))
        return null;
    Map<String, Object> certElem = new HashMap<String, Object>(4);
    certElem.put("name", certificate);
    String certificateAuthAlias = s.getCertificateAuthAlias();
    certElem.put("authAlias", certificateAuthAlias);
    URL certificateUrl = ClassUtils.getResourceURL(this, certificate);
    if (certificateUrl == null) {
        certElem.put("url", null);
        certElem.put("info", "*** ERROR ***");
    } else {
        certElem.put("url", certificateUrl.toString());
        String certificatePassword = s.getCertificatePassword();
        CredentialFactory certificateCf = new CredentialFactory(certificateAuthAlias, null, certificatePassword);
        String keystoreType = s.getKeystoreType();
        certElem.put("info", getCertificateInfo(certificateUrl, certificateCf.getPassword(), keystoreType, "Certificate chain"));
    }
    return certElem;
}
Also used : HashMap(java.util.HashMap) LinkedHashMap(java.util.LinkedHashMap) CredentialFactory(nl.nn.adapterframework.util.CredentialFactory) URL(java.net.URL)

Example 30 with CredentialFactory

use of nl.nn.adapterframework.util.CredentialFactory in project iaf by ibissource.

the class ShowConfigurationStatus method addCertificateInfo.

private Map<String, Object> addCertificateInfo(FtpSender s) {
    String certificate = s.getCertificate();
    if (certificate == null || StringUtils.isEmpty(certificate))
        return null;
    Map<String, Object> certElem = new HashMap<String, Object>(4);
    certElem.put("name", certificate);
    String certificateAuthAlias = s.getCertificateAuthAlias();
    certElem.put("authAlias", certificateAuthAlias);
    URL certificateUrl = ClassUtils.getResourceURL(this, certificate);
    if (certificateUrl == null) {
        certElem.put("url", "");
        certElem.put("info", "*** ERROR ***");
    } else {
        certElem.put("url", certificateUrl.toString());
        String certificatePassword = s.getCertificatePassword();
        CredentialFactory certificateCf = new CredentialFactory(certificateAuthAlias, null, certificatePassword);
        String keystoreType = s.getCertificateType();
        certElem.put("info", getCertificateInfo(certificateUrl, certificateCf.getPassword(), keystoreType, "Certificate chain"));
    }
    return certElem;
}
Also used : HashMap(java.util.HashMap) LinkedHashMap(java.util.LinkedHashMap) CredentialFactory(nl.nn.adapterframework.util.CredentialFactory) URL(java.net.URL)

Aggregations

CredentialFactory (nl.nn.adapterframework.util.CredentialFactory)33 ConfigurationException (nl.nn.adapterframework.configuration.ConfigurationException)11 IOException (java.io.IOException)9 URL (java.net.URL)9 HashMap (java.util.HashMap)5 Iterator (java.util.Iterator)4 ParameterException (nl.nn.adapterframework.core.ParameterException)4 ParameterValueList (nl.nn.adapterframework.parameters.ParameterValueList)4 GeneralSecurityException (java.security.GeneralSecurityException)3 KeyStoreException (java.security.KeyStoreException)3 NoSuchAlgorithmException (java.security.NoSuchAlgorithmException)3 ArrayList (java.util.ArrayList)3 LinkedHashMap (java.util.LinkedHashMap)3 ConnectionFactory (javax.jms.ConnectionFactory)3 JMSException (javax.jms.JMSException)3 Transformer (javax.xml.transform.Transformer)3 JmsException (nl.nn.adapterframework.jms.JmsException)3 TibjmsAdmin (com.tibco.tibjms.admin.TibjmsAdmin)2 TibjmsAdminException (com.tibco.tibjms.admin.TibjmsAdminException)2 URISyntaxException (java.net.URISyntaxException)2