package Ġpl . st arch as ers . up . util Ċ Ċ import Ġorg . springframework . http . Response Cookie Ċ import Ġpl . st arch as ers . up . service . Jwt Token Service Ċ import Ġjava . time . Duration Ċ import Ġjavax . servlet . http . HttpServletResponse Ċ Ċ fun ĠHttpServletResponse . add Cookie ( cookie : ĠResponse Cookie ) Ġ= Ġadd Cookie ( cookie . toString ()) Ċ Ċ fun ĠHttpServletResponse . add Cookie ( content : ĠString ) Ġ{ ĊĠĠĠ Ġthis . add Header (" Set - Cookie ", Ġcontent ) Ċ } Ċ Ċ fun Ġget Set Empty AccessToken Cookie (): ĠResponse Cookie Ġ= Ġget Cookie ( ĊĠĠĠ ĠJwt Token Service . ACCESS _ TOKEN _ COOKIE _ NAME Ċ ) Ċ Ċ fun Ġget Set Empty RefreshToken Cookie (): ĠResponse Cookie Ġ= Ġget Cookie ( ĊĠĠĠ ĠJwt Token Service . REFRESH _ TOKEN _ COOKIE _ NAME Ċ ) Ċ Ċ fun Ġget Set AccessToken Cookie ( accessToken : ĠString ): ĠResponse Cookie Ġ= Ġget Cookie ( ĊĠĠĠ ĠJwt Token Service . ACCESS _ TOKEN _ COOKIE _ NAME , ĊĠĠĠ ĠaccessToken , ĊĠĠĠ ĠJwt Token Service . ACCESS _ TOKEN _ VALID _ TIME Ċ ) Ċ Ċ fun Ġget Set RefreshToken Cookie ( refresh Token : ĠString ): ĠResponse Cookie Ġ= Ġget Cookie ( ĊĠĠĠ ĠJwt Token Service . REFRESH _ TOKEN _ COOKIE _ NAME , ĊĠĠĠ Ġrefresh Token , ĊĠĠĠ ĠJwt Token Service . REFRESH _ TOKEN _ VALID _ TIME Ċ ) Ċ Ċ private Ġfun Ġget Cookie ( name : ĠString , Ġvalue : ĠString Ġ= Ġ" null ", Ġmax Age : ĠDuration Ġ= ĠDuration . ZERO ): ĠResponse Cookie Ġ= ĊĠĠĠ ĠResponse Cookie . from ( name , Ġvalue ) ĊĠĠĠĠĠĠĠ Ġ. max Age ( max Age ) ĊĠĠĠĠĠĠĠ Ġ. path ("/") ĊĠĠĠĠĠĠĠ Ġ. same Site (" Strict ") ĊĠĠĠĠĠĠĠ Ġ. http Only ( true ) ĊĠĠĠĠĠĠĠ Ġ// ĠTODO Ġmake Ġconfigurable / disable Ġin Ġdev Ġprofile ĊĠĠĠĠĠĠĠ Ġ. secure ( true ) Ġ// ĠComment Ġthis Ġto Ġget Ġcookies Ġworking Ġin Ġins om nia Ġ( or Ġmake Ġa Ġhttps Ġconnection Ġto Ġlocalhost ) ĊĠĠĠĠĠĠĠ Ġ. build () Ċ