use of com.sun.identity.common.AttributeStruct in project OpenAM by OpenRock.
the class FedSystemProperties method initAttributeMapping.
private static void initAttributeMapping() {
if (systemConfigProps != null) {
systemConfigProps.clear();
}
ResourceBundle rb = ResourceBundle.getBundle("serverAttributeMap");
for (Enumeration<String> e = rb.getKeys(); e.hasMoreElements(); ) {
String propertyName = e.nextElement();
attributeMap.put(propertyName, new AttributeStruct(rb.getString(propertyName)));
}
}
use of com.sun.identity.common.AttributeStruct in project OpenAM by OpenRock.
the class FedSystemProperties method get.
/**
* Returns system properties.
*
* @param key Key to the properties.
*/
@Override
public String get(String key) {
String value = null;
if (isServerMode()) {
AttributeStruct ast = attributeMap.get(key);
if (ast != null) {
value = PropertiesFinder.getProperty(key, ast);
}
}
if (key.startsWith(METADATA_SIGNING_KEY)) {
//this will be true for both the key alias and the password
int idx = key.indexOf('[');
String attribute = key.substring(0, idx);
String realm = key.substring(idx + 1, key.length() - 1);
try {
OrganizationConfigManager orgMgr = new OrganizationConfigManager(AccessController.doPrivileged(AdminTokenAction.getInstance()), realm);
Map<String, Set<String>> svcAttrs = orgMgr.getServiceAttributes("sunFAMSAML2Configuration");
return CollectionHelper.getMapAttr(svcAttrs, attribute);
} catch (SMSException smse) {
Debug.getInstance("libSAML2").error("Unable to retrieve " + attribute + " from realm: " + realm, smse);
return null;
}
}
return value != null ? value : getPropertyValue(key);
}
use of com.sun.identity.common.AttributeStruct in project OpenAM by OpenRock.
the class SystemProperties method get.
/**
* This method lets you query for a system property whose value is same as
* <code>String</code> key. The method first tries to read the property
* from java.lang.System followed by a lookup in the config file.
*
* @param key
* type <code>String</code>, the key whose value one is
* looking for.
* @return the value if the key exists; otherwise returns <code>null</code>
*/
public static String get(String key) {
String answer = null;
// look up values in SMS services only if in server mode.
if (isServerMode() || SITEMONITOR_DISABLED) {
AttributeStruct ast = ATTRIBUTE_MAP.get(key);
if (ast != null) {
answer = PropertiesFinder.getProperty(key, ast);
}
}
if (answer == null) {
answer = getProp(key);
final Map<String, String> tagswapValues = propertiesHolderRef.get().tagSwapValues;
if (answer != null && tagswapValues != null && answer.indexOf(TAG_START) != -1) {
for (Map.Entry<String, String> tagSwapEntry : tagswapValues.entrySet()) {
String k = tagSwapEntry.getKey();
String val = tagSwapEntry.getValue();
if (k.equals("%SERVER_URI%")) {
if (!StringUtils.isEmpty(val)) {
if (val.charAt(0) == '/') {
answer = answer.replaceAll("/%SERVER_URI%", val);
String lessSlash = val.substring(1);
answer = answer.replaceAll("%SERVER_URI%", lessSlash);
} else {
answer = answer.replaceAll(k, val);
}
}
} else {
answer = answer.replaceAll(k, val);
}
}
if (answer.contains("%ROOT_SUFFIX%")) {
answer = answer.replaceAll("%ROOT_SUFFIX%", SMSEntry.getAMSdkBaseDN());
}
}
}
return answer;
}
use of com.sun.identity.common.AttributeStruct in project OpenAM by OpenRock.
the class ConfigurationObserver method createAttributeMapping.
private void createAttributeMapping() {
// never get store in SMS services
if (SystemProperties.isServerMode()) {
Map attributeMap = SystemProperties.getAttributeMap();
for (Iterator i = attributeMap.values().iterator(); i.hasNext(); ) {
AttributeStruct a = (AttributeStruct) i.next();
migratedServiceNames.add(a.getServiceName());
}
}
}
Aggregations