protected STSClient getSTSClient() {
/*
* Builder builder = new Builder(this.stsConfigurationFile); STSClient client = new STSClient(builder.build());
*/
Builder builder = null;
STSClient client = null;
if (rawOptions.containsKey(STS_CONFIG_FILE)) {
builder = new Builder(this.stsConfigurationFile);
client = STSClientFactory.getInstance(maxClientsInPool).create(initialNumberOfClients, builder.build());
} else {
builder = new Builder();
builder.endpointAddress((String) rawOptions.get(ENDPOINT_ADDRESS));
builder.portName((String) rawOptions.get(PORT_NAME)).serviceName((String) rawOptions.get(SERVICE_NAME));
builder.username((String) rawOptions.get(USERNAME_KEY)).password((String) rawOptions.get(PASSWORD_KEY));
String passwordString = (String) rawOptions.get(PASSWORD_KEY);
if (passwordString != null && passwordString.startsWith(PicketLinkFederationConstants.PASS_MASK_PREFIX)) {
// password is masked
String salt = (String) rawOptions.get(PicketLinkFederationConstants.SALT);
if (StringUtil.isNullOrEmpty(salt))
throw logger.optionNotSet("Salt");
String iCount = (String) rawOptions.get(PicketLinkFederationConstants.ITERATION_COUNT);
if (StringUtil.isNullOrEmpty(iCount))
throw logger.optionNotSet("Iteration Count");
int iterationCount = Integer.parseInt(iCount);
try {
builder.password(StringUtil.decode(passwordString, salt, iterationCount));
} catch (Exception e) {
throw logger.unableToDecodePasswordError(passwordString);
}
}
client = STSClientFactory.getInstance(maxClientsInPool).create(initialNumberOfClients, builder.build());
}
// if the login module options map still contains any properties, assume they are for configuring the connection
// to the STS and set them in the Dispatch request context.
if (!this.options.isEmpty()) {