newControllers.add(controller);
}
}
private static IDPConfiguration toIDPConfig(OperationContext context, ModelNode fromModel, String alias) throws OperationFailedException {
IDPConfiguration idpType = new IDPConfiguration(alias);
boolean external = IdentityProviderResourceDefinition.EXTERNAL.resolveModelAttribute(context, fromModel).asBoolean();
idpType.setExternal(external);
String url = IdentityProviderResourceDefinition.URL.resolveModelAttribute(context, fromModel).asString();
idpType.setIdentityURL(url);
if (!idpType.isExternal()) {
ModelNode securityDomain = IdentityProviderResourceDefinition.SECURITY_DOMAIN.resolveModelAttribute(context, fromModel);
if (securityDomain.isDefined()) {
idpType.setSecurityDomain(securityDomain.asString());
} else {
throw ROOT_LOGGER.requiredAttribute(ModelElement.COMMON_SECURITY_DOMAIN.getName(), alias);
}
boolean supportsSignatures = IdentityProviderResourceDefinition.SUPPORT_SIGNATURES.resolveModelAttribute(context, fromModel).asBoolean();
idpType.setSupportsSignature(supportsSignatures);
boolean supportsMetadata = IdentityProviderResourceDefinition.SUPPORT_METADATA.resolveModelAttribute(context, fromModel).asBoolean();
idpType.setSupportMetadata(supportsMetadata);
boolean encrypt = IdentityProviderResourceDefinition.ENCRYPT.resolveModelAttribute(context, fromModel).asBoolean();
idpType.setEncrypt(encrypt);
boolean sslAuthentication = IdentityProviderResourceDefinition.SSL_AUTHENTICATION.resolveModelAttribute(context, fromModel).asBoolean();
idpType.setSSLClientAuthentication(sslAuthentication);
boolean strictPostBinding = IdentityProviderResourceDefinition.STRICT_POST_BINDING.resolveModelAttribute(context, fromModel).asBoolean();
idpType.setStrictPostBinding(strictPostBinding);
ModelNode roleGenerator = fromModel.get(ModelElement.IDENTITY_PROVIDER_ROLE_GENERATOR.getName());
String roleGeneratorType;
if (roleGenerator.isDefined()) {
//TODO: resolve PLINK-
ModelNode roleGeneratorValue = roleGenerator.asProperty().getValue();
ModelNode classNameNode = RoleGeneratorResourceDefinition.CLASS_NAME.resolveModelAttribute(context, roleGeneratorValue);
ModelNode codeNode = RoleGeneratorResourceDefinition.CODE.resolveModelAttribute(context, roleGeneratorValue);
if (classNameNode.isDefined()) {
roleGeneratorType = classNameNode.asString();
} else if (codeNode.isDefined()) {
roleGeneratorType = RoleGeneratorTypeEnum.forType(codeNode.asString());
} else {
throw ROOT_LOGGER.typeNotProvided(IDENTITY_PROVIDER_ROLE_GENERATOR.getName());
}
} else {
roleGeneratorType = UndertowRoleGenerator.class.getName();
}
idpType.setRoleGenerator(roleGeneratorType);
ModelNode attributeManager = fromModel.get(ModelElement.IDENTITY_PROVIDER_ATTRIBUTE_MANAGER.getName());
String attributeManagerType;
if (attributeManager.isDefined()) {
ModelNode attributeManagerValue = attributeManager.asProperty().getValue();
ModelNode classNameNode = AttributeManagerResourceDefinition.CLASS_NAME.resolveModelAttribute(context, attributeManagerValue);
ModelNode codeNode = AttributeManagerResourceDefinition.CODE.resolveModelAttribute(context, attributeManagerValue);
if (classNameNode.isDefined()) {
attributeManagerType = classNameNode.asString();
} else if (codeNode.isDefined()) {
attributeManagerType = AttributeManagerTypeEnum.forType(codeNode.asString());
} else {
throw ROOT_LOGGER.typeNotProvided(IDENTITY_PROVIDER_ATTRIBUTE_MANAGER.getName());
}
} else {
attributeManagerType = UndertowAttributeManager.class.getName();
}
idpType.setAttributeManager(attributeManagerType);
}
return idpType;
}