private static Collection < MessageDescriptor > calculateAuthenticationWarningMessages ( final TicketGrantingTicket tgtId , final MessageContext messageContext ) { val entries = tgtId . getAuthentication ( ) . getSuccesses ( ) . entrySet ( ) ; val messages = entries . stream ( ) . map ( entry -> entry . getValue ( ) . getWarnings ( ) ) . filter ( entry -> ! entry . isEmpty ( ) ) . collect ( Collectors . toList ( ) ) ; messages . add ( tgtId . getAuthentication ( ) . getWarnings ( ) ) ; return messages . stream ( ) . flatMap ( Collection :: stream ) . peek ( message -> addMessageDescriptorToMessageContext ( messageContext , message ) ) . collect ( Collectors . toSet ( ) ) ; }
Add warning messages to message context if needed .