Subversion Repositories XServices

Compare Revisions

No changes between revisions

Ignore whitespace Rev 169 → Rev 170

/SVN-ALFEventEmitter/trunk/src/net/brutex/emitter/ALFEmitter.java
29,7 → 29,9
import java.util.Map;
 
import javax.xml.stream.XMLStreamException;
 
import net.brutex.emitter.util.EmitterUtil;
import net.brutex.emitter.util.PasswordEncrypter;
import net.brutex.sbm.sbmappservices72.AEWebservicesFaultFault;
import net.brutex.sbm.sbmappservices72.Sbmappservices72PortType;
import net.brutex.sbm.sbmappservices72.api.Auth;
98,10 → 100,12
private static final String OPTION_EVENTMANAGER_URL = "eventmanager";
private static final String OPTION_EVENTMANAGER_USER = "eventmanager.user";
private static final String OPTION_EVENTMANAGER_PASSWORD = "eventmanager.password";
private static final String OPTION_EVENTMANAGER_ENCRYPTED = "eventmanager.encrypted";
private static final String OPTION_SBM_ENDPOINT = "sbmappservices72";
private static final String OPTION_SBM_USER = "sbmuser";
private static final String OPTION_SBM_PASSWORD = "sbmpassword";
private static final String OPTION_SBM_ENCRYPTED = "sbmencrypted";
private static final String OPTION_SBM_TABLE = "querytable";
private static final String OPTION_SBM_QUERY = "query";
 
132,11 → 136,6
private static final String PARAM_CONFIG = "conf";
//
//
//
private static final String CACHE_SBMPORT = "sbmappservices72";
//
// Member variables
//
private final String repos;
151,7 → 150,7
//Member for SBM endpoint configuration
private final String endpoint;
private final String sbm_user;
private final String sbm_pass;
private String sbm_pass;
private final String querytable;
private final String query;
 
195,7 → 194,7
*
* @param key property name
* @param defaultValue default value or null
* @param isRequired wether or not this is a required option
* @param isRequired whether or not this is a required option
* @param logmessage optional log message (or null)
* @return property value
* @throws ConfigurationException
328,8 → 327,11
*/
boolean isTrace = false;
if(isWithVerification) {
boolean isEncrypted;
isEncrypted = readConfPropertyAsBoolean(OPTION_SBM_ENCRYPTED, false, false, null);
sbm_user = readConfPropertyAsString(OPTION_SBM_USER, null, true, null);
sbm_pass = readConfPropertyAsString(OPTION_SBM_PASSWORD, null, false, null);
if(isEncrypted) sbm_pass = PasswordEncrypter.decrypt(sbm_pass);
endpoint = readConfPropertyAsString(OPTION_SBM_ENDPOINT, "http://localhost/gsoap/gsoap_ssl.dll?sbmappservices72", true, null);
querytable = readConfPropertyAsString(OPTION_SBM_TABLE, null, true, null);
query = readConfPropertyAsString(OPTION_SBM_QUERY, null, false, null);
470,7 → 472,10
private void addALFSecurity() throws ConfigurationException, JaxenException {
final String eventmanager_user = readConfPropertyAsString(OPTION_EVENTMANAGER_USER, null, false, null);
final String eventmanager_pass = readConfPropertyAsString(OPTION_EVENTMANAGER_PASSWORD, null, false, null);
String eventmanager_pass = readConfPropertyAsString(OPTION_EVENTMANAGER_PASSWORD, null, false, null);
final boolean eventmanager_enc = readConfPropertyAsBoolean(OPTION_EVENTMANAGER_ENCRYPTED, false, false, null);
if(eventmanager_enc) eventmanager_pass = PasswordEncrypter.decrypt(eventmanager_pass);
AXIOMXPath path = new AXIOMXPath("//bru1:User");
OMNamespace ns = template.findNamespace(nss, null);
path.addNamespace("bru1", nss);
561,23 → 566,6
private TTItemList getTTItems(String issueid, boolean isTrace) throws MalformedURLException {
long startTime = System.currentTimeMillis();
Sbmappservices72PortType port = null;
//try {
// JCS cache = JCS.getInstance("FileCache");
 
/* -- */
// port = (Sbmappservices72PortType)cache.get(CACHE_SBMPORT);
/*
if(port==null) {
Sbmappservices72 ss = new Sbmappservices72(ClassLoader.getSystemResource("sbmappservices72.wsdl") );
port = ss.getSbmappservices72();
 
BindingProvider bindingProvider = (BindingProvider) port;
bindingProvider.getRequestContext().put(
BindingProvider.ENDPOINT_ADDRESS_PROPERTY, endpoint);
}
*/
JaxWsProxyFactoryBean factory = new JaxWsProxyFactoryBean();
factory.setServiceClass(Sbmappservices72PortType.class);
factory.setAddress(endpoint);
584,19 → 572,7
port = (Sbmappservices72PortType) factory.create();
logger.debug("Total execution of sbmappservices72 wsdl read took '"+(System.currentTimeMillis()-startTime)+"' milliseconds.");
// cache.put(CACHE_SBMPORT, port);
// cache.dispose();
// } else {
// logger.debug("sbmappservices72 port was read from cache.");
// }
//} catch (CacheException e1) {
// // TODO Auto-generated catch block
// e1.printStackTrace();
// this.exit(1);
//}
if(isTrace) {
Client client = ClientProxy.getClient(port);
client.getInInterceptors().add(new LoggingInInterceptor());
/SVN-ALFEventEmitter/trunk/src/net/brutex/emitter/util/EmitterUtil.java
56,5 → 56,6
logger.error(String.format("Cannot read file '%s'.", fn));
return false;
}
 
}
/SVN-ALFEventEmitter/trunk/src/net/brutex/emitter/util/PasswordEncrypter.java
0,0 → 1,65
/*
* Copyright 2014 Brian Rosenberger (Brutex Network)
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package net.brutex.emitter.util;
 
import org.jasypt.encryption.pbe.StandardPBEStringEncryptor;
import org.jasypt.salt.StringFixedSaltGenerator;
 
 
/**
* The Class PasswordEncrypter.
* @since 0.2
*/
public class PasswordEncrypter {
 
/** The Constant key. */
private static final String key = "sdasfAasdFsDc4ASasdXacca/&dasd";
/**
* The main method.
*
* @param args the arguments
*/
public static void main(String[] args) {
if(args.length<1) {
System.out.println("No password given.");
System.exit(1);
}
final StandardPBEStringEncryptor enc = new StandardPBEStringEncryptor();
enc.setPassword(key);
enc.setSaltGenerator(new StringFixedSaltGenerator(PasswordEncrypter.class.getCanonicalName()) );
String myEncryptedText = enc.encrypt(args[0]);
System.out.println("Your encrypted password is:");
System.out.println(myEncryptedText);
}
/**
* Decrypt.
*
* @param C the c
* @return the string
*/
public static String decrypt(final String C) {
final StandardPBEStringEncryptor enc = new StandardPBEStringEncryptor();
enc.setPassword(key);
enc.setSaltGenerator(new StringFixedSaltGenerator(PasswordEncrypter.class.getCanonicalName()) );
 
return enc.decrypt(C);
}
 
}
Property changes:
Added: svn:mime-type
+text/plain
\ No newline at end of property