Skip to content

Commit c217fd9

Browse files
aarmamSanderKondratjevNortal
authored andcommitted
Redundant successfulAuthentication override
1 parent c186e38 commit c217fd9

File tree

1 file changed

+2
-13
lines changed

1 file changed

+2
-13
lines changed

example/src/main/java/eu/webeid/example/security/WebEidAjaxLoginProcessingFilter.java

Lines changed: 2 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -27,8 +27,6 @@
2727
import eu.webeid.example.security.ajax.AjaxAuthenticationFailureHandler;
2828
import eu.webeid.example.security.ajax.AjaxAuthenticationSuccessHandler;
2929
import eu.webeid.security.authtoken.WebEidAuthToken;
30-
import jakarta.servlet.FilterChain;
31-
import jakarta.servlet.ServletException;
3230
import jakarta.servlet.http.HttpServletRequest;
3331
import jakarta.servlet.http.HttpServletResponse;
3432
import org.slf4j.Logger;
@@ -41,20 +39,17 @@
4139
import org.springframework.security.authentication.BadCredentialsException;
4240
import org.springframework.security.core.Authentication;
4341
import org.springframework.security.core.AuthenticationException;
44-
import org.springframework.security.core.context.SecurityContextHolder;
4542
import org.springframework.security.web.authentication.AbstractAuthenticationProcessingFilter;
4643
import org.springframework.security.web.authentication.preauth.PreAuthenticatedAuthenticationToken;
4744
import org.springframework.security.web.authentication.session.SessionFixationProtectionStrategy;
4845
import org.springframework.security.web.context.HttpSessionSecurityContextRepository;
49-
import org.springframework.security.web.context.SecurityContextRepository;
5046
import org.springframework.security.web.servlet.util.matcher.PathPatternRequestMatcher;
5147

5248
import java.io.IOException;
5349

5450
public class WebEidAjaxLoginProcessingFilter extends AbstractAuthenticationProcessingFilter {
5551
private static final Logger LOG = LoggerFactory.getLogger(WebEidAjaxLoginProcessingFilter.class);
5652
private final ObjectReader OBJECT_READER = new ObjectMapper().readerFor(WebEidAuthToken.class);
57-
private final SecurityContextRepository securityContextRepository;
5853

5954
public WebEidAjaxLoginProcessingFilter(
6055
String defaultFilterProcessesUrl,
@@ -64,8 +59,8 @@ public WebEidAjaxLoginProcessingFilter(
6459
this.setAuthenticationManager(authenticationManager);
6560
this.setAuthenticationSuccessHandler(new AjaxAuthenticationSuccessHandler());
6661
this.setAuthenticationFailureHandler(new AjaxAuthenticationFailureHandler());
67-
setSessionAuthenticationStrategy(new SessionFixationProtectionStrategy());
68-
this.securityContextRepository = new HttpSessionSecurityContextRepository();
62+
this.setSessionAuthenticationStrategy(new SessionFixationProtectionStrategy());
63+
this.setSecurityContextRepository(new HttpSessionSecurityContextRepository());
6964
}
7065

7166
@Override
@@ -92,10 +87,4 @@ private WebEidAuthToken parseWebEidAuthToken(HttpServletRequest request) {
9287
throw new BadCredentialsException("Unable to authenticate the Web eID authentication token", e);
9388
}
9489
}
95-
96-
@Override
97-
protected void successfulAuthentication(HttpServletRequest request, HttpServletResponse response, FilterChain chain, Authentication authResult) throws IOException, ServletException {
98-
super.successfulAuthentication(request, response, chain, authResult);
99-
securityContextRepository.saveContext(SecurityContextHolder.getContext(), request, response);
100-
}
10190
}

0 commit comments

Comments
 (0)