private void parseCustomNodeTypes(ModelNode model, EditableDocument configDoc) { if (model.hasDefined(ModelKeys.NODE_TYPES)) { EditableArray nodeTypesArray = configDoc.getOrCreateArray(FieldName.NODE_TYPES); for (ModelNode nodeType : model.get(ModelKeys.NODE_TYPES).asList()) { nodeTypesArray.add(nodeType.asString()); } } }
private void parseSecurity(OperationContext context, ModelNode model, EditableDocument configDoc) throws OperationFailedException { EditableDocument security = configDoc.getOrCreateDocument(FieldName.SECURITY); // Anonymous ... EditableDocument anon = security.getOrCreateDocument(FieldName.ANONYMOUS); String anonUsername = attribute(context, model, ModelAttributes.ANONYMOUS_USERNAME).asString(); boolean useAnonIfFailed = attribute(context, model, ModelAttributes.USE_ANONYMOUS_IF_AUTH_FAILED).asBoolean(); anon.set(FieldName.ANONYMOUS_USERNAME, anonUsername); anon.set(FieldName.USE_ANONYMOUS_ON_FAILED_LOGINS, useAnonIfFailed); List<ModelNode> modelNodes = model.hasDefined(ModelKeys.ANONYMOUS_ROLES) ? model.get(ModelKeys.ANONYMOUS_ROLES).asList() : ModelAttributes.ANONYMOUS_ROLES.getDefaultValue().asList(); for (ModelNode roleNode : modelNodes) { EditableArray anonymousRolesArray = anon.getOrCreateArray(FieldName.ANONYMOUS_ROLES); String roleName = roleNode.asString(); if (!StringUtil.isBlank(roleName)) { anonymousRolesArray.addString(roleName); } } EditableArray providers = security.getOrCreateArray(FieldName.PROVIDERS); // JBoss authenticator ... String securityDomain = attribute(context, model, ModelAttributes.SECURITY_DOMAIN).asString(); EditableDocument jboss = Schematic.newDocument(); jboss.set(FieldName.CLASSNAME, JBossDomainAuthenticationProvider.class.getName()); jboss.set(FieldName.SECURITY_DOMAIN, securityDomain); providers.add(jboss); // Servlet authenticator ... EditableDocument servlet = Schematic.newDocument(); servlet.set(FieldName.CLASSNAME, "servlet"); providers.add(servlet); }