If the GrantedAuthority is not equal, but contains a duplicate
GrantedAuthority#getAuthority() then at the time of authentication,
the Filter or WebFilter will duplicate the GrantedAuthority which leads
to a memory leak. This is important to avoid for when we add support for
a GrantedAuthority that might have an issuedAt attribute. If it is too
old, then we'd want only the new GrantedAuthority to be added and the old
instance to be removed. However, the two GrantedAuthority instances
will not be equal because the issuedAt will not be equal.
Closes gh-17981
@ -251,8 +254,19 @@ public abstract class AbstractAuthenticationProcessingFilter extends GenericFilt
@@ -251,8 +254,19 @@ public abstract class AbstractAuthenticationProcessingFilter extends GenericFilt
@ -187,8 +190,19 @@ public class AuthenticationFilter extends OncePerRequestFilter {
@@ -187,8 +190,19 @@ public class AuthenticationFilter extends OncePerRequestFilter {
@ -207,8 +210,19 @@ public abstract class AbstractPreAuthenticatedProcessingFilter extends GenericFi
@@ -207,8 +210,19 @@ public abstract class AbstractPreAuthenticatedProcessingFilter extends GenericFi
@ -188,7 +191,20 @@ public class BasicAuthenticationFilter extends OncePerRequestFilter {
@@ -188,7 +191,20 @@ public class BasicAuthenticationFilter extends OncePerRequestFilter {
@ -138,7 +141,20 @@ public class AuthenticationWebFilter implements WebFilter {
@@ -138,7 +141,20 @@ public class AuthenticationWebFilter implements WebFilter {
@ -438,6 +444,42 @@ public class AbstractAuthenticationProcessingFilterTests {
@@ -438,6 +444,42 @@ public class AbstractAuthenticationProcessingFilterTests {
@ -453,38 +495,41 @@ public class AbstractAuthenticationProcessingFilterTests {
@@ -453,38 +495,41 @@ public class AbstractAuthenticationProcessingFilterTests {
@ -496,6 +541,14 @@ public class AbstractAuthenticationProcessingFilterTests {
@@ -496,6 +541,14 @@ public class AbstractAuthenticationProcessingFilterTests {
this.exceptionToThrow=newBadCredentialsException("Mock requested to do so");
@ -389,6 +395,56 @@ public class AbstractPreAuthenticatedProcessingFilterTests {
@@ -389,6 +395,56 @@ public class AbstractPreAuthenticatedProcessingFilterTests {