protected String getJWTFromCookie ( HttpServletRequest req ) { String serializedJWT = null ; Cookie [ ] cookies = req . getCookies ( ) ; if ( cookieName != null && cookies != null ) { for ( Cookie cookie : cookies ) { if ( cookieName . equals ( cookie . getName ( ) ) ) { if ( LOG . isDebugEnabled ( ) ) { LOG . debug ( "{} cookie has been found and is being processed" , cookieName ) ; } serializedJWT = cookie . getValue ( ) ; break ; } } } return serializedJWT ; }
Encapsulate the acquisition of the JWT token from HTTP cookies within the request .