use of org.wso2.carbon.identity.core.model.FilterTreeBuilder in project carbon-identity-framework by wso2.
the class IdentityProviderManager method getExpressionNodes.
/**
* Get the filter node as a list.
*
* @param filter value of the filter.
* @return node tree.
* @throws IdentityProviderManagementClientException Error when validate filters.
*/
private List<ExpressionNode> getExpressionNodes(String filter) throws IdentityProviderManagementClientException {
// Filter example : name sw "te" and name ew "st" and isEnabled eq "true".
List<ExpressionNode> expressionNodes = new ArrayList<>();
FilterTreeBuilder filterTreeBuilder;
try {
if (StringUtils.isNotBlank(filter)) {
filterTreeBuilder = new FilterTreeBuilder(filter);
Node rootNode = filterTreeBuilder.buildTree();
setExpressionNodeList(rootNode, expressionNodes);
}
} catch (IOException | IdentityException e) {
String message = "Error occurred while validate filter, filter: " + filter;
throw IdPManagementUtil.handleClientException(IdPManagementConstants.ErrorMessage.ERROR_CODE_RETRIEVE_IDP, message, e);
}
return expressionNodes;
}
use of org.wso2.carbon.identity.core.model.FilterTreeBuilder in project identity-api-server by wso2.
the class ServerApplicationManagementService method buildFilterNode.
private ExpressionNode buildFilterNode(String filter) {
if (StringUtils.isNotBlank(filter)) {
try {
FilterTreeBuilder filterTreeBuilder = new FilterTreeBuilder(filter);
Node rootNode = filterTreeBuilder.buildTree();
if (rootNode instanceof ExpressionNode) {
ExpressionNode expressionNode = (ExpressionNode) rootNode;
if (SEARCH_SUPPORTED_FIELDS.contains(expressionNode.getAttributeValue())) {
return expressionNode;
} else {
throw buildClientError(ErrorMessage.UNSUPPORTED_FILTER_ATTRIBUTE, expressionNode.getAttributeValue());
}
} else {
throw buildClientError(ErrorMessage.INVALID_FILTER_FORMAT);
}
} catch (IOException | IdentityException e) {
throw buildClientError(ApplicationManagementConstants.ErrorMessage.INVALID_FILTER_FORMAT, null);
}
} else {
return null;
}
}
use of org.wso2.carbon.identity.core.model.FilterTreeBuilder in project identity-api-server by wso2.
the class ServerAuthenticatorManagementService method getExpressionNodesForIdp.
private List<ExpressionNode> getExpressionNodesForIdp(String filter) {
// Filter example : name sw go and (tag eq 2fa or tag eq Social-Login)
List<ExpressionNode> expressionNodes = new ArrayList<>();
FilterTreeBuilder filterTreeBuilder;
try {
if (StringUtils.isNotBlank(filter)) {
filterTreeBuilder = new FilterTreeBuilder(filter);
Node rootNode = filterTreeBuilder.buildTree();
setExpressionNodeListForIdp(rootNode, expressionNodes);
}
} catch (IOException | IdentityException e) {
throw buildClientError(Constants.ErrorMessage.ERROR_CODE_INVALID_FILTER_FORMAT, null);
}
return expressionNodes;
}
use of org.wso2.carbon.identity.core.model.FilterTreeBuilder in project identity-api-server by wso2.
the class ServerAuthenticatorManagementService method getExpressionNodesForAuthenticator.
private List<ExpressionNode> getExpressionNodesForAuthenticator(String filter) {
// Filter example : name sw go and (tag eq 2fa or tag eq Social-Login)
List<ExpressionNode> expressionNodes = new ArrayList<>();
FilterTreeBuilder filterTreeBuilder;
try {
if (StringUtils.isNotBlank(filter)) {
filterTreeBuilder = new FilterTreeBuilder(filter);
Node rootNode = filterTreeBuilder.buildTree();
validateFilter(rootNode);
setExpressionNodeListForAuthenticator(rootNode, expressionNodes);
}
} catch (IOException | IdentityException e) {
throw buildClientError(Constants.ErrorMessage.ERROR_CODE_INVALID_FILTER_FORMAT, null);
}
return expressionNodes;
}
Aggregations