Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Issue #6205 - Fix serialization issues in OpenIdAuthenticator (Jetty 10) #6265

Merged
merged 1 commit into from
May 12, 2021
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -521,22 +521,30 @@ private Map<String, UriRedirectInfo> ensureCsrfMap(HttpSession session)
Map<String, UriRedirectInfo> csrfMap = (Map<String, UriRedirectInfo>)session.getAttribute(CSRF_MAP);
if (csrfMap == null)
{
// Create a custom Map so we can only have a limited number of request URIs saved.
csrfMap = new LinkedHashMap<>()
{
private static final int MAX_SIZE = 64;

@Override
protected boolean removeEldestEntry(Map.Entry<String, UriRedirectInfo> eldest)
{
return size() > MAX_SIZE;
}
};
csrfMap = new MRUMap(64);
session.setAttribute(CSRF_MAP, csrfMap);
}
return csrfMap;
}

private static class MRUMap extends LinkedHashMap<String, UriRedirectInfo>
{
private static final long serialVersionUID = 5375723072014233L;

private final int _size;

private MRUMap(int size)
{
_size = size;
}

@Override
protected boolean removeEldestEntry(Map.Entry<String, UriRedirectInfo> eldest)
{
return size() > _size;
}
}

private static class UriRedirectInfo implements Serializable
{
private static final long serialVersionUID = 139567755844461433L;
Expand Down