public static String sanitize ( final String msg ) { var modifiedMessage = msg ; if ( StringUtils . isNotBlank ( msg ) && ! Boolean . getBoolean ( "CAS_TICKET_ID_SANITIZE_SKIP" ) ) { val matcher = TICKET_ID_PATTERN . matcher ( msg ) ; while ( matcher . find ( ) ) { val match = matcher . group ( ) ; val group = matcher . group ( 1 ) ; val length = group . length ( ) ; var replaceLength = length - VISIBLE_TAIL_LENGTH - ( HOST_NAME_LENGTH + 1 ) ; if ( replaceLength <= 0 ) { replaceLength = length ; } val newId = match . replace ( group . substring ( 0 , replaceLength ) , "*" . repeat ( OBFUSCATION_LENGTH ) ) ; modifiedMessage = modifiedMessage . replaceAll ( match , newId ) ; } } return modifiedMessage ; }
Remove ticket id from the message .