Search in sources :

Example 1 with BaseFilter

use of org.xdi.oxauth.model.configuration.BaseFilter in project oxAuth by GluuFederation.

the class BaseAuthFilterService method prepareAuthenticationFilterWithParameters.

private List<AuthenticationFilterWithParameters> prepareAuthenticationFilterWithParameters(List<? extends BaseFilter> p_filterList) {
    final List<AuthenticationFilterWithParameters> tmpAuthenticationFilterWithParameters = new ArrayList<AuthenticationFilterWithParameters>();
    if (!this.enabled || p_filterList == null) {
        return tmpAuthenticationFilterWithParameters;
    }
    for (BaseFilter authenticationFilter : p_filterList) {
        if (Boolean.TRUE.equals(authenticationFilter.getBind()) && StringHelper.isEmpty(authenticationFilter.getBindPasswordAttribute())) {
            log.error("Skipping authentication filter:\n '{}'\n. It should contains not empty bind-password-attribute attribute. ", authenticationFilter);
            continue;
        }
        List<String> variableNames = new ArrayList<String>();
        List<BaseAuthFilterService.IndexedParameter> indexedParameters = new ArrayList<BaseAuthFilterService.IndexedParameter>();
        Matcher matcher = BaseAuthFilterService.PARAM_VALUE_PATTERN.matcher(authenticationFilter.getFilter());
        while (matcher.find()) {
            String paramName = normalizeAttributeName(matcher.group(1));
            String paramIndex = matcher.group(2);
            variableNames.add(paramName);
            indexedParameters.add(new BaseAuthFilterService.IndexedParameter(paramName, paramIndex));
        }
        AuthenticationFilterWithParameters tmpAutheticationFilterWithParameter = new AuthenticationFilterWithParameters(authenticationFilter, variableNames, indexedParameters);
        tmpAuthenticationFilterWithParameters.add(tmpAutheticationFilterWithParameter);
        log.debug("Authentication filter with parameters: '{}'. ", tmpAutheticationFilterWithParameter);
    }
    return tmpAuthenticationFilterWithParameters;
}
Also used : Matcher(java.util.regex.Matcher) ArrayList(java.util.ArrayList) BaseFilter(org.xdi.oxauth.model.configuration.BaseFilter)

Aggregations

ArrayList (java.util.ArrayList)1 Matcher (java.util.regex.Matcher)1 BaseFilter (org.xdi.oxauth.model.configuration.BaseFilter)1