protected boolean locateMatchingHttpRequest ( final Authentication authentication , final HttpServletRequest request ) { if ( StringUtils . isNotBlank ( bypassProperties . getHttpRequestRemoteAddress ( ) ) ) { if ( httpRequestRemoteAddressPattern . matcher ( request . getRemoteAddr ( ) ) . find ( ) ) { LOGGER . debug ( "Http request remote address [{}] matches [{}]" , bypassProperties . getHttpRequestRemoteAddress ( ) , request . getRemoteAddr ( ) ) ; return true ; } if ( httpRequestRemoteAddressPattern . matcher ( request . getRemoteHost ( ) ) . find ( ) ) { LOGGER . debug ( "Http request remote host [{}] matches [{}]" , bypassProperties . getHttpRequestRemoteAddress ( ) , request . getRemoteHost ( ) ) ; return true ; } } if ( StringUtils . isNotBlank ( bypassProperties . getHttpRequestHeaders ( ) ) ) { val headerNames = Collections . list ( request . getHeaderNames ( ) ) ; val matched = this . httpRequestHeaderPatterns . stream ( ) . anyMatch ( pattern -> headerNames . stream ( ) . anyMatch ( name -> pattern . matcher ( name ) . matches ( ) ) ) ; if ( matched ) { LOGGER . debug ( "Http request remote headers [{}] match [{}]" , headerNames , bypassProperties . getHttpRequestHeaders ( ) ) ; return true ; } } return false ; }
Locate matching http request and determine if bypass should be enabled .