use of com.sun.identity.authentication.config.AuthConfigurationEntry in project OpenAM by OpenRock.
the class AuthenticationChainsFilter method transformAuthChainConfiguration.
private ResourceResponse transformAuthChainConfiguration(ResourceResponse resource) {
if (resource.getContent().isDefined("authChainConfiguration")) {
List<AuthConfigurationEntry> entries = AMAuthConfigUtils.xmlToAuthConfigurationEntry(resource.getContent().get("authChainConfiguration").asString());
JsonValue authChainConfiguration = json(array());
for (AuthConfigurationEntry entry : entries) {
JsonValue authChainEntry = json(object());
authChainEntry.add("module", entry.getLoginModuleName());
authChainEntry.add("criteria", entry.getControlFlag());
authChainEntry.add("options", parseOptions(entry.getOptions()).getObject());
authChainConfiguration.add(authChainEntry.getObject());
}
resource.getContent().put("authChainConfiguration", authChainConfiguration.getObject());
}
return resource;
}
use of com.sun.identity.authentication.config.AuthConfigurationEntry in project OpenAM by OpenRock.
the class AuthenticationChainsFilter method transformRequestBody.
private JsonValue transformRequestBody(JsonValue body) throws InternalServerErrorException {
if (body.isDefined("authChainConfiguration")) {
try {
List<AuthConfigurationEntry> entries = new ArrayList<>();
for (JsonValue entry : body.get("authChainConfiguration")) {
String module = entry.get("module").asString();
String criteria = entry.get("criteria").asString();
String options = getOptions(entry);
entries.add(new AuthConfigurationEntry(module, criteria, options));
}
body.put("authChainConfiguration", AMAuthConfigUtils.authConfigurationEntryToXMLString(entries));
} catch (AMConfigurationException e) {
throw new InternalServerErrorException("Failed to parse authChainConfiguration", e);
}
}
return body;
}
Aggregations