return allTransports;
}
public SecurityConfigData getSecurityConfigData(String serviceName, String scenarioId,
String policyPath) throws SecurityConfigException {
SecurityConfigData data = null;
try {
if (scenarioId == null) {
return data;
}
AxisService service = axisConfig.getServiceForActivation(serviceName);
/**
* Scenario ID can either be a default one (out of 15) or "policyFromRegistry", which
* means the current scenario refers to a custom policy from registry. If that is the
* case, we can't read the current scenario from the WSU ID. Therefore, we don't
* check the scenario ID. In default cases, we check it.
*/
if (scenarioId.equals(SecurityConstants.POLICY_FROM_REG_SCENARIO)) {
Parameter param = service.getParameter(SecurityConstants.SECURITY_POLICY_PATH);
if (param == null || !policyPath.equals(param.getValue())) {
return data;
}
} else {
SecurityScenario scenario = readCurrentScenario(serviceName);
if (scenario == null || !scenario.getScenarioId().equals(scenarioId)) {
return data;
}
}
data = new SecurityConfigData();
String servicePath = RegistryResources.SERVICE_GROUPS
+ service.getAxisServiceGroup().getServiceGroupName()
+ RegistryResources.SERVICES + serviceName;
AuthorizationManager acReader = realm.getAuthorizationManager();
String[] roles = acReader.getAllowedRolesForResource(servicePath,
UserCoreConstants.INVOKE_SERVICE_PERMISSION);
data.setUserGroups(roles);
Association[] pvtStores = registry.getAssociations(servicePath,
SecurityConstants.ASSOCIATION_PRIVATE_KEYSTORE);
if (pvtStores.length > 0) {
String temp = pvtStores[0].getDestinationPath();
if (temp.startsWith("//")) {
temp = temp.substring(1);
}
if (temp.equals(RegistryConstants.GOVERNANCE_REGISTRY_BASE_PATH +
RegistryResources.SecurityManagement.PRIMARY_KEYSTORE_PHANTOM_RESOURCE)) {
ServerConfiguration config = ServerConfiguration.getInstance();
String file = new File(config.getFirstProperty(RegistryResources
.SecurityManagement.SERVER_PRIMARY_KEYSTORE_FILE)).getAbsolutePath();
String name = KeyStoreUtil.getKeyStoreFileName(file);
data.setPrivateStore(name);
} else {
temp = temp.substring(temp.lastIndexOf("/") + 1);
data.setPrivateStore(temp);
}
}
Association[] tstedStores = registry.getAssociations(servicePath,
SecurityConstants.ASSOCIATION_TRUSTED_KEYSTORE);
String[] trustedStores = new String[tstedStores.length];
for (int i = 0; i < tstedStores.length; i++) {
String temp = tstedStores[i].getDestinationPath();
if (temp.startsWith("//")) {
temp = temp.substring(1);
}
if (temp.equals(RegistryConstants.GOVERNANCE_REGISTRY_BASE_PATH +
RegistryResources.SecurityManagement.PRIMARY_KEYSTORE_PHANTOM_RESOURCE)) {
ServerConfiguration config = ServerConfiguration.getInstance();
String file = new File(config.getFirstProperty(RegistryResources
.SecurityManagement.SERVER_PRIMARY_KEYSTORE_FILE)).getAbsolutePath();
String name = KeyStoreUtil.getKeyStoreFileName(file);
trustedStores[i] = name;
} else {
temp = temp.substring(temp.lastIndexOf("/") + 1);
trustedStores[i] = temp;
}
}
data.setTrustedKeyStores(trustedStores);
KerberosConfigData kerberosData = this.readKerberosConfigurations(service);
data.setKerberosConfigurations(kerberosData);
return data;
} catch (RegistryException e) {
// TODO Auto-generated catch block
e.printStackTrace();