protected boolean requiredAttributesFoundInMap ( final Map < String , Object > principalAttributes , final Map < String , Set < String > > requiredAttributes ) { val difference = requiredAttributes . keySet ( ) . stream ( ) . filter ( a -> principalAttributes . keySet ( ) . contains ( a ) ) . collect ( Collectors . toSet ( ) ) ; LOGGER . debug ( "Difference of checking required attributes: [{}]" , difference ) ; if ( this . requireAllAttributes && difference . size ( ) < requiredAttributes . size ( ) ) { return false ; } if ( this . requireAllAttributes ) { return difference . stream ( ) . allMatch ( key -> requiredAttributeFound ( key , principalAttributes , requiredAttributes ) ) ; } return difference . stream ( ) . anyMatch ( key -> requiredAttributeFound ( key , principalAttributes , requiredAttributes ) ) ; }
Check whether required attributes are found in the given map .