Apply code cleanup rules to projects
Apply automated cleanup rules to add `@Override` and `@Deprecated` annotations and to fix class references used with static methods. Issue gh-8945
This commit is contained in:
@@ -46,6 +46,7 @@ public class DefaultRedirectStrategy implements RedirectStrategy {
|
||||
* information (HTTP or HTTPS), so will cause problems if a redirect is being
|
||||
* performed to change to HTTPS, for example.
|
||||
*/
|
||||
@Override
|
||||
public void sendRedirect(HttpServletRequest request, HttpServletResponse response, String url) throws IOException {
|
||||
String redirectUrl = calculateRedirectUrl(request.getContextPath(), url);
|
||||
redirectUrl = response.encodeRedirectURL(redirectUrl);
|
||||
|
||||
@@ -55,10 +55,12 @@ public final class DefaultSecurityFilterChain implements SecurityFilterChain {
|
||||
return this.requestMatcher;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<Filter> getFilters() {
|
||||
return this.filters;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean matches(HttpServletRequest request) {
|
||||
return this.requestMatcher.matches(request);
|
||||
}
|
||||
|
||||
@@ -168,10 +168,12 @@ class DummyRequest extends HttpServletRequestWrapper {
|
||||
super(UNSUPPORTED_REQUEST);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getCharacterEncoding() {
|
||||
return "UTF-8";
|
||||
}
|
||||
|
||||
@Override
|
||||
public Object getAttribute(String attributeName) {
|
||||
return null;
|
||||
}
|
||||
@@ -296,6 +298,7 @@ final class UnsupportedOperationExceptionInvocationHandler implements Invocation
|
||||
|
||||
private static final float JAVA_VERSION = Float.parseFloat(System.getProperty("java.class.version", "52"));
|
||||
|
||||
@Override
|
||||
public Object invoke(Object proxy, Method method, Object[] args) throws Throwable {
|
||||
if (method.isDefault()) {
|
||||
return invokeDefaultMethod(proxy, method, args);
|
||||
|
||||
@@ -49,6 +49,7 @@ public class PortMapperImpl implements PortMapper {
|
||||
return this.httpsPortMappings;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Integer lookupHttpPort(Integer httpsPort) {
|
||||
for (Integer httpPort : this.httpsPortMappings.keySet()) {
|
||||
if (this.httpsPortMappings.get(httpPort).equals(httpsPort)) {
|
||||
@@ -59,6 +60,7 @@ public class PortMapperImpl implements PortMapper {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Integer lookupHttpsPort(Integer httpPort) {
|
||||
return this.httpsPortMappings.get(httpPort);
|
||||
}
|
||||
|
||||
@@ -42,6 +42,7 @@ public class PortResolverImpl implements PortResolver {
|
||||
return this.portMapper;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getServerPort(ServletRequest request) {
|
||||
int serverPort = request.getServerPort();
|
||||
Integer portLookup = null;
|
||||
|
||||
@@ -49,6 +49,7 @@ public class AccessDeniedHandlerImpl implements AccessDeniedHandler {
|
||||
|
||||
private String errorPage;
|
||||
|
||||
@Override
|
||||
public void handle(HttpServletRequest request, HttpServletResponse response,
|
||||
AccessDeniedException accessDeniedException) throws IOException, ServletException {
|
||||
if (!response.isCommitted()) {
|
||||
|
||||
+2
@@ -57,6 +57,7 @@ public class DefaultWebInvocationPrivilegeEvaluator implements WebInvocationPriv
|
||||
* @param uri the URI excluding the context path (a default context path setting will
|
||||
* be used)
|
||||
*/
|
||||
@Override
|
||||
public boolean isAllowed(String uri, Authentication authentication) {
|
||||
return isAllowed(null, uri, null, authentication);
|
||||
}
|
||||
@@ -78,6 +79,7 @@ public class DefaultWebInvocationPrivilegeEvaluator implements WebInvocationPriv
|
||||
* be used in evaluation whether access should be granted.
|
||||
* @return true if access is allowed, false if denied
|
||||
*/
|
||||
@Override
|
||||
public boolean isAllowed(String contextPath, String uri, String method, Authentication authentication) {
|
||||
Assert.notNull(uri, "uri parameter is required");
|
||||
|
||||
|
||||
+1
@@ -58,6 +58,7 @@ public final class DelegatingAccessDeniedHandler implements AccessDeniedHandler
|
||||
this.defaultHandler = defaultHandler;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void handle(HttpServletRequest request, HttpServletResponse response,
|
||||
AccessDeniedException accessDeniedException) throws IOException, ServletException {
|
||||
for (Entry<Class<? extends AccessDeniedException>, AccessDeniedHandler> entry : this.handlers.entrySet()) {
|
||||
|
||||
+2
@@ -105,6 +105,7 @@ public class ExceptionTranslationFilter extends GenericFilterBean {
|
||||
Assert.notNull(this.authenticationEntryPoint, "authenticationEntryPoint must be specified");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void doFilter(ServletRequest req, ServletResponse res, FilterChain chain)
|
||||
throws IOException, ServletException {
|
||||
HttpServletRequest request = (HttpServletRequest) req;
|
||||
@@ -227,6 +228,7 @@ public class ExceptionTranslationFilter extends GenericFilterBean {
|
||||
/**
|
||||
* @see org.springframework.security.web.util.ThrowableAnalyzer#initExtractorMap()
|
||||
*/
|
||||
@Override
|
||||
protected void initExtractorMap() {
|
||||
super.initExtractorMap();
|
||||
|
||||
|
||||
+1
@@ -58,6 +58,7 @@ public final class RequestMatcherDelegatingAccessDeniedHandler implements Access
|
||||
this.defaultHandler = defaultHandler;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void handle(HttpServletRequest request, HttpServletResponse response,
|
||||
AccessDeniedException accessDeniedException) throws IOException, ServletException {
|
||||
for (Entry<RequestMatcher, AccessDeniedHandler> entry : this.handlers.entrySet()) {
|
||||
|
||||
+1
@@ -55,6 +55,7 @@ public abstract class AbstractRetryEntryPoint implements ChannelEntryPoint {
|
||||
this.standardPort = standardPort;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void commence(HttpServletRequest request, HttpServletResponse response) throws IOException {
|
||||
String queryString = request.getQueryString();
|
||||
String redirectUrl = request.getRequestURI() + ((queryString == null) ? "" : ("?" + queryString));
|
||||
|
||||
+3
@@ -51,10 +51,12 @@ public class ChannelDecisionManagerImpl implements ChannelDecisionManager, Initi
|
||||
|
||||
private List<ChannelProcessor> channelProcessors;
|
||||
|
||||
@Override
|
||||
public void afterPropertiesSet() {
|
||||
Assert.notEmpty(this.channelProcessors, "A list of ChannelProcessors is required");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void decide(FilterInvocation invocation, Collection<ConfigAttribute> config)
|
||||
throws IOException, ServletException {
|
||||
for (ConfigAttribute attribute : config) {
|
||||
@@ -88,6 +90,7 @@ public class ChannelDecisionManagerImpl implements ChannelDecisionManager, Initi
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean supports(ConfigAttribute attribute) {
|
||||
if (ANY_CHANNEL.equals(attribute.getAttribute())) {
|
||||
return true;
|
||||
|
||||
+1
@@ -124,6 +124,7 @@ public class ChannelProcessingFilter extends GenericFilterBean {
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void doFilter(ServletRequest req, ServletResponse res, FilterChain chain)
|
||||
throws IOException, ServletException {
|
||||
HttpServletRequest request = (HttpServletRequest) req;
|
||||
|
||||
+3
@@ -46,11 +46,13 @@ public class InsecureChannelProcessor implements InitializingBean, ChannelProces
|
||||
|
||||
private String insecureKeyword = "REQUIRES_INSECURE_CHANNEL";
|
||||
|
||||
@Override
|
||||
public void afterPropertiesSet() {
|
||||
Assert.hasLength(this.insecureKeyword, "insecureKeyword required");
|
||||
Assert.notNull(this.entryPoint, "entryPoint required");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void decide(FilterInvocation invocation, Collection<ConfigAttribute> config)
|
||||
throws IOException, ServletException {
|
||||
if ((invocation == null) || (config == null)) {
|
||||
@@ -82,6 +84,7 @@ public class InsecureChannelProcessor implements InitializingBean, ChannelProces
|
||||
this.insecureKeyword = secureKeyword;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean supports(ConfigAttribute attribute) {
|
||||
return (attribute != null) && (attribute.getAttribute() != null)
|
||||
&& attribute.getAttribute().equals(getInsecureKeyword());
|
||||
|
||||
+1
@@ -31,6 +31,7 @@ public class RetryWithHttpEntryPoint extends AbstractRetryEntryPoint {
|
||||
super("http://", 80);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected Integer getMappedPort(Integer mapFromPort) {
|
||||
return getPortMapper().lookupHttpPort(mapFromPort);
|
||||
}
|
||||
|
||||
+1
@@ -32,6 +32,7 @@ public class RetryWithHttpsEntryPoint extends AbstractRetryEntryPoint {
|
||||
super("https://", 443);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected Integer getMappedPort(Integer mapFromPort) {
|
||||
return getPortMapper().lookupHttpsPort(mapFromPort);
|
||||
}
|
||||
|
||||
+3
@@ -46,11 +46,13 @@ public class SecureChannelProcessor implements InitializingBean, ChannelProcesso
|
||||
|
||||
private String secureKeyword = "REQUIRES_SECURE_CHANNEL";
|
||||
|
||||
@Override
|
||||
public void afterPropertiesSet() {
|
||||
Assert.hasLength(this.secureKeyword, "secureKeyword required");
|
||||
Assert.notNull(this.entryPoint, "entryPoint required");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void decide(FilterInvocation invocation, Collection<ConfigAttribute> config)
|
||||
throws IOException, ServletException {
|
||||
Assert.isTrue((invocation != null) && (config != null), "Nulls cannot be provided");
|
||||
@@ -80,6 +82,7 @@ public class SecureChannelProcessor implements InitializingBean, ChannelProcesso
|
||||
this.secureKeyword = secureKeyword;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean supports(ConfigAttribute attribute) {
|
||||
return (attribute != null) && (attribute.getAttribute() != null)
|
||||
&& attribute.getAttribute().equals(getSecureKeyword());
|
||||
|
||||
+3
@@ -35,6 +35,7 @@ public class WebExpressionVoter implements AccessDecisionVoter<FilterInvocation>
|
||||
|
||||
private SecurityExpressionHandler<FilterInvocation> expressionHandler = new DefaultWebSecurityExpressionHandler();
|
||||
|
||||
@Override
|
||||
public int vote(Authentication authentication, FilterInvocation fi, Collection<ConfigAttribute> attributes) {
|
||||
assert authentication != null;
|
||||
assert fi != null;
|
||||
@@ -61,10 +62,12 @@ public class WebExpressionVoter implements AccessDecisionVoter<FilterInvocation>
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean supports(ConfigAttribute attribute) {
|
||||
return attribute instanceof WebExpressionConfigAttribute;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean supports(Class<?> clazz) {
|
||||
return FilterInvocation.class.isAssignableFrom(clazz);
|
||||
}
|
||||
|
||||
+3
@@ -69,6 +69,7 @@ public class DefaultFilterInvocationSecurityMetadataSource implements FilterInvo
|
||||
this.requestMap = requestMap;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Collection<ConfigAttribute> getAllConfigAttributes() {
|
||||
Set<ConfigAttribute> allAttributes = new HashSet<>();
|
||||
|
||||
@@ -79,6 +80,7 @@ public class DefaultFilterInvocationSecurityMetadataSource implements FilterInvo
|
||||
return allAttributes;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Collection<ConfigAttribute> getAttributes(Object object) {
|
||||
final HttpServletRequest request = ((FilterInvocation) object).getRequest();
|
||||
for (Map.Entry<RequestMatcher, Collection<ConfigAttribute>> entry : this.requestMap.entrySet()) {
|
||||
@@ -89,6 +91,7 @@ public class DefaultFilterInvocationSecurityMetadataSource implements FilterInvo
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean supports(Class<?> clazz) {
|
||||
return FilterInvocation.class.isAssignableFrom(clazz);
|
||||
}
|
||||
|
||||
+5
@@ -55,12 +55,14 @@ public class FilterSecurityInterceptor extends AbstractSecurityInterceptor imple
|
||||
* @param arg0 ignored
|
||||
*
|
||||
*/
|
||||
@Override
|
||||
public void init(FilterConfig arg0) {
|
||||
}
|
||||
|
||||
/**
|
||||
* Not used (we rely on IoC container lifecycle services instead)
|
||||
*/
|
||||
@Override
|
||||
public void destroy() {
|
||||
}
|
||||
|
||||
@@ -73,6 +75,7 @@ public class FilterSecurityInterceptor extends AbstractSecurityInterceptor imple
|
||||
* @throws IOException if the filter chain fails
|
||||
* @throws ServletException if the filter chain fails
|
||||
*/
|
||||
@Override
|
||||
public void doFilter(ServletRequest request, ServletResponse response, FilterChain chain)
|
||||
throws IOException, ServletException {
|
||||
FilterInvocation fi = new FilterInvocation(request, response, chain);
|
||||
@@ -83,6 +86,7 @@ public class FilterSecurityInterceptor extends AbstractSecurityInterceptor imple
|
||||
return this.securityMetadataSource;
|
||||
}
|
||||
|
||||
@Override
|
||||
public SecurityMetadataSource obtainSecurityMetadataSource() {
|
||||
return this.securityMetadataSource;
|
||||
}
|
||||
@@ -91,6 +95,7 @@ public class FilterSecurityInterceptor extends AbstractSecurityInterceptor imple
|
||||
this.securityMetadataSource = newSource;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Class<?> getSecureObjectClass() {
|
||||
return FilterInvocation.class;
|
||||
}
|
||||
|
||||
+3
@@ -205,6 +205,7 @@ public abstract class AbstractAuthenticationProcessingFilter extends GenericFilt
|
||||
* returned <tt>Authentication</tt> object is not null.
|
||||
* </ol>
|
||||
*/
|
||||
@Override
|
||||
public void doFilter(ServletRequest req, ServletResponse res, FilterChain chain)
|
||||
throws IOException, ServletException {
|
||||
|
||||
@@ -398,6 +399,7 @@ public abstract class AbstractAuthenticationProcessingFilter extends GenericFilt
|
||||
this.continueChainBeforeSuccessfulAuthentication = continueChainBeforeSuccessfulAuthentication;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setApplicationEventPublisher(ApplicationEventPublisher eventPublisher) {
|
||||
this.eventPublisher = eventPublisher;
|
||||
}
|
||||
@@ -408,6 +410,7 @@ public abstract class AbstractAuthenticationProcessingFilter extends GenericFilt
|
||||
this.authenticationDetailsSource = authenticationDetailsSource;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setMessageSource(MessageSource messageSource) {
|
||||
this.messages = new MessageSourceAccessor(messageSource);
|
||||
}
|
||||
|
||||
+1
@@ -82,6 +82,7 @@ public class AnonymousAuthenticationFilter extends GenericFilterBean implements
|
||||
Assert.notNull(this.authorities, "Anonymous authorities must be set");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void doFilter(ServletRequest req, ServletResponse res, FilterChain chain)
|
||||
throws IOException, ServletException {
|
||||
|
||||
|
||||
+2
@@ -71,6 +71,7 @@ public class DelegatingAuthenticationEntryPoint implements AuthenticationEntryPo
|
||||
this.entryPoints = entryPoints;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void commence(HttpServletRequest request, HttpServletResponse response,
|
||||
AuthenticationException authException) throws IOException, ServletException {
|
||||
|
||||
@@ -103,6 +104,7 @@ public class DelegatingAuthenticationEntryPoint implements AuthenticationEntryPo
|
||||
this.defaultEntryPoint = defaultEntryPoint;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void afterPropertiesSet() {
|
||||
Assert.notEmpty(this.entryPoints, "entryPoints must be specified");
|
||||
Assert.notNull(this.defaultEntryPoint, "defaultEntryPoint must be specified");
|
||||
|
||||
+1
@@ -46,6 +46,7 @@ public class ForwardAuthenticationFailureHandler implements AuthenticationFailur
|
||||
this.forwardUrl = forwardUrl;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onAuthenticationFailure(HttpServletRequest request, HttpServletResponse response,
|
||||
AuthenticationException exception) throws IOException, ServletException {
|
||||
request.setAttribute(WebAttributes.AUTHENTICATION_EXCEPTION, exception);
|
||||
|
||||
+1
@@ -46,6 +46,7 @@ public class ForwardAuthenticationSuccessHandler implements AuthenticationSucces
|
||||
this.forwardUrl = forwardUrl;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onAuthenticationSuccess(HttpServletRequest request, HttpServletResponse response,
|
||||
Authentication authentication) throws IOException, ServletException {
|
||||
request.getRequestDispatcher(this.forwardUrl).forward(request, response);
|
||||
|
||||
+1
@@ -51,6 +51,7 @@ public class Http403ForbiddenEntryPoint implements AuthenticationEntryPoint {
|
||||
/**
|
||||
* Always returns a 403 error code to the client.
|
||||
*/
|
||||
@Override
|
||||
public void commence(HttpServletRequest request, HttpServletResponse response, AuthenticationException arg2)
|
||||
throws IOException {
|
||||
if (logger.isDebugEnabled()) {
|
||||
|
||||
+1
@@ -44,6 +44,7 @@ public final class HttpStatusEntryPoint implements AuthenticationEntryPoint {
|
||||
this.httpStatus = httpStatus;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void commence(HttpServletRequest request, HttpServletResponse response,
|
||||
AuthenticationException authException) {
|
||||
response.setStatus(this.httpStatus.value());
|
||||
|
||||
+2
@@ -89,6 +89,7 @@ public class LoginUrlAuthenticationEntryPoint implements AuthenticationEntryPoin
|
||||
this.loginFormUrl = loginFormUrl;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void afterPropertiesSet() {
|
||||
Assert.isTrue(StringUtils.hasText(this.loginFormUrl) && UrlUtils.isValidRedirectUrl(this.loginFormUrl),
|
||||
"loginFormUrl must be specified and must be a valid redirect URL");
|
||||
@@ -116,6 +117,7 @@ public class LoginUrlAuthenticationEntryPoint implements AuthenticationEntryPoin
|
||||
/**
|
||||
* Performs the redirect (or forward) to the login form URL.
|
||||
*/
|
||||
@Override
|
||||
public void commence(HttpServletRequest request, HttpServletResponse response,
|
||||
AuthenticationException authException) throws IOException, ServletException {
|
||||
|
||||
|
||||
+3
@@ -31,13 +31,16 @@ import org.springframework.security.core.Authentication;
|
||||
*/
|
||||
public class NullRememberMeServices implements RememberMeServices {
|
||||
|
||||
@Override
|
||||
public Authentication autoLogin(HttpServletRequest request, HttpServletResponse response) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void loginFail(HttpServletRequest request, HttpServletResponse response) {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void loginSuccess(HttpServletRequest request, HttpServletResponse response,
|
||||
Authentication successfulAuthentication) {
|
||||
}
|
||||
|
||||
+1
@@ -72,6 +72,7 @@ public class SimpleUrlAuthenticationFailureHandler implements AuthenticationFail
|
||||
* If redirecting or forwarding, {@code saveException} will be called to cache the
|
||||
* exception for use in the target view.
|
||||
*/
|
||||
@Override
|
||||
public void onAuthenticationFailure(HttpServletRequest request, HttpServletResponse response,
|
||||
AuthenticationException exception) throws IOException, ServletException {
|
||||
|
||||
|
||||
+1
@@ -55,6 +55,7 @@ public class SimpleUrlAuthenticationSuccessHandler extends AbstractAuthenticatio
|
||||
* URL, and then calls {@code clearAuthenticationAttributes()} to remove any leftover
|
||||
* session data.
|
||||
*/
|
||||
@Override
|
||||
public void onAuthenticationSuccess(HttpServletRequest request, HttpServletResponse response,
|
||||
Authentication authentication) throws IOException, ServletException {
|
||||
|
||||
|
||||
+1
@@ -68,6 +68,7 @@ public class UsernamePasswordAuthenticationFilter extends AbstractAuthentication
|
||||
super(DEFAULT_ANT_PATH_REQUEST_MATCHER, authenticationManager);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Authentication attemptAuthentication(HttpServletRequest request, HttpServletResponse response)
|
||||
throws AuthenticationException {
|
||||
if (this.postOnly && !request.getMethod().equals("POST")) {
|
||||
|
||||
+1
@@ -35,6 +35,7 @@ public class WebAuthenticationDetailsSource
|
||||
* @return the {@code WebAuthenticationDetails} containing information about the
|
||||
* current request
|
||||
*/
|
||||
@Override
|
||||
public WebAuthenticationDetails buildDetails(HttpServletRequest context) {
|
||||
return new WebAuthenticationDetails(context);
|
||||
}
|
||||
|
||||
+1
@@ -70,6 +70,7 @@ public final class CookieClearingLogoutHandler implements LogoutHandler {
|
||||
this.cookiesToClear = cookieList;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void logout(HttpServletRequest request, HttpServletResponse response, Authentication authentication) {
|
||||
this.cookiesToClear.forEach(f -> response.addCookie(f.apply(request)));
|
||||
}
|
||||
|
||||
+1
@@ -60,6 +60,7 @@ public class HttpStatusReturningLogoutSuccessHandler implements LogoutSuccessHan
|
||||
* {@link LogoutSuccessHandler#onLogoutSuccess(HttpServletRequest, HttpServletResponse, Authentication)}
|
||||
* . Sets the status on the {@link HttpServletResponse}.
|
||||
*/
|
||||
@Override
|
||||
public void onLogoutSuccess(HttpServletRequest request, HttpServletResponse response, Authentication authentication)
|
||||
throws IOException {
|
||||
response.setStatus(this.httpStatusToReturn.value());
|
||||
|
||||
+1
@@ -82,6 +82,7 @@ public class LogoutFilter extends GenericFilterBean {
|
||||
setFilterProcessesUrl("/logout");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void doFilter(ServletRequest req, ServletResponse res, FilterChain chain)
|
||||
throws IOException, ServletException {
|
||||
HttpServletRequest request = (HttpServletRequest) req;
|
||||
|
||||
+1
@@ -55,6 +55,7 @@ public class SecurityContextLogoutHandler implements LogoutHandler {
|
||||
* @param response not used (can be <code>null</code>)
|
||||
* @param authentication not used (can be <code>null</code>)
|
||||
*/
|
||||
@Override
|
||||
public void logout(HttpServletRequest request, HttpServletResponse response, Authentication authentication) {
|
||||
Assert.notNull(request, "HttpServletRequest required");
|
||||
if (this.invalidateHttpSession) {
|
||||
|
||||
+1
@@ -34,6 +34,7 @@ import org.springframework.security.web.authentication.AbstractAuthenticationTar
|
||||
public class SimpleUrlLogoutSuccessHandler extends AbstractAuthenticationTargetUrlRequestHandler
|
||||
implements LogoutSuccessHandler {
|
||||
|
||||
@Override
|
||||
public void onLogoutSuccess(HttpServletRequest request, HttpServletResponse response, Authentication authentication)
|
||||
throws IOException, ServletException {
|
||||
super.handle(request, response, authentication);
|
||||
|
||||
+2
@@ -120,6 +120,7 @@ public abstract class AbstractPreAuthenticatedProcessingFilter extends GenericFi
|
||||
* Try to authenticate a pre-authenticated user with Spring Security if the user has
|
||||
* not yet been authenticated.
|
||||
*/
|
||||
@Override
|
||||
public void doFilter(ServletRequest request, ServletResponse response, FilterChain chain)
|
||||
throws IOException, ServletException {
|
||||
|
||||
@@ -253,6 +254,7 @@ public abstract class AbstractPreAuthenticatedProcessingFilter extends GenericFi
|
||||
/**
|
||||
* @param anApplicationEventPublisher The ApplicationEventPublisher to use
|
||||
*/
|
||||
@Override
|
||||
public void setApplicationEventPublisher(ApplicationEventPublisher anApplicationEventPublisher) {
|
||||
this.eventPublisher = anApplicationEventPublisher;
|
||||
}
|
||||
|
||||
+4
@@ -60,6 +60,7 @@ public class PreAuthenticatedAuthenticationProvider implements AuthenticationPro
|
||||
/**
|
||||
* Check whether all required properties have been set.
|
||||
*/
|
||||
@Override
|
||||
public void afterPropertiesSet() {
|
||||
Assert.notNull(this.preAuthenticatedUserDetailsService, "An AuthenticationUserDetailsService must be set");
|
||||
}
|
||||
@@ -70,6 +71,7 @@ public class PreAuthenticatedAuthenticationProvider implements AuthenticationPro
|
||||
* If the principal contained in the authentication object is null, the request will
|
||||
* be ignored to allow other providers to authenticate it.
|
||||
*/
|
||||
@Override
|
||||
public Authentication authenticate(Authentication authentication) throws AuthenticationException {
|
||||
if (!supports(authentication.getClass())) {
|
||||
return null;
|
||||
@@ -113,6 +115,7 @@ public class PreAuthenticatedAuthenticationProvider implements AuthenticationPro
|
||||
* Indicate that this provider only supports PreAuthenticatedAuthenticationToken
|
||||
* (sub)classes.
|
||||
*/
|
||||
@Override
|
||||
public final boolean supports(Class<?> authentication) {
|
||||
return PreAuthenticatedAuthenticationToken.class.isAssignableFrom(authentication);
|
||||
}
|
||||
@@ -146,6 +149,7 @@ public class PreAuthenticatedAuthenticationProvider implements AuthenticationPro
|
||||
this.userDetailsChecker = userDetailsChecker;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getOrder() {
|
||||
return this.order;
|
||||
}
|
||||
|
||||
+2
@@ -67,6 +67,7 @@ public class PreAuthenticatedAuthenticationToken extends AbstractAuthenticationT
|
||||
/**
|
||||
* Get the credentials
|
||||
*/
|
||||
@Override
|
||||
public Object getCredentials() {
|
||||
return this.credentials;
|
||||
}
|
||||
@@ -74,6 +75,7 @@ public class PreAuthenticatedAuthenticationToken extends AbstractAuthenticationT
|
||||
/**
|
||||
* Get the principal
|
||||
*/
|
||||
@Override
|
||||
public Object getPrincipal() {
|
||||
return this.principal;
|
||||
}
|
||||
|
||||
+1
@@ -52,6 +52,7 @@ public class PreAuthenticatedGrantedAuthoritiesUserDetailsService
|
||||
* the GrantedAuthorities as returned by the GrantedAuthoritiesContainer
|
||||
* implementation as returned by the token.getDetails() method.
|
||||
*/
|
||||
@Override
|
||||
public final UserDetails loadUserDetails(PreAuthenticatedAuthenticationToken token) throws AuthenticationException {
|
||||
Assert.notNull(token.getDetails(), "token.getDetails() cannot be null");
|
||||
Assert.isInstanceOf(GrantedAuthoritiesContainer.class, token.getDetails());
|
||||
|
||||
+2
@@ -55,6 +55,7 @@ public class RequestAttributeAuthenticationFilter extends AbstractPreAuthenticat
|
||||
* @throws PreAuthenticatedCredentialsNotFoundException if the environment variable is
|
||||
* missing and {@code exceptionIfVariableMissing} is set to {@code true}.
|
||||
*/
|
||||
@Override
|
||||
protected Object getPreAuthenticatedPrincipal(HttpServletRequest request) {
|
||||
String principal = (String) request.getAttribute(this.principalEnvironmentVariable);
|
||||
|
||||
@@ -71,6 +72,7 @@ public class RequestAttributeAuthenticationFilter extends AbstractPreAuthenticat
|
||||
* {@code credentialsEnvironmentVariable} is set, this will be read and used as the
|
||||
* credentials value. Otherwise a dummy value will be used.
|
||||
*/
|
||||
@Override
|
||||
protected Object getPreAuthenticatedCredentials(HttpServletRequest request) {
|
||||
if (this.credentialsEnvironmentVariable != null) {
|
||||
return request.getAttribute(this.credentialsEnvironmentVariable);
|
||||
|
||||
+2
@@ -56,6 +56,7 @@ public class RequestHeaderAuthenticationFilter extends AbstractPreAuthenticatedP
|
||||
* @throws PreAuthenticatedCredentialsNotFoundException if the header is missing and
|
||||
* {@code exceptionIfHeaderMissing} is set to {@code true}.
|
||||
*/
|
||||
@Override
|
||||
protected Object getPreAuthenticatedPrincipal(HttpServletRequest request) {
|
||||
String principal = request.getHeader(this.principalRequestHeader);
|
||||
|
||||
@@ -72,6 +73,7 @@ public class RequestHeaderAuthenticationFilter extends AbstractPreAuthenticatedP
|
||||
* set, this will be read and used as the credentials value. Otherwise a dummy value
|
||||
* will be used.
|
||||
*/
|
||||
@Override
|
||||
protected Object getPreAuthenticatedCredentials(HttpServletRequest request) {
|
||||
if (this.credentialsRequestHeader != null) {
|
||||
return request.getHeader(this.credentialsRequestHeader);
|
||||
|
||||
+2
@@ -58,6 +58,7 @@ public class J2eeBasedPreAuthenticatedWebAuthenticationDetailsSource implements
|
||||
/**
|
||||
* Check that all required properties have been set.
|
||||
*/
|
||||
@Override
|
||||
public void afterPropertiesSet() {
|
||||
Assert.notNull(this.j2eeMappableRoles, "No mappable roles available");
|
||||
Assert.notNull(this.j2eeUserRoles2GrantedAuthoritiesMapper, "Roles to granted authorities mapper not set");
|
||||
@@ -89,6 +90,7 @@ public class J2eeBasedPreAuthenticatedWebAuthenticationDetailsSource implements
|
||||
*
|
||||
* @see org.springframework.security.authentication.AuthenticationDetailsSource#buildDetails(Object)
|
||||
*/
|
||||
@Override
|
||||
public PreAuthenticatedGrantedAuthoritiesWebAuthenticationDetails buildDetails(HttpServletRequest context) {
|
||||
|
||||
Collection<String> j2eeUserRoles = getUserRoles(context);
|
||||
|
||||
+2
@@ -32,6 +32,7 @@ public class J2eePreAuthenticatedProcessingFilter extends AbstractPreAuthenticat
|
||||
/**
|
||||
* Return the J2EE user name.
|
||||
*/
|
||||
@Override
|
||||
protected Object getPreAuthenticatedPrincipal(HttpServletRequest httpRequest) {
|
||||
Object principal = httpRequest.getUserPrincipal() == null ? null : httpRequest.getUserPrincipal().getName();
|
||||
if (this.logger.isDebugEnabled()) {
|
||||
@@ -44,6 +45,7 @@ public class J2eePreAuthenticatedProcessingFilter extends AbstractPreAuthenticat
|
||||
* For J2EE container-based authentication there is no generic way to retrieve the
|
||||
* credentials, as such this method returns a fixed dummy value.
|
||||
*/
|
||||
@Override
|
||||
protected Object getPreAuthenticatedCredentials(HttpServletRequest httpRequest) {
|
||||
return "N/A";
|
||||
}
|
||||
|
||||
+4
@@ -61,10 +61,12 @@ public class WebXmlMappableAttributesRetriever
|
||||
|
||||
private Set<String> mappableAttributes;
|
||||
|
||||
@Override
|
||||
public void setResourceLoader(ResourceLoader resourceLoader) {
|
||||
this.resourceLoader = resourceLoader;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Set<String> getMappableAttributes() {
|
||||
return this.mappableAttributes;
|
||||
}
|
||||
@@ -74,6 +76,7 @@ public class WebXmlMappableAttributesRetriever
|
||||
* role-name elements from it, using these as the set of <tt>mappableAttributes</tt>.
|
||||
*/
|
||||
|
||||
@Override
|
||||
public void afterPropertiesSet() throws Exception {
|
||||
Resource webXml = this.resourceLoader.getResource("/WEB-INF/web.xml");
|
||||
Document doc = getDocument(webXml.getInputStream());
|
||||
@@ -133,6 +136,7 @@ public class WebXmlMappableAttributesRetriever
|
||||
*/
|
||||
private static final class MyEntityResolver implements EntityResolver {
|
||||
|
||||
@Override
|
||||
public InputSource resolveEntity(String publicId, String systemId) {
|
||||
return new InputSource(new StringReader(""));
|
||||
}
|
||||
|
||||
+2
@@ -58,10 +58,12 @@ final class DefaultWASUsernameAndGroupsExtractor implements WASUsernameAndGroups
|
||||
// SEC-803
|
||||
private static Class<?> wsCredentialClass = null;
|
||||
|
||||
@Override
|
||||
public List<String> getGroupsForCurrentUser() {
|
||||
return getWebSphereGroups(getRunAsSubject());
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getCurrentUserName() {
|
||||
return getSecurityName(getRunAsSubject());
|
||||
}
|
||||
|
||||
+2
@@ -47,6 +47,7 @@ public class WebSpherePreAuthenticatedProcessingFilter extends AbstractPreAuthen
|
||||
/**
|
||||
* Return the WebSphere user name.
|
||||
*/
|
||||
@Override
|
||||
protected Object getPreAuthenticatedPrincipal(HttpServletRequest httpRequest) {
|
||||
Object principal = this.wasHelper.getCurrentUserName();
|
||||
if (this.logger.isDebugEnabled()) {
|
||||
@@ -59,6 +60,7 @@ public class WebSpherePreAuthenticatedProcessingFilter extends AbstractPreAuthen
|
||||
* For J2EE container-based authentication there is no generic way to retrieve the
|
||||
* credentials, as such this method returns a fixed dummy value.
|
||||
*/
|
||||
@Override
|
||||
protected Object getPreAuthenticatedCredentials(HttpServletRequest httpRequest) {
|
||||
return "N/A";
|
||||
}
|
||||
|
||||
+1
@@ -53,6 +53,7 @@ public class WebSpherePreAuthenticatedWebAuthenticationDetailsSource implements
|
||||
this.wasHelper = wasHelper;
|
||||
}
|
||||
|
||||
@Override
|
||||
public PreAuthenticatedGrantedAuthoritiesWebAuthenticationDetails buildDetails(HttpServletRequest context) {
|
||||
return new PreAuthenticatedGrantedAuthoritiesWebAuthenticationDetails(context,
|
||||
getWebSphereGroupsBasedGrantedAuthorities());
|
||||
|
||||
+1
@@ -53,6 +53,7 @@ public class SubjectDnX509PrincipalExtractor implements X509PrincipalExtractor {
|
||||
setSubjectDnRegex("CN=(.*?)(?:,|$)");
|
||||
}
|
||||
|
||||
@Override
|
||||
public Object extractPrincipal(X509Certificate clientCert) {
|
||||
// String subjectDN = clientCert.getSubjectX500Principal().getName();
|
||||
String subjectDN = clientCert.getSubjectDN().getName();
|
||||
|
||||
+2
@@ -28,6 +28,7 @@ public class X509AuthenticationFilter extends AbstractPreAuthenticatedProcessing
|
||||
|
||||
private X509PrincipalExtractor principalExtractor = new SubjectDnX509PrincipalExtractor();
|
||||
|
||||
@Override
|
||||
protected Object getPreAuthenticatedPrincipal(HttpServletRequest request) {
|
||||
X509Certificate cert = extractClientCertificate(request);
|
||||
|
||||
@@ -38,6 +39,7 @@ public class X509AuthenticationFilter extends AbstractPreAuthenticatedProcessing
|
||||
return this.principalExtractor.extractPrincipal(cert);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected Object getPreAuthenticatedCredentials(HttpServletRequest request) {
|
||||
return extractClientCertificate(request);
|
||||
}
|
||||
|
||||
+4
@@ -32,6 +32,7 @@ public class InMemoryTokenRepositoryImpl implements PersistentTokenRepository {
|
||||
|
||||
private final Map<String, PersistentRememberMeToken> seriesTokens = new HashMap<>();
|
||||
|
||||
@Override
|
||||
public synchronized void createNewToken(PersistentRememberMeToken token) {
|
||||
PersistentRememberMeToken current = this.seriesTokens.get(token.getSeries());
|
||||
|
||||
@@ -42,6 +43,7 @@ public class InMemoryTokenRepositoryImpl implements PersistentTokenRepository {
|
||||
this.seriesTokens.put(token.getSeries(), token);
|
||||
}
|
||||
|
||||
@Override
|
||||
public synchronized void updateToken(String series, String tokenValue, Date lastUsed) {
|
||||
PersistentRememberMeToken token = getTokenForSeries(series);
|
||||
|
||||
@@ -52,10 +54,12 @@ public class InMemoryTokenRepositoryImpl implements PersistentTokenRepository {
|
||||
this.seriesTokens.put(series, newToken);
|
||||
}
|
||||
|
||||
@Override
|
||||
public synchronized PersistentRememberMeToken getTokenForSeries(String seriesId) {
|
||||
return this.seriesTokens.get(seriesId);
|
||||
}
|
||||
|
||||
@Override
|
||||
public synchronized void removeUserTokens(String username) {
|
||||
Iterator<String> series = this.seriesTokens.keySet().iterator();
|
||||
|
||||
|
||||
+5
@@ -56,17 +56,20 @@ public class JdbcTokenRepositoryImpl extends JdbcDaoSupport implements Persisten
|
||||
|
||||
private boolean createTableOnStartup;
|
||||
|
||||
@Override
|
||||
protected void initDao() {
|
||||
if (this.createTableOnStartup) {
|
||||
getJdbcTemplate().execute(CREATE_TABLE_SQL);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void createNewToken(PersistentRememberMeToken token) {
|
||||
getJdbcTemplate().update(this.insertTokenSql, token.getUsername(), token.getSeries(), token.getTokenValue(),
|
||||
token.getDate());
|
||||
}
|
||||
|
||||
@Override
|
||||
public void updateToken(String series, String tokenValue, Date lastUsed) {
|
||||
getJdbcTemplate().update(this.updateTokenSql, tokenValue, lastUsed, series);
|
||||
}
|
||||
@@ -80,6 +83,7 @@ public class JdbcTokenRepositoryImpl extends JdbcDaoSupport implements Persisten
|
||||
* @return the token matching the series, or null if no match found or an exception
|
||||
* occurred.
|
||||
*/
|
||||
@Override
|
||||
public PersistentRememberMeToken getTokenForSeries(String seriesId) {
|
||||
try {
|
||||
return getJdbcTemplate().queryForObject(this.tokensBySeriesSql,
|
||||
@@ -103,6 +107,7 @@ public class JdbcTokenRepositoryImpl extends JdbcDaoSupport implements Persisten
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void removeUserTokens(String username) {
|
||||
getJdbcTemplate().update(this.removeUserTokensSql, username);
|
||||
}
|
||||
|
||||
+2
@@ -89,6 +89,7 @@ public class PersistentTokenBasedRememberMeServices extends AbstractRememberMeSe
|
||||
* @throws CookieTheftException if a presented series value is found, but the stored
|
||||
* token is different from the one presented.
|
||||
*/
|
||||
@Override
|
||||
protected UserDetails processAutoLoginCookie(String[] cookieTokens, HttpServletRequest request,
|
||||
HttpServletResponse response) {
|
||||
|
||||
@@ -149,6 +150,7 @@ public class PersistentTokenBasedRememberMeServices extends AbstractRememberMeSe
|
||||
* the persistent token repository and adds the corresponding cookie to the response.
|
||||
*
|
||||
*/
|
||||
@Override
|
||||
protected void onLoginSuccess(HttpServletRequest request, HttpServletResponse response,
|
||||
Authentication successfulAuthentication) {
|
||||
String username = successfulAuthentication.getName();
|
||||
|
||||
+2
@@ -85,6 +85,7 @@ public class RememberMeAuthenticationFilter extends GenericFilterBean implements
|
||||
Assert.notNull(this.rememberMeServices, "rememberMeServices must be specified");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void doFilter(ServletRequest req, ServletResponse res, FilterChain chain)
|
||||
throws IOException, ServletException {
|
||||
HttpServletRequest request = (HttpServletRequest) req;
|
||||
@@ -170,6 +171,7 @@ public class RememberMeAuthenticationFilter extends GenericFilterBean implements
|
||||
return this.rememberMeServices;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setApplicationEventPublisher(ApplicationEventPublisher eventPublisher) {
|
||||
this.eventPublisher = eventPublisher;
|
||||
}
|
||||
|
||||
+4
@@ -65,6 +65,7 @@ abstract class AbstractSessionFixationProtectionStrategy
|
||||
* property is set, in which case a session will be created if one doesn't already
|
||||
* exist.
|
||||
*/
|
||||
@Override
|
||||
public void onAuthentication(Authentication authentication, HttpServletRequest request,
|
||||
HttpServletResponse response) {
|
||||
boolean hadSessionAlready = request.getSession(false) != null;
|
||||
@@ -135,6 +136,7 @@ abstract class AbstractSessionFixationProtectionStrategy
|
||||
* @param applicationEventPublisher the {@link ApplicationEventPublisher}. Cannot be
|
||||
* null.
|
||||
*/
|
||||
@Override
|
||||
public void setApplicationEventPublisher(ApplicationEventPublisher applicationEventPublisher) {
|
||||
Assert.notNull(applicationEventPublisher, "applicationEventPublisher cannot be null");
|
||||
this.applicationEventPublisher = applicationEventPublisher;
|
||||
@@ -146,9 +148,11 @@ abstract class AbstractSessionFixationProtectionStrategy
|
||||
|
||||
protected static final class NullEventPublisher implements ApplicationEventPublisher {
|
||||
|
||||
@Override
|
||||
public void publishEvent(ApplicationEvent event) {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void publishEvent(Object event) {
|
||||
}
|
||||
|
||||
|
||||
+1
@@ -78,6 +78,7 @@ public class CompositeSessionAuthenticationStrategy implements SessionAuthentica
|
||||
* #onAuthentication(org.springframework.security.core.Authentication,
|
||||
* javax.servlet.http.HttpServletRequest, javax.servlet.http.HttpServletResponse)
|
||||
*/
|
||||
@Override
|
||||
public void onAuthentication(Authentication authentication, HttpServletRequest request,
|
||||
HttpServletResponse response) throws SessionAuthenticationException {
|
||||
for (SessionAuthenticationStrategy delegate : this.delegateStrategies) {
|
||||
|
||||
+2
@@ -90,6 +90,7 @@ public class ConcurrentSessionControlAuthenticationStrategy
|
||||
* In addition to the steps from the superclass, the sessionRegistry will be updated
|
||||
* with the new session information.
|
||||
*/
|
||||
@Override
|
||||
public void onAuthentication(Authentication authentication, HttpServletRequest request,
|
||||
HttpServletResponse response) {
|
||||
|
||||
@@ -194,6 +195,7 @@ public class ConcurrentSessionControlAuthenticationStrategy
|
||||
* Sets the {@link MessageSource} used for reporting errors back to the user when the
|
||||
* user has exceeded the maximum number of authentications.
|
||||
*/
|
||||
@Override
|
||||
public void setMessageSource(MessageSource messageSource) {
|
||||
Assert.notNull(messageSource, "messageSource cannot be null");
|
||||
this.messages = new MessageSourceAccessor(messageSource);
|
||||
|
||||
+1
@@ -26,6 +26,7 @@ import org.springframework.security.core.Authentication;
|
||||
*/
|
||||
public final class NullAuthenticatedSessionStrategy implements SessionAuthenticationStrategy {
|
||||
|
||||
@Override
|
||||
public void onAuthentication(Authentication authentication, HttpServletRequest request,
|
||||
HttpServletResponse response) {
|
||||
}
|
||||
|
||||
+1
@@ -60,6 +60,7 @@ public class RegisterSessionAuthenticationStrategy implements SessionAuthenticat
|
||||
* In addition to the steps from the superclass, the sessionRegistry will be updated
|
||||
* with the new session information.
|
||||
*/
|
||||
@Override
|
||||
public void onAuthentication(Authentication authentication, HttpServletRequest request,
|
||||
HttpServletResponse response) {
|
||||
this.sessionRegistry.registerNewSession(request.getSession().getId(), authentication.getPrincipal());
|
||||
|
||||
+3
@@ -159,6 +159,7 @@ public class SwitchUserFilter extends GenericFilterBean implements ApplicationEv
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void doFilter(ServletRequest req, ServletResponse res, FilterChain chain)
|
||||
throws IOException, ServletException {
|
||||
HttpServletRequest request = (HttpServletRequest) req;
|
||||
@@ -386,6 +387,7 @@ public class SwitchUserFilter extends GenericFilterBean implements ApplicationEv
|
||||
return this.switchUserMatcher.matches(request);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setApplicationEventPublisher(ApplicationEventPublisher eventPublisher) throws BeansException {
|
||||
this.eventPublisher = eventPublisher;
|
||||
}
|
||||
@@ -396,6 +398,7 @@ public class SwitchUserFilter extends GenericFilterBean implements ApplicationEv
|
||||
this.authenticationDetailsSource = authenticationDetailsSource;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setMessageSource(MessageSource messageSource) {
|
||||
Assert.notNull(messageSource, "messageSource cannot be null");
|
||||
this.messages = new MessageSourceAccessor(messageSource);
|
||||
|
||||
+1
@@ -212,6 +212,7 @@ public class DefaultLoginPageGeneratingFilter extends GenericFilterBean {
|
||||
this.saml2AuthenticationUrlToProviderName = saml2AuthenticationUrlToProviderName;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void doFilter(ServletRequest req, ServletResponse res, FilterChain chain)
|
||||
throws IOException, ServletException {
|
||||
HttpServletRequest request = (HttpServletRequest) req;
|
||||
|
||||
+2
@@ -44,10 +44,12 @@ public class BasicAuthenticationEntryPoint implements AuthenticationEntryPoint,
|
||||
|
||||
private String realmName;
|
||||
|
||||
@Override
|
||||
public void afterPropertiesSet() {
|
||||
Assert.hasText(this.realmName, "realmName must be specified");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void commence(HttpServletRequest request, HttpServletResponse response,
|
||||
AuthenticationException authException) throws IOException {
|
||||
response.addHeader("WWW-Authenticate", "Basic realm=\"" + this.realmName + "\"");
|
||||
|
||||
+3
@@ -57,6 +57,7 @@ public class DigestAuthenticationEntryPoint implements AuthenticationEntryPoint,
|
||||
|
||||
private int order = Integer.MAX_VALUE; // ~ default
|
||||
|
||||
@Override
|
||||
public int getOrder() {
|
||||
return this.order;
|
||||
}
|
||||
@@ -65,6 +66,7 @@ public class DigestAuthenticationEntryPoint implements AuthenticationEntryPoint,
|
||||
this.order = order;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void afterPropertiesSet() {
|
||||
if ((this.realmName == null) || "".equals(this.realmName)) {
|
||||
throw new IllegalArgumentException("realmName must be specified");
|
||||
@@ -75,6 +77,7 @@ public class DigestAuthenticationEntryPoint implements AuthenticationEntryPoint,
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void commence(HttpServletRequest request, HttpServletResponse response,
|
||||
AuthenticationException authException) throws IOException {
|
||||
HttpServletResponse httpResponse = response;
|
||||
|
||||
+2
@@ -111,6 +111,7 @@ public class DigestAuthenticationFilter extends GenericFilterBean implements Mes
|
||||
Assert.notNull(this.authenticationEntryPoint, "A DigestAuthenticationEntryPoint is required");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void doFilter(ServletRequest req, ServletResponse res, FilterChain chain)
|
||||
throws IOException, ServletException {
|
||||
HttpServletRequest request = (HttpServletRequest) req;
|
||||
@@ -266,6 +267,7 @@ public class DigestAuthenticationFilter extends GenericFilterBean implements Mes
|
||||
this.authenticationEntryPoint = authenticationEntryPoint;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setMessageSource(MessageSource messageSource) {
|
||||
this.messages = new MessageSourceAccessor(messageSource);
|
||||
}
|
||||
|
||||
+2
@@ -92,6 +92,7 @@ public final class AuthenticationPrincipalArgumentResolver implements HandlerMet
|
||||
* @see org.springframework.web.method.support.HandlerMethodArgumentResolver#
|
||||
* supportsParameter (org.springframework.core.MethodParameter)
|
||||
*/
|
||||
@Override
|
||||
public boolean supportsParameter(MethodParameter parameter) {
|
||||
return findMethodAnnotation(AuthenticationPrincipal.class, parameter) != null;
|
||||
}
|
||||
@@ -105,6 +106,7 @@ public final class AuthenticationPrincipalArgumentResolver implements HandlerMet
|
||||
* org.springframework.web.context.request.NativeWebRequest,
|
||||
* org.springframework.web.bind.support.WebDataBinderFactory)
|
||||
*/
|
||||
@Override
|
||||
public Object resolveArgument(MethodParameter parameter, ModelAndViewContainer mavContainer,
|
||||
NativeWebRequest webRequest, WebDataBinderFactory binderFactory) {
|
||||
Authentication authentication = SecurityContextHolder.getContext().getAuthentication();
|
||||
|
||||
+1
@@ -105,6 +105,7 @@ public abstract class AbstractSecurityWebApplicationInitializer implements WebAp
|
||||
* @see org.springframework.web.WebApplicationInitializer#onStartup(javax.servlet.
|
||||
* ServletContext)
|
||||
*/
|
||||
@Override
|
||||
public final void onStartup(ServletContext servletContext) {
|
||||
beforeSpringSecurityFilterChain(servletContext);
|
||||
if (this.configurationClasses != null) {
|
||||
|
||||
+3
@@ -109,6 +109,7 @@ public class HttpSessionSecurityContextRepository implements SecurityContextRepo
|
||||
* the session is not an instance of {@code SecurityContext}, a new context object
|
||||
* will be generated and returned.
|
||||
*/
|
||||
@Override
|
||||
public SecurityContext loadContext(HttpRequestResponseHolder requestResponseHolder) {
|
||||
HttpServletRequest request = requestResponseHolder.getRequest();
|
||||
HttpServletResponse response = requestResponseHolder.getResponse();
|
||||
@@ -134,6 +135,7 @@ public class HttpSessionSecurityContextRepository implements SecurityContextRepo
|
||||
return context;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void saveContext(SecurityContext context, HttpServletRequest request, HttpServletResponse response) {
|
||||
SaveContextOnUpdateOrErrorResponseWrapper responseWrapper = WebUtils.getNativeResponse(response,
|
||||
SaveContextOnUpdateOrErrorResponseWrapper.class);
|
||||
@@ -150,6 +152,7 @@ public class HttpSessionSecurityContextRepository implements SecurityContextRepo
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean containsContext(HttpServletRequest request) {
|
||||
HttpSession session = request.getSession(false);
|
||||
|
||||
|
||||
+3
@@ -27,14 +27,17 @@ import org.springframework.security.core.context.SecurityContextHolder;
|
||||
*/
|
||||
public final class NullSecurityContextRepository implements SecurityContextRepository {
|
||||
|
||||
@Override
|
||||
public boolean containsContext(HttpServletRequest request) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public SecurityContext loadContext(HttpRequestResponseHolder requestResponseHolder) {
|
||||
return SecurityContextHolder.createEmptyContext();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void saveContext(SecurityContext context, HttpServletRequest request, HttpServletResponse response) {
|
||||
}
|
||||
|
||||
|
||||
+1
@@ -72,6 +72,7 @@ public class SecurityContextPersistenceFilter extends GenericFilterBean {
|
||||
this.repo = repo;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void doFilter(ServletRequest req, ServletResponse res, FilterChain chain)
|
||||
throws IOException, ServletException {
|
||||
HttpServletRequest request = (HttpServletRequest) req;
|
||||
|
||||
@@ -49,6 +49,7 @@ public final class CsrfLogoutHandler implements LogoutHandler {
|
||||
* javax.servlet.http.HttpServletResponse,
|
||||
* org.springframework.security.core.Authentication)
|
||||
*/
|
||||
@Override
|
||||
public void logout(HttpServletRequest request, HttpServletResponse response, Authentication authentication) {
|
||||
this.csrfTokenRepository.saveToken(null, request, response);
|
||||
}
|
||||
|
||||
@@ -53,6 +53,7 @@ public final class DefaultCsrfToken implements CsrfToken {
|
||||
*
|
||||
* @see org.springframework.security.web.csrf.CsrfToken#getHeaderName()
|
||||
*/
|
||||
@Override
|
||||
public String getHeaderName() {
|
||||
return this.headerName;
|
||||
}
|
||||
@@ -62,6 +63,7 @@ public final class DefaultCsrfToken implements CsrfToken {
|
||||
*
|
||||
* @see org.springframework.security.web.csrf.CsrfToken#getParameterName()
|
||||
*/
|
||||
@Override
|
||||
public String getParameterName() {
|
||||
return this.parameterName;
|
||||
}
|
||||
@@ -71,6 +73,7 @@ public final class DefaultCsrfToken implements CsrfToken {
|
||||
*
|
||||
* @see org.springframework.security.web.csrf.CsrfToken#getToken()
|
||||
*/
|
||||
@Override
|
||||
public String getToken() {
|
||||
return this.token;
|
||||
}
|
||||
|
||||
+3
@@ -52,6 +52,7 @@ public final class HttpSessionCsrfTokenRepository implements CsrfTokenRepository
|
||||
* springframework .security.web.csrf.CsrfToken,
|
||||
* javax.servlet.http.HttpServletRequest, javax.servlet.http.HttpServletResponse)
|
||||
*/
|
||||
@Override
|
||||
public void saveToken(CsrfToken token, HttpServletRequest request, HttpServletResponse response) {
|
||||
if (token == null) {
|
||||
HttpSession session = request.getSession(false);
|
||||
@@ -72,6 +73,7 @@ public final class HttpSessionCsrfTokenRepository implements CsrfTokenRepository
|
||||
* org.springframework.security.web.csrf.CsrfTokenRepository#loadToken(javax.servlet
|
||||
* .http.HttpServletRequest)
|
||||
*/
|
||||
@Override
|
||||
public CsrfToken loadToken(HttpServletRequest request) {
|
||||
HttpSession session = request.getSession(false);
|
||||
if (session == null) {
|
||||
@@ -86,6 +88,7 @@ public final class HttpSessionCsrfTokenRepository implements CsrfTokenRepository
|
||||
* @see org.springframework.security.web.csrf.CsrfTokenRepository#generateToken(javax.
|
||||
* servlet .http.HttpServletRequest)
|
||||
*/
|
||||
@Override
|
||||
public CsrfToken generateToken(HttpServletRequest request) {
|
||||
return new DefaultCsrfToken(this.headerName, this.parameterName, createNewToken());
|
||||
}
|
||||
|
||||
@@ -57,6 +57,7 @@ public final class DebugFilter implements Filter {
|
||||
this.fcp = fcp;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void doFilter(ServletRequest srvltRequest, ServletResponse srvltResponse, FilterChain filterChain)
|
||||
throws ServletException, IOException {
|
||||
|
||||
@@ -141,9 +142,11 @@ public final class DebugFilter implements Filter {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void init(FilterConfig filterConfig) {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void destroy() {
|
||||
}
|
||||
|
||||
|
||||
@@ -125,6 +125,7 @@ final class RequestWrapper extends FirewalledRequest {
|
||||
return this.stripPaths ? new FirewalledRequestAwareRequestDispatcher(path) : super.getRequestDispatcher(path);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void reset() {
|
||||
this.stripPaths = false;
|
||||
}
|
||||
@@ -148,11 +149,13 @@ final class RequestWrapper extends FirewalledRequest {
|
||||
this.path = path;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void forward(ServletRequest request, ServletResponse response) throws ServletException, IOException {
|
||||
reset();
|
||||
getDelegateDispatcher().forward(request, response);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void include(ServletRequest request, ServletResponse response) throws ServletException, IOException {
|
||||
getDelegateDispatcher().include(request, response);
|
||||
}
|
||||
|
||||
+1
@@ -115,6 +115,7 @@ public final class ClearSiteDataHeaderWriter implements HeaderWriter {
|
||||
|
||||
private static final class SecureRequestMatcher implements RequestMatcher {
|
||||
|
||||
@Override
|
||||
public boolean matches(HttpServletRequest request) {
|
||||
return request.isSecure();
|
||||
}
|
||||
|
||||
+1
@@ -56,6 +56,7 @@ public final class DelegatingRequestMatcherHeaderWriter implements HeaderWriter
|
||||
* org.springframework.security.web.headers.HeaderWriter#writeHeaders(javax.servlet
|
||||
* .http.HttpServletRequest, javax.servlet.http.HttpServletResponse)
|
||||
*/
|
||||
@Override
|
||||
public void writeHeaders(HttpServletRequest request, HttpServletResponse response) {
|
||||
if (this.requestMatcher.matches(request)) {
|
||||
this.delegateHeaderWriter.writeHeaders(request, response);
|
||||
|
||||
+2
@@ -177,6 +177,7 @@ public final class HpkpHeaderWriter implements HeaderWriter {
|
||||
* @see org.springframework.security.web.headers.HeaderWriter#writeHeaders(javax
|
||||
* .servlet.http.HttpServletRequest, javax.servlet.http.HttpServletResponse)
|
||||
*/
|
||||
@Override
|
||||
public void writeHeaders(HttpServletRequest request, HttpServletResponse response) {
|
||||
if (this.requestMatcher.matches(request)) {
|
||||
if (!this.pins.isEmpty()) {
|
||||
@@ -441,6 +442,7 @@ public final class HpkpHeaderWriter implements HeaderWriter {
|
||||
|
||||
private static final class SecureRequestMatcher implements RequestMatcher {
|
||||
|
||||
@Override
|
||||
public boolean matches(HttpServletRequest request) {
|
||||
return request.isSecure();
|
||||
}
|
||||
|
||||
+2
@@ -151,6 +151,7 @@ public final class HstsHeaderWriter implements HeaderWriter {
|
||||
* @see org.springframework.security.web.headers.HeaderWriter#writeHeaders(javax
|
||||
* .servlet.http.HttpServletRequest, javax.servlet.http.HttpServletResponse)
|
||||
*/
|
||||
@Override
|
||||
public void writeHeaders(HttpServletRequest request, HttpServletResponse response) {
|
||||
if (this.requestMatcher.matches(request)) {
|
||||
if (!response.containsHeader(HSTS_HEADER_NAME)) {
|
||||
@@ -246,6 +247,7 @@ public final class HstsHeaderWriter implements HeaderWriter {
|
||||
|
||||
private static final class SecureRequestMatcher implements RequestMatcher {
|
||||
|
||||
@Override
|
||||
public boolean matches(HttpServletRequest request) {
|
||||
return request.isSecure();
|
||||
}
|
||||
|
||||
+1
@@ -55,6 +55,7 @@ public class StaticHeadersWriter implements HeaderWriter {
|
||||
this(Collections.singletonList(new Header(headerName, headerValues)));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void writeHeaders(HttpServletRequest request, HttpServletResponse response) {
|
||||
for (Header header : this.headers) {
|
||||
if (!response.containsHeader(header.getName())) {
|
||||
|
||||
+1
@@ -48,6 +48,7 @@ public final class XXssProtectionHeaderWriter implements HeaderWriter {
|
||||
updateHeaderValue();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void writeHeaders(HttpServletRequest request, HttpServletResponse response) {
|
||||
if (!response.containsHeader(XSS_PROTECTION_HEADER)) {
|
||||
response.setHeader(XSS_PROTECTION_HEADER, this.headerValue);
|
||||
|
||||
+1
@@ -45,6 +45,7 @@ abstract class AbstractRequestParameterAllowFromStrategy implements AllowFromStr
|
||||
/** Logger for use by subclasses */
|
||||
protected final Log log = LogFactory.getLog(getClass());
|
||||
|
||||
@Override
|
||||
public String getAllowFromValue(HttpServletRequest request) {
|
||||
String allowFromOrigin = request.getParameter(this.allowFromParameterName);
|
||||
if (this.log.isDebugEnabled()) {
|
||||
|
||||
+1
@@ -36,6 +36,7 @@ public final class StaticAllowFromStrategy implements AllowFromStrategy {
|
||||
this.uri = uri;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getAllowFromValue(HttpServletRequest request) {
|
||||
return this.uri.toString();
|
||||
}
|
||||
|
||||
+1
@@ -83,6 +83,7 @@ public final class XFrameOptionsHeaderWriter implements HeaderWriter {
|
||||
* @param request the servlet request
|
||||
* @param response the servlet response
|
||||
*/
|
||||
@Override
|
||||
public void writeHeaders(HttpServletRequest request, HttpServletResponse response) {
|
||||
if (XFrameOptionsMode.ALLOW_FROM.equals(this.frameOptionsMode)) {
|
||||
String allowFromValue = this.allowFromStrategy.getAllowFromValue(request);
|
||||
|
||||
+1
@@ -68,6 +68,7 @@ public class JaasApiIntegrationFilter extends GenericFilterBean {
|
||||
* <code>Subject</code> obtained.
|
||||
* </p>
|
||||
*/
|
||||
@Override
|
||||
public final void doFilter(final ServletRequest request, final ServletResponse response, final FilterChain chain)
|
||||
throws ServletException, IOException {
|
||||
|
||||
|
||||
+2
@@ -96,6 +96,7 @@ public final class AuthenticationPrincipalArgumentResolver implements HandlerMet
|
||||
* @see org.springframework.web.method.support.HandlerMethodArgumentResolver#
|
||||
* supportsParameter (org.springframework.core.MethodParameter)
|
||||
*/
|
||||
@Override
|
||||
public boolean supportsParameter(MethodParameter parameter) {
|
||||
return findMethodAnnotation(AuthenticationPrincipal.class, parameter) != null;
|
||||
}
|
||||
@@ -109,6 +110,7 @@ public final class AuthenticationPrincipalArgumentResolver implements HandlerMet
|
||||
* org.springframework.web.context.request.NativeWebRequest,
|
||||
* org.springframework.web.bind.support.WebDataBinderFactory)
|
||||
*/
|
||||
@Override
|
||||
public Object resolveArgument(MethodParameter parameter, ModelAndViewContainer mavContainer,
|
||||
NativeWebRequest webRequest, WebDataBinderFactory binderFactory) {
|
||||
Authentication authentication = SecurityContextHolder.getContext().getAuthentication();
|
||||
|
||||
+4
-1
@@ -20,6 +20,7 @@ import org.springframework.security.web.csrf.CsrfToken;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
import org.springframework.web.bind.support.WebDataBinderFactory;
|
||||
import org.springframework.web.context.request.NativeWebRequest;
|
||||
import org.springframework.web.context.request.RequestAttributes;
|
||||
import org.springframework.web.method.support.HandlerMethodArgumentResolver;
|
||||
import org.springframework.web.method.support.ModelAndViewContainer;
|
||||
|
||||
@@ -49,6 +50,7 @@ public final class CsrfTokenArgumentResolver implements HandlerMethodArgumentRes
|
||||
* @see org.springframework.web.method.support.HandlerMethodArgumentResolver#
|
||||
* supportsParameter (org.springframework.core.MethodParameter)
|
||||
*/
|
||||
@Override
|
||||
public boolean supportsParameter(MethodParameter parameter) {
|
||||
return CsrfToken.class.equals(parameter.getParameterType());
|
||||
}
|
||||
@@ -62,10 +64,11 @@ public final class CsrfTokenArgumentResolver implements HandlerMethodArgumentRes
|
||||
* org.springframework.web.context.request.NativeWebRequest,
|
||||
* org.springframework.web.bind.support.WebDataBinderFactory)
|
||||
*/
|
||||
@Override
|
||||
public Object resolveArgument(MethodParameter parameter, ModelAndViewContainer mavContainer,
|
||||
NativeWebRequest webRequest, WebDataBinderFactory binderFactory) {
|
||||
CsrfToken token = (CsrfToken) webRequest.getAttribute(CsrfToken.class.getName(),
|
||||
NativeWebRequest.SCOPE_REQUEST);
|
||||
RequestAttributes.SCOPE_REQUEST);
|
||||
return token;
|
||||
}
|
||||
|
||||
|
||||
+2
-1
@@ -510,8 +510,9 @@ public class DefaultSavedRequest implements SavedRequest {
|
||||
savedRequest.addCookie(cookie.getCookie());
|
||||
}
|
||||
}
|
||||
if (!ObjectUtils.isEmpty(this.locales))
|
||||
if (!ObjectUtils.isEmpty(this.locales)) {
|
||||
savedRequest.locales.addAll(this.locales);
|
||||
}
|
||||
savedRequest.addParameters(this.parameters);
|
||||
|
||||
this.headers.remove(HEADER_IF_MODIFIED_SINCE);
|
||||
|
||||
@@ -115,6 +115,7 @@ public class Enumerator<T> implements Enumeration<T> {
|
||||
* @return <code>true</code> if and only if this enumeration object contains at least
|
||||
* one more element to provide, <code>false</code> otherwise
|
||||
*/
|
||||
@Override
|
||||
public boolean hasMoreElements() {
|
||||
return (this.iterator.hasNext());
|
||||
}
|
||||
@@ -125,6 +126,7 @@ public class Enumerator<T> implements Enumeration<T> {
|
||||
* @return the next element of this enumeration
|
||||
* @exception NoSuchElementException if no more elements exist
|
||||
*/
|
||||
@Override
|
||||
public T nextElement() throws NoSuchElementException {
|
||||
return (this.iterator.next());
|
||||
}
|
||||
|
||||
+4
@@ -54,6 +54,7 @@ public class HttpSessionRequestCache implements RequestCache {
|
||||
/**
|
||||
* Stores the current request, provided the configuration properties allow it.
|
||||
*/
|
||||
@Override
|
||||
public void saveRequest(HttpServletRequest request, HttpServletResponse response) {
|
||||
if (this.requestMatcher.matches(request)) {
|
||||
DefaultSavedRequest savedRequest = new DefaultSavedRequest(request, this.portResolver);
|
||||
@@ -71,6 +72,7 @@ public class HttpSessionRequestCache implements RequestCache {
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public SavedRequest getRequest(HttpServletRequest currentRequest, HttpServletResponse response) {
|
||||
HttpSession session = currentRequest.getSession(false);
|
||||
|
||||
@@ -81,6 +83,7 @@ public class HttpSessionRequestCache implements RequestCache {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void removeRequest(HttpServletRequest currentRequest, HttpServletResponse response) {
|
||||
HttpSession session = currentRequest.getSession(false);
|
||||
|
||||
@@ -90,6 +93,7 @@ public class HttpSessionRequestCache implements RequestCache {
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public HttpServletRequest getMatchingRequest(HttpServletRequest request, HttpServletResponse response) {
|
||||
SavedRequest saved = getRequest(request, response);
|
||||
|
||||
|
||||
@@ -27,17 +27,21 @@ import javax.servlet.http.HttpServletResponse;
|
||||
*/
|
||||
public class NullRequestCache implements RequestCache {
|
||||
|
||||
@Override
|
||||
public SavedRequest getRequest(HttpServletRequest request, HttpServletResponse response) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void removeRequest(HttpServletRequest request, HttpServletResponse response) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void saveRequest(HttpServletRequest request, HttpServletResponse response) {
|
||||
}
|
||||
|
||||
@Override
|
||||
public HttpServletRequest getMatchingRequest(HttpServletRequest request, HttpServletResponse response) {
|
||||
return null;
|
||||
}
|
||||
|
||||
+1
@@ -54,6 +54,7 @@ public class RequestCacheAwareFilter extends GenericFilterBean {
|
||||
this.requestCache = requestCache;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void doFilter(ServletRequest request, ServletResponse response, FilterChain chain)
|
||||
throws IOException, ServletException {
|
||||
|
||||
|
||||
@@ -94,14 +94,17 @@ public class SavedCookie implements Serializable {
|
||||
public Cookie getCookie() {
|
||||
Cookie c = new Cookie(getName(), getValue());
|
||||
|
||||
if (getComment() != null)
|
||||
if (getComment() != null) {
|
||||
c.setComment(getComment());
|
||||
}
|
||||
|
||||
if (getDomain() != null)
|
||||
if (getDomain() != null) {
|
||||
c.setDomain(getDomain());
|
||||
}
|
||||
|
||||
if (getPath() != null)
|
||||
if (getPath() != null) {
|
||||
c.setPath(getPath());
|
||||
}
|
||||
|
||||
c.setVersion(getVersion());
|
||||
c.setMaxAge(getMaxAge());
|
||||
|
||||
+1
@@ -42,6 +42,7 @@ public class DefaultServerRedirectStrategy implements ServerRedirectStrategy {
|
||||
|
||||
private boolean contextRelative = true;
|
||||
|
||||
@Override
|
||||
public Mono<Void> sendRedirect(ServerWebExchange exchange, URI location) {
|
||||
Assert.notNull(exchange, "exchange cannot be null");
|
||||
Assert.notNull(location, "location cannot be null");
|
||||
|
||||
+1
@@ -58,6 +58,7 @@ public class DelegatingServerAuthenticationEntryPoint implements ServerAuthentic
|
||||
this.entryPoints = entryPoints;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Mono<Void> commence(ServerWebExchange exchange, AuthenticationException e) {
|
||||
return Flux.fromIterable(this.entryPoints).filterWhen(entry -> isMatch(exchange, entry)).next()
|
||||
.map(entry -> entry.getEntryPoint()).doOnNext(it -> {
|
||||
|
||||
+2
@@ -35,10 +35,12 @@ public final class NoOpServerSecurityContextRepository implements ServerSecurity
|
||||
private NoOpServerSecurityContextRepository() {
|
||||
}
|
||||
|
||||
@Override
|
||||
public Mono<Void> save(ServerWebExchange exchange, SecurityContext context) {
|
||||
return Mono.empty();
|
||||
}
|
||||
|
||||
@Override
|
||||
public Mono<SecurityContext> load(ServerWebExchange exchange) {
|
||||
return Mono.empty();
|
||||
}
|
||||
|
||||
+2
@@ -53,6 +53,7 @@ public class WebSessionServerSecurityContextRepository implements ServerSecurity
|
||||
this.springSecurityContextAttrName = springSecurityContextAttrName;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Mono<Void> save(ServerWebExchange exchange, SecurityContext context) {
|
||||
return exchange.getSession().doOnNext(session -> {
|
||||
if (context == null) {
|
||||
@@ -70,6 +71,7 @@ public class WebSessionServerSecurityContextRepository implements ServerSecurity
|
||||
}).flatMap(session -> session.changeSessionId());
|
||||
}
|
||||
|
||||
@Override
|
||||
public Mono<SecurityContext> load(ServerWebExchange exchange) {
|
||||
return exchange.getSession().flatMap(session -> {
|
||||
SecurityContext context = (SecurityContext) session.getAttribute(this.springSecurityContextAttrName);
|
||||
|
||||
+11
-4
@@ -53,6 +53,7 @@ public final class DefaultCsrfToken implements CsrfToken {
|
||||
*
|
||||
* @see org.springframework.security.web.csrf.CsrfToken#getHeaderName()
|
||||
*/
|
||||
@Override
|
||||
public String getHeaderName() {
|
||||
return this.headerName;
|
||||
}
|
||||
@@ -62,6 +63,7 @@ public final class DefaultCsrfToken implements CsrfToken {
|
||||
*
|
||||
* @see org.springframework.security.web.csrf.CsrfToken#getParameterName()
|
||||
*/
|
||||
@Override
|
||||
public String getParameterName() {
|
||||
return this.parameterName;
|
||||
}
|
||||
@@ -71,23 +73,28 @@ public final class DefaultCsrfToken implements CsrfToken {
|
||||
*
|
||||
* @see org.springframework.security.web.csrf.CsrfToken#getToken()
|
||||
*/
|
||||
@Override
|
||||
public String getToken() {
|
||||
return this.token;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(Object o) {
|
||||
if (this == o)
|
||||
if (this == o) {
|
||||
return true;
|
||||
if (o == null || !(o instanceof CsrfToken))
|
||||
}
|
||||
if (o == null || !(o instanceof CsrfToken)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
CsrfToken that = (CsrfToken) o;
|
||||
|
||||
if (!getToken().equals(that.getToken()))
|
||||
if (!getToken().equals(that.getToken())) {
|
||||
return false;
|
||||
if (!getParameterName().equals(that.getParameterName()))
|
||||
}
|
||||
if (!getParameterName().equals(that.getParameterName())) {
|
||||
return false;
|
||||
}
|
||||
return getHeaderName().equals(that.getHeaderName());
|
||||
}
|
||||
|
||||
|
||||
+2
-1
@@ -51,7 +51,8 @@ public class WebSessionServerCsrfTokenRepository implements ServerCsrfTokenRepos
|
||||
|
||||
@Override
|
||||
public Mono<CsrfToken> generateToken(ServerWebExchange exchange) {
|
||||
return Mono.just(exchange).publishOn(Schedulers.boundedElastic()).fromCallable(() -> createCsrfToken());
|
||||
Mono.just(exchange).publishOn(Schedulers.boundedElastic());
|
||||
return Mono.fromCallable(() -> createCsrfToken());
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user