protected boolean addJwtCookies ( String cookieByteString , HttpServletRequest req , HttpServletResponse resp ) { String baseName = getJwtCookieName ( ) ; if ( baseName == null ) { return false ; } if ( ( ! req . isSecure ( ) ) && getJwtCookieSecure ( ) ) { Tr . warning ( tc , "JWT_COOKIE_SECURITY_MISMATCH" , new Object [ ] { } ) ; // CWWKS9127W } String [ ] chunks = splitString ( cookieByteString , 3900 ) ; String cookieName = baseName ; for ( int i = 0 ; i < chunks . length ; i ++ ) { if ( i > 98 ) { String eMsg = "Too many jwt cookies created" ; com . ibm . ws . ffdc . FFDCFilter . processException ( new Exception ( eMsg ) , this . getClass ( ) . getName ( ) , "132" ) ; break ; } Cookie ssoCookie = createCookie ( req , cookieName , chunks [ i ] , getJwtCookieSecure ( ) ) ; //name resp . addCookie ( ssoCookie ) ; cookieName = baseName + ( i + 2 < 10 ? "0" : "" ) + ( i + 2 ) ; //name02... name99 } return true ; }
Add the cookie or cookies as needed depending on size of token . Return true if any cookies were added