public static SecurityConfig createSecurityConfig(final ConfigTree securityFragment)
{
final String moduleName = securityFragment.getAttribute(ListenerTagNames.MODULE_NAME_TAG);
Builder builder = new SecurityConfig.Builder(moduleName);
builder.runAs(securityFragment.getAttribute(ListenerTagNames.RUN_AS_TAG));
builder.useCallerIdentity(securityFragment.getAttribute(ListenerTagNames.USE_CALLERS_IDENTIDY_TAG));
builder.rolesAllowed(securityFragment.getAttribute(ListenerTagNames.ROLES_ALLOWED));
builder.callBackhandler(securityFragment.getAttribute(ListenerTagNames.CALLBACK_HANDLER_TAG));
ConfigTree[] children = securityFragment.getChildren("property");
for (ConfigTree configTree : children)
{
String propertyName = configTree.getAttribute("name");
String propertyValue = configTree.getAttribute("value");
builder.property(propertyName, propertyValue);
}
return builder.build();
}