Skip to content

Commit

Permalink
Fix of Forbidden error when auth cookie gets expired
Browse files Browse the repository at this point in the history
  • Loading branch information
andan67 committed Sep 12, 2021
1 parent 75ecc89 commit 230392d
Showing 1 changed file with 7 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -143,9 +143,14 @@ public void filter(final @Nullable ClientRequestContext requestCtx) throws IOExc
if (newCookies != null) {
final NewCookie authCookie = newCookies.get(AUTHCOOKIENAME);
if (authCookie != null) {
// create cookie with expiry date using 80% of maxAge given in seconds
final Date expiryDate = new Date(new Date().getTime() + 800L *authCookie.getMaxAge());
final NewCookie newAuthCookieToStore = new NewCookie(
authCookie.toCookie(), authCookie.getComment(), authCookie.getMaxAge(),
expiryDate, authCookie.isSecure(), authCookie.isHttpOnly());
logger.debug("Authorization cookie was renewed");
logger.debug("New auth cookie: {} for host: {}", authCookie.getValue(), host);
authCookieStore.setAuthCookieForHost(host, authCookie);
logger.debug("New auth cookie: {} for host: {}", newAuthCookieToStore.getValue(), host);
authCookieStore.setAuthCookieForHost(host, newAuthCookieToStore);
} else {
logger.debug("No authorization cookie was returned");
}
Expand Down

0 comments on commit 230392d

Please sign in to comment.