core/cas-server-core-authentication/src/main/java/org/apereo/cas/services/DefaultMultifactorAuthenticationProviderBypass.java
/**
     * Evaluate attribute rules for bypass.
     *
     * @param attrName   the attr name
     * @param attrValue  the attr value
     * @param attributes the attributes
     * @return true if event should not be bypassed.
     */
Evaluate attribute rules for bypass.
@param attrName   the attr name
@param attrValue  the attr value
@param attributes the attributes
@return true if event should not be bypassed.
Evaluate attribute rules for bypass . @param attrName the attr name @param attrValue the attr value @param attributes the attributes @return true if event should not be bypassed .
protected boolean evaluateAttributeRulesForBypass(final String attrName, final String attrValue,
                                                      final Map<String, Object> attributes) {
        boolean supports = true;
        if (StringUtils.isNotBlank(attrName)) {
            final Set<Map.Entry<String, Object>> names = attributes.entrySet().stream().filter(e ->
                    e.getKey().matches(attrName)
            ).collect(Collectors.toSet());
            supports = names.isEmpty();
            if (!names.isEmpty() && (StringUtils.isNotBlank(attrValue))) {
                final Set<Map.Entry<String, Object>> values = names.stream().filter(e -> {
                    final Set<Object> valuesCol = CollectionUtils.convertValueToCollection(e.getValue());
                    return valuesCol.stream()
                            .filter(v -> v.toString().matches(attrValue))
                            .findAny()
                            .isPresent();
                }).collect(Collectors.toSet());
                supports = values.isEmpty();
            }
        }
        return supports;
    }
protected boolean evaluateAttributeRulesForBypass ( final String attrName , final String attrValue , final Map < String , Object > attributes ) { boolean supports = true ; if ( StringUtils . isNotBlank ( attrName ) ) { final Set < Map . Entry < String , Object > > names = attributes . entrySet ( ) . stream ( ) . filter ( e -> e . getKey ( ) . matches ( attrName ) ) . collect ( Collectors . toSet ( ) ) ; supports = names . isEmpty ( ) ; if ( ! names . isEmpty ( ) && ( StringUtils . isNotBlank ( attrValue ) ) ) { final Set < Map . Entry < String , Object > > values = names . stream ( ) . filter ( e -> { final Set < Object > valuesCol = CollectionUtils . convertValueToCollection ( e . getValue ( ) ) ; return valuesCol . stream ( ) . filter ( v -> v . toString ( ) . matches ( attrValue ) ) . findAny ( ) . isPresent ( ) ; } ) . collect ( Collectors . toSet ( ) ) ; supports = values . isEmpty ( ) ; } } return supports ; }
Evaluate attribute rules for bypass.
Evaluate attribute rules for bypass .