Remove superfluous comments
Use '^\s+//\ \~\ .*$' and '^\s+//\ ============+$' regular expression searches to remove superfluous comments. Prior to this commit, many classes would have comments to indicate blocks of code (such as constructors/methods/instance fields). These added a lot of noise and weren't all that helpful, especially given the outline views available in most modern IDEs. Issue gh-8945
This commit is contained in:
@@ -32,9 +32,6 @@ import javax.servlet.http.HttpServletResponse;
|
||||
*/
|
||||
public interface AuthenticationEntryPoint {
|
||||
|
||||
// ~ Methods
|
||||
// ========================================================================================================
|
||||
|
||||
/**
|
||||
* Commences an authentication scheme.
|
||||
* <p>
|
||||
|
||||
@@ -137,14 +137,8 @@ import java.util.*;
|
||||
*/
|
||||
public class FilterChainProxy extends GenericFilterBean {
|
||||
|
||||
// ~ Static fields/initializers
|
||||
// =====================================================================================
|
||||
|
||||
private static final Log logger = LogFactory.getLog(FilterChainProxy.class);
|
||||
|
||||
// ~ Instance fields
|
||||
// ================================================================================================
|
||||
|
||||
private final static String FILTER_APPLIED = FilterChainProxy.class.getName().concat(".APPLIED");
|
||||
|
||||
private List<SecurityFilterChain> filterChains;
|
||||
@@ -155,9 +149,6 @@ public class FilterChainProxy extends GenericFilterBean {
|
||||
|
||||
private RequestRejectedHandler requestRejectedHandler = new DefaultRequestRejectedHandler();
|
||||
|
||||
// ~ Methods
|
||||
// ========================================================================================================
|
||||
|
||||
public FilterChainProxy() {
|
||||
}
|
||||
|
||||
@@ -296,9 +287,6 @@ public class FilterChainProxy extends GenericFilterBean {
|
||||
return sb.toString();
|
||||
}
|
||||
|
||||
// ~ Inner Classes
|
||||
// ==================================================================================================
|
||||
|
||||
/**
|
||||
* Internal {@code FilterChain} implementation that is used to pass a request through
|
||||
* the additional internal list of filters which match the request.
|
||||
|
||||
@@ -54,24 +54,16 @@ import org.springframework.security.web.util.UrlUtils;
|
||||
*/
|
||||
public class FilterInvocation {
|
||||
|
||||
// ~ Static fields
|
||||
// ==================================================================================================
|
||||
static final FilterChain DUMMY_CHAIN = (req, res) -> {
|
||||
throw new UnsupportedOperationException("Dummy filter chain");
|
||||
};
|
||||
|
||||
// ~ Instance fields
|
||||
// ================================================================================================
|
||||
|
||||
private FilterChain chain;
|
||||
|
||||
private HttpServletRequest request;
|
||||
|
||||
private HttpServletResponse response;
|
||||
|
||||
// ~ Constructors
|
||||
// ===================================================================================================
|
||||
|
||||
public FilterInvocation(ServletRequest request, ServletResponse response, FilterChain chain) {
|
||||
if ((request == null) || (response == null) || (chain == null)) {
|
||||
throw new IllegalArgumentException("Cannot pass null values to constructor");
|
||||
@@ -104,9 +96,6 @@ public class FilterInvocation {
|
||||
this.request = request;
|
||||
}
|
||||
|
||||
// ~ Methods
|
||||
// ========================================================================================================
|
||||
|
||||
public FilterChain getChain() {
|
||||
return this.chain;
|
||||
}
|
||||
|
||||
@@ -24,9 +24,6 @@ package org.springframework.security.web;
|
||||
*/
|
||||
public interface PortMapper {
|
||||
|
||||
// ~ Methods
|
||||
// ========================================================================================================
|
||||
|
||||
/**
|
||||
* Locates the HTTP port associated with the specified HTTPS port.
|
||||
* <P>
|
||||
|
||||
@@ -33,23 +33,14 @@ import org.springframework.util.Assert;
|
||||
*/
|
||||
public class PortMapperImpl implements PortMapper {
|
||||
|
||||
// ~ Instance fields
|
||||
// ================================================================================================
|
||||
|
||||
private final Map<Integer, Integer> httpsPortMappings;
|
||||
|
||||
// ~ Constructors
|
||||
// ===================================================================================================
|
||||
|
||||
public PortMapperImpl() {
|
||||
this.httpsPortMappings = new HashMap<>();
|
||||
this.httpsPortMappings.put(80, 443);
|
||||
this.httpsPortMappings.put(8080, 8443);
|
||||
}
|
||||
|
||||
// ~ Methods
|
||||
// ========================================================================================================
|
||||
|
||||
/**
|
||||
* Returns the translated (Integer -> Integer) version of the original port mapping
|
||||
* specified via setHttpsPortMapping()
|
||||
|
||||
@@ -31,9 +31,6 @@ import javax.servlet.ServletRequest;
|
||||
*/
|
||||
public interface PortResolver {
|
||||
|
||||
// ~ Methods
|
||||
// ========================================================================================================
|
||||
|
||||
/**
|
||||
* Indicates the port the <code>ServletRequest</code> was received on.
|
||||
* @param request that the method should lookup the port for
|
||||
|
||||
@@ -36,14 +36,8 @@ import javax.servlet.ServletRequest;
|
||||
*/
|
||||
public class PortResolverImpl implements PortResolver {
|
||||
|
||||
// ~ Instance fields
|
||||
// ================================================================================================
|
||||
|
||||
private PortMapper portMapper = new PortMapperImpl();
|
||||
|
||||
// ~ Methods
|
||||
// ========================================================================================================
|
||||
|
||||
public PortMapper getPortMapper() {
|
||||
return portMapper;
|
||||
}
|
||||
|
||||
@@ -32,9 +32,6 @@ import javax.servlet.http.HttpServletResponse;
|
||||
*/
|
||||
public interface AccessDeniedHandler {
|
||||
|
||||
// ~ Methods
|
||||
// ========================================================================================================
|
||||
|
||||
/**
|
||||
* Handles an access denied failure.
|
||||
* @param request that resulted in an <code>AccessDeniedException</code>
|
||||
|
||||
@@ -44,19 +44,10 @@ import org.springframework.security.web.WebAttributes;
|
||||
*/
|
||||
public class AccessDeniedHandlerImpl implements AccessDeniedHandler {
|
||||
|
||||
// ~ Static fields/initializers
|
||||
// =====================================================================================
|
||||
|
||||
protected static final Log logger = LogFactory.getLog(AccessDeniedHandlerImpl.class);
|
||||
|
||||
// ~ Instance fields
|
||||
// ================================================================================================
|
||||
|
||||
private String errorPage;
|
||||
|
||||
// ~ Methods
|
||||
// ========================================================================================================
|
||||
|
||||
public void handle(HttpServletRequest request, HttpServletResponse response,
|
||||
AccessDeniedException accessDeniedException) throws IOException, ServletException {
|
||||
if (!response.isCommitted()) {
|
||||
|
||||
-12
@@ -36,19 +36,10 @@ import org.springframework.util.Assert;
|
||||
*/
|
||||
public class DefaultWebInvocationPrivilegeEvaluator implements WebInvocationPrivilegeEvaluator {
|
||||
|
||||
// ~ Static fields/initializers
|
||||
// =====================================================================================
|
||||
|
||||
protected static final Log logger = LogFactory.getLog(DefaultWebInvocationPrivilegeEvaluator.class);
|
||||
|
||||
// ~ Instance fields
|
||||
// ================================================================================================
|
||||
|
||||
private final AbstractSecurityInterceptor securityInterceptor;
|
||||
|
||||
// ~ Constructors
|
||||
// ===================================================================================================
|
||||
|
||||
public DefaultWebInvocationPrivilegeEvaluator(AbstractSecurityInterceptor securityInterceptor) {
|
||||
Assert.notNull(securityInterceptor, "SecurityInterceptor cannot be null");
|
||||
Assert.isTrue(FilterInvocation.class.equals(securityInterceptor.getSecureObjectClass()),
|
||||
@@ -59,9 +50,6 @@ public class DefaultWebInvocationPrivilegeEvaluator implements WebInvocationPriv
|
||||
this.securityInterceptor = securityInterceptor;
|
||||
}
|
||||
|
||||
// ~ Methods
|
||||
// ========================================================================================================
|
||||
|
||||
/**
|
||||
* Determines whether the user represented by the supplied <tt>Authentication</tt>
|
||||
* object is allowed to invoke the supplied URI.
|
||||
|
||||
-6
@@ -77,9 +77,6 @@ import java.io.IOException;
|
||||
*/
|
||||
public class ExceptionTranslationFilter extends GenericFilterBean {
|
||||
|
||||
// ~ Instance fields
|
||||
// ================================================================================================
|
||||
|
||||
private AccessDeniedHandler accessDeniedHandler = new AccessDeniedHandlerImpl();
|
||||
|
||||
private AuthenticationEntryPoint authenticationEntryPoint;
|
||||
@@ -103,9 +100,6 @@ public class ExceptionTranslationFilter extends GenericFilterBean {
|
||||
this.requestCache = requestCache;
|
||||
}
|
||||
|
||||
// ~ Methods
|
||||
// ========================================================================================================
|
||||
|
||||
@Override
|
||||
public void afterPropertiesSet() {
|
||||
Assert.notNull(authenticationEntryPoint, "authenticationEntryPoint must be specified");
|
||||
|
||||
-11
@@ -30,13 +30,8 @@ import java.io.IOException;
|
||||
*/
|
||||
public abstract class AbstractRetryEntryPoint implements ChannelEntryPoint {
|
||||
|
||||
// ~ Static fields/initializers
|
||||
// =====================================================================================
|
||||
protected final Log logger = LogFactory.getLog(getClass());
|
||||
|
||||
// ~ Instance fields
|
||||
// ================================================================================================
|
||||
|
||||
private PortMapper portMapper = new PortMapperImpl();
|
||||
|
||||
private PortResolver portResolver = new PortResolverImpl();
|
||||
@@ -49,17 +44,11 @@ public abstract class AbstractRetryEntryPoint implements ChannelEntryPoint {
|
||||
|
||||
private RedirectStrategy redirectStrategy = new DefaultRedirectStrategy();
|
||||
|
||||
// ~ Constructors
|
||||
// ===================================================================================================
|
||||
|
||||
public AbstractRetryEntryPoint(String scheme, int standardPort) {
|
||||
this.scheme = scheme;
|
||||
this.standardPort = standardPort;
|
||||
}
|
||||
|
||||
// ~ Methods
|
||||
// ========================================================================================================
|
||||
|
||||
public void commence(HttpServletRequest request, HttpServletResponse response) throws IOException {
|
||||
String queryString = request.getQueryString();
|
||||
String redirectUrl = request.getRequestURI() + ((queryString == null) ? "" : ("?" + queryString));
|
||||
|
||||
-3
@@ -31,9 +31,6 @@ import javax.servlet.ServletException;
|
||||
*/
|
||||
public interface ChannelDecisionManager {
|
||||
|
||||
// ~ Methods
|
||||
// ========================================================================================================
|
||||
|
||||
/**
|
||||
* Decided whether the presented {@link FilterInvocation} provides the appropriate
|
||||
* level of channel security based on the requested list of <tt>ConfigAttribute</tt>s.
|
||||
|
||||
-6
@@ -51,14 +51,8 @@ public class ChannelDecisionManagerImpl implements ChannelDecisionManager, Initi
|
||||
|
||||
public static final String ANY_CHANNEL = "ANY_CHANNEL";
|
||||
|
||||
// ~ Instance fields
|
||||
// ================================================================================================
|
||||
|
||||
private List<ChannelProcessor> channelProcessors;
|
||||
|
||||
// ~ Methods
|
||||
// ========================================================================================================
|
||||
|
||||
public void afterPropertiesSet() {
|
||||
Assert.notEmpty(channelProcessors, "A list of ChannelProcessors is required");
|
||||
}
|
||||
|
||||
-3
@@ -33,9 +33,6 @@ import javax.servlet.http.HttpServletResponse;
|
||||
*/
|
||||
public interface ChannelEntryPoint {
|
||||
|
||||
// ~ Methods
|
||||
// ========================================================================================================
|
||||
|
||||
/**
|
||||
* Commences a secure channel.
|
||||
* <p>
|
||||
|
||||
-6
@@ -85,16 +85,10 @@ import org.springframework.web.filter.GenericFilterBean;
|
||||
*/
|
||||
public class ChannelProcessingFilter extends GenericFilterBean {
|
||||
|
||||
// ~ Instance fields
|
||||
// ================================================================================================
|
||||
|
||||
private ChannelDecisionManager channelDecisionManager;
|
||||
|
||||
private FilterInvocationSecurityMetadataSource securityMetadataSource;
|
||||
|
||||
// ~ Methods
|
||||
// ========================================================================================================
|
||||
|
||||
@Override
|
||||
public void afterPropertiesSet() {
|
||||
Assert.notNull(this.securityMetadataSource, "securityMetadataSource must be specified");
|
||||
|
||||
-3
@@ -37,9 +37,6 @@ import javax.servlet.ServletException;
|
||||
*/
|
||||
public interface ChannelProcessor {
|
||||
|
||||
// ~ Methods
|
||||
// ========================================================================================================
|
||||
|
||||
/**
|
||||
* Decided whether the presented {@link FilterInvocation} provides the appropriate
|
||||
* level of channel security based on the requested list of <tt>ConfigAttribute</tt>s.
|
||||
|
||||
-6
@@ -42,16 +42,10 @@ import org.springframework.util.Assert;
|
||||
*/
|
||||
public class InsecureChannelProcessor implements InitializingBean, ChannelProcessor {
|
||||
|
||||
// ~ Instance fields
|
||||
// ================================================================================================
|
||||
|
||||
private ChannelEntryPoint entryPoint = new RetryWithHttpEntryPoint();
|
||||
|
||||
private String insecureKeyword = "REQUIRES_INSECURE_CHANNEL";
|
||||
|
||||
// ~ Methods
|
||||
// ========================================================================================================
|
||||
|
||||
public void afterPropertiesSet() {
|
||||
Assert.hasLength(insecureKeyword, "insecureKeyword required");
|
||||
Assert.notNull(entryPoint, "entryPoint required");
|
||||
|
||||
-6
@@ -42,16 +42,10 @@ import org.springframework.util.Assert;
|
||||
*/
|
||||
public class SecureChannelProcessor implements InitializingBean, ChannelProcessor {
|
||||
|
||||
// ~ Instance fields
|
||||
// ================================================================================================
|
||||
|
||||
private ChannelEntryPoint entryPoint = new RetryWithHttpsEntryPoint();
|
||||
|
||||
private String secureKeyword = "REQUIRES_SECURE_CHANNEL";
|
||||
|
||||
// ~ Methods
|
||||
// ========================================================================================================
|
||||
|
||||
public void afterPropertiesSet() {
|
||||
Assert.hasLength(secureKeyword, "secureKeyword required");
|
||||
Assert.notNull(entryPoint, "entryPoint required");
|
||||
|
||||
-6
@@ -56,9 +56,6 @@ public class DefaultFilterInvocationSecurityMetadataSource implements FilterInvo
|
||||
|
||||
private final Map<RequestMatcher, Collection<ConfigAttribute>> requestMap;
|
||||
|
||||
// ~ Constructors
|
||||
// ===================================================================================================
|
||||
|
||||
/**
|
||||
* Sets the internal request map from the supplied map. The key elements should be of
|
||||
* type {@link RequestMatcher}, which. The path stored in the key will depend on the
|
||||
@@ -71,9 +68,6 @@ public class DefaultFilterInvocationSecurityMetadataSource implements FilterInvo
|
||||
this.requestMap = requestMap;
|
||||
}
|
||||
|
||||
// ~ Methods
|
||||
// ========================================================================================================
|
||||
|
||||
public Collection<ConfigAttribute> getAllConfigAttributes() {
|
||||
Set<ConfigAttribute> allAttributes = new HashSet<>();
|
||||
|
||||
|
||||
-9
@@ -44,21 +44,12 @@ import org.springframework.security.web.FilterInvocation;
|
||||
*/
|
||||
public class FilterSecurityInterceptor extends AbstractSecurityInterceptor implements Filter {
|
||||
|
||||
// ~ Static fields/initializers
|
||||
// =====================================================================================
|
||||
|
||||
private static final String FILTER_APPLIED = "__spring_security_filterSecurityInterceptor_filterApplied";
|
||||
|
||||
// ~ Instance fields
|
||||
// ================================================================================================
|
||||
|
||||
private FilterInvocationSecurityMetadataSource securityMetadataSource;
|
||||
|
||||
private boolean observeOncePerRequest = true;
|
||||
|
||||
// ~ Methods
|
||||
// ========================================================================================================
|
||||
|
||||
/**
|
||||
* Not used (we rely on IoC container lifecycle services instead)
|
||||
* @param arg0 ignored
|
||||
|
||||
-12
@@ -110,12 +110,6 @@ import org.springframework.web.filter.GenericFilterBean;
|
||||
public abstract class AbstractAuthenticationProcessingFilter extends GenericFilterBean
|
||||
implements ApplicationEventPublisherAware, MessageSourceAware {
|
||||
|
||||
// ~ Static fields/initializers
|
||||
// =====================================================================================
|
||||
|
||||
// ~ Instance fields
|
||||
// ================================================================================================
|
||||
|
||||
protected ApplicationEventPublisher eventPublisher;
|
||||
|
||||
protected AuthenticationDetailsSource<HttpServletRequest, ?> authenticationDetailsSource = new WebAuthenticationDetailsSource();
|
||||
@@ -138,9 +132,6 @@ public abstract class AbstractAuthenticationProcessingFilter extends GenericFilt
|
||||
|
||||
private AuthenticationFailureHandler failureHandler = new SimpleUrlAuthenticationFailureHandler();
|
||||
|
||||
// ~ Constructors
|
||||
// ===================================================================================================
|
||||
|
||||
/**
|
||||
* @param defaultFilterProcessesUrl the default value for <tt>filterProcessesUrl</tt>.
|
||||
*/
|
||||
@@ -185,9 +176,6 @@ public abstract class AbstractAuthenticationProcessingFilter extends GenericFilt
|
||||
setAuthenticationManager(authenticationManager);
|
||||
}
|
||||
|
||||
// ~ Methods
|
||||
// ========================================================================================================
|
||||
|
||||
@Override
|
||||
public void afterPropertiesSet() {
|
||||
Assert.notNull(authenticationManager, "authenticationManager must be specified");
|
||||
|
||||
-6
@@ -44,9 +44,6 @@ import org.springframework.web.filter.GenericFilterBean;
|
||||
*/
|
||||
public class AnonymousAuthenticationFilter extends GenericFilterBean implements InitializingBean {
|
||||
|
||||
// ~ Instance fields
|
||||
// ================================================================================================
|
||||
|
||||
private AuthenticationDetailsSource<HttpServletRequest, ?> authenticationDetailsSource = new WebAuthenticationDetailsSource();
|
||||
|
||||
private String key;
|
||||
@@ -78,9 +75,6 @@ public class AnonymousAuthenticationFilter extends GenericFilterBean implements
|
||||
this.authorities = authorities;
|
||||
}
|
||||
|
||||
// ~ Methods
|
||||
// ========================================================================================================
|
||||
|
||||
@Override
|
||||
public void afterPropertiesSet() {
|
||||
Assert.hasLength(key, "key must have length");
|
||||
|
||||
-9
@@ -64,14 +64,8 @@ import org.springframework.util.StringUtils;
|
||||
*/
|
||||
public class LoginUrlAuthenticationEntryPoint implements AuthenticationEntryPoint, InitializingBean {
|
||||
|
||||
// ~ Static fields/initializers
|
||||
// =====================================================================================
|
||||
|
||||
private static final Log logger = LogFactory.getLog(LoginUrlAuthenticationEntryPoint.class);
|
||||
|
||||
// ~ Instance fields
|
||||
// ================================================================================================
|
||||
|
||||
private PortMapper portMapper = new PortMapperImpl();
|
||||
|
||||
private PortResolver portResolver = new PortResolverImpl();
|
||||
@@ -94,9 +88,6 @@ public class LoginUrlAuthenticationEntryPoint implements AuthenticationEntryPoin
|
||||
this.loginFormUrl = loginFormUrl;
|
||||
}
|
||||
|
||||
// ~ Methods
|
||||
// ========================================================================================================
|
||||
|
||||
public void afterPropertiesSet() {
|
||||
Assert.isTrue(StringUtils.hasText(loginFormUrl) && UrlUtils.isValidRedirectUrl(loginFormUrl),
|
||||
"loginFormUrl must be specified and must be a valid redirect URL");
|
||||
|
||||
-3
@@ -31,9 +31,6 @@ import javax.servlet.http.HttpServletResponse;
|
||||
*/
|
||||
public class NullRememberMeServices implements RememberMeServices {
|
||||
|
||||
// ~ Methods
|
||||
// ========================================================================================================
|
||||
|
||||
public Authentication autoLogin(HttpServletRequest request, HttpServletResponse response) {
|
||||
return null;
|
||||
}
|
||||
|
||||
-3
@@ -48,9 +48,6 @@ import org.springframework.security.core.Authentication;
|
||||
*/
|
||||
public interface RememberMeServices {
|
||||
|
||||
// ~ Methods
|
||||
// ========================================================================================================
|
||||
|
||||
/**
|
||||
* This method will be called whenever the <code>SecurityContextHolder</code> does not
|
||||
* contain an <code>Authentication</code> object and Spring Security wishes to provide
|
||||
|
||||
-9
@@ -47,9 +47,6 @@ import javax.servlet.http.HttpServletResponse;
|
||||
*/
|
||||
public class UsernamePasswordAuthenticationFilter extends AbstractAuthenticationProcessingFilter {
|
||||
|
||||
// ~ Static fields/initializers
|
||||
// =====================================================================================
|
||||
|
||||
public static final String SPRING_SECURITY_FORM_USERNAME_KEY = "username";
|
||||
|
||||
public static final String SPRING_SECURITY_FORM_PASSWORD_KEY = "password";
|
||||
@@ -63,9 +60,6 @@ public class UsernamePasswordAuthenticationFilter extends AbstractAuthentication
|
||||
|
||||
private boolean postOnly = true;
|
||||
|
||||
// ~ Constructors
|
||||
// ===================================================================================================
|
||||
|
||||
public UsernamePasswordAuthenticationFilter() {
|
||||
super(DEFAULT_ANT_PATH_REQUEST_MATCHER);
|
||||
}
|
||||
@@ -74,9 +68,6 @@ public class UsernamePasswordAuthenticationFilter extends AbstractAuthentication
|
||||
super(DEFAULT_ANT_PATH_REQUEST_MATCHER, authenticationManager);
|
||||
}
|
||||
|
||||
// ~ Methods
|
||||
// ========================================================================================================
|
||||
|
||||
public Authentication attemptAuthentication(HttpServletRequest request, HttpServletResponse response)
|
||||
throws AuthenticationException {
|
||||
if (postOnly && !request.getMethod().equals("POST")) {
|
||||
|
||||
-9
@@ -32,16 +32,10 @@ public class WebAuthenticationDetails implements Serializable {
|
||||
|
||||
private static final long serialVersionUID = SpringSecurityCoreVersion.SERIAL_VERSION_UID;
|
||||
|
||||
// ~ Instance fields
|
||||
// ================================================================================================
|
||||
|
||||
private final String remoteAddress;
|
||||
|
||||
private final String sessionId;
|
||||
|
||||
// ~ Constructors
|
||||
// ===================================================================================================
|
||||
|
||||
/**
|
||||
* Records the remote address and will also set the session Id if a session already
|
||||
* exists (it won't create one).
|
||||
@@ -64,9 +58,6 @@ public class WebAuthenticationDetails implements Serializable {
|
||||
this.sessionId = sessionId;
|
||||
}
|
||||
|
||||
// ~ Methods
|
||||
// ========================================================================================================
|
||||
|
||||
@Override
|
||||
public boolean equals(Object obj) {
|
||||
if (obj instanceof WebAuthenticationDetails) {
|
||||
|
||||
-3
@@ -30,9 +30,6 @@ import javax.servlet.http.HttpServletRequest;
|
||||
public class WebAuthenticationDetailsSource
|
||||
implements AuthenticationDetailsSource<HttpServletRequest, WebAuthenticationDetails> {
|
||||
|
||||
// ~ Methods
|
||||
// ========================================================================================================
|
||||
|
||||
/**
|
||||
* @param context the {@code HttpServletRequest} object.
|
||||
* @return the {@code WebAuthenticationDetails} containing information about the
|
||||
|
||||
-9
@@ -51,18 +51,12 @@ import org.springframework.web.filter.GenericFilterBean;
|
||||
*/
|
||||
public class LogoutFilter extends GenericFilterBean {
|
||||
|
||||
// ~ Instance fields
|
||||
// ================================================================================================
|
||||
|
||||
private RequestMatcher logoutRequestMatcher;
|
||||
|
||||
private final LogoutHandler handler;
|
||||
|
||||
private final LogoutSuccessHandler logoutSuccessHandler;
|
||||
|
||||
// ~ Constructors
|
||||
// ===================================================================================================
|
||||
|
||||
/**
|
||||
* Constructor which takes a <tt>LogoutSuccessHandler</tt> instance to determine the
|
||||
* target destination after logging out. The list of <tt>LogoutHandler</tt>s are
|
||||
@@ -88,9 +82,6 @@ public class LogoutFilter extends GenericFilterBean {
|
||||
setFilterProcessesUrl("/logout");
|
||||
}
|
||||
|
||||
// ~ Methods
|
||||
// ========================================================================================================
|
||||
|
||||
public void doFilter(ServletRequest req, ServletResponse res, FilterChain chain)
|
||||
throws IOException, ServletException {
|
||||
HttpServletRequest request = (HttpServletRequest) req;
|
||||
|
||||
-3
@@ -31,9 +31,6 @@ import javax.servlet.http.HttpServletResponse;
|
||||
*/
|
||||
public interface LogoutHandler {
|
||||
|
||||
// ~ Methods
|
||||
// ========================================================================================================
|
||||
|
||||
/**
|
||||
* Causes a logout to be completed. The method must complete successfully.
|
||||
* @param request the HTTP request
|
||||
|
||||
-3
@@ -48,9 +48,6 @@ public class SecurityContextLogoutHandler implements LogoutHandler {
|
||||
|
||||
private boolean clearAuthentication = true;
|
||||
|
||||
// ~ Methods
|
||||
// ========================================================================================================
|
||||
|
||||
/**
|
||||
* Requires the request to be passed in.
|
||||
* @param request from which to obtain a HTTP session (cannot be null)
|
||||
|
||||
-2
@@ -43,8 +43,6 @@ import java.util.regex.Matcher;
|
||||
*/
|
||||
public class SubjectDnX509PrincipalExtractor implements X509PrincipalExtractor {
|
||||
|
||||
// ~ Instance fields
|
||||
// ================================================================================================
|
||||
protected final Log logger = LogFactory.getLog(getClass());
|
||||
|
||||
protected MessageSourceAccessor messages = SpringSecurityMessageSource.getAccessor();
|
||||
|
||||
-5
@@ -58,9 +58,6 @@ import org.springframework.util.StringUtils;
|
||||
*/
|
||||
public abstract class AbstractRememberMeServices implements RememberMeServices, InitializingBean, LogoutHandler {
|
||||
|
||||
// ~ Static fields/initializers
|
||||
// =====================================================================================
|
||||
|
||||
public static final String SPRING_SECURITY_REMEMBER_ME_COOKIE_KEY = "remember-me";
|
||||
|
||||
public static final String DEFAULT_PARAMETER = "remember-me";
|
||||
@@ -69,8 +66,6 @@ public abstract class AbstractRememberMeServices implements RememberMeServices,
|
||||
|
||||
private static final String DELIMITER = ":";
|
||||
|
||||
// ~ Instance fields
|
||||
// ================================================================================================
|
||||
protected final Log logger = LogFactory.getLog(getClass());
|
||||
|
||||
protected final MessageSourceAccessor messages = SpringSecurityMessageSource.getAccessor();
|
||||
|
||||
-6
@@ -30,9 +30,6 @@ import java.util.*;
|
||||
*/
|
||||
public class JdbcTokenRepositoryImpl extends JdbcDaoSupport implements PersistentTokenRepository {
|
||||
|
||||
// ~ Static fields/initializers
|
||||
// =====================================================================================
|
||||
|
||||
/** Default SQL for creating the database table to store the tokens */
|
||||
public static final String CREATE_TABLE_SQL = "create table persistent_logins (username varchar(64) not null, series varchar(64) primary key, "
|
||||
+ "token varchar(64) not null, last_used timestamp not null)";
|
||||
@@ -49,9 +46,6 @@ public class JdbcTokenRepositoryImpl extends JdbcDaoSupport implements Persisten
|
||||
/** The default SQL used by <tt>removeUserTokens</tt> */
|
||||
public static final String DEF_REMOVE_USER_TOKENS_SQL = "delete from persistent_logins where username = ?";
|
||||
|
||||
// ~ Instance fields
|
||||
// ================================================================================================
|
||||
|
||||
private String tokensBySeriesSql = DEF_TOKEN_BY_SERIES_SQL;
|
||||
|
||||
private String insertTokenSql = DEF_INSERT_TOKEN_SQL;
|
||||
|
||||
-3
@@ -26,9 +26,6 @@ import org.springframework.security.core.AuthenticationException;
|
||||
*/
|
||||
public class RememberMeAuthenticationException extends AuthenticationException {
|
||||
|
||||
// ~ Constructors
|
||||
// ===================================================================================================
|
||||
|
||||
/**
|
||||
* Constructs a {@code RememberMeAuthenticationException} with the specified message
|
||||
* and root cause.
|
||||
|
||||
-6
@@ -63,9 +63,6 @@ import org.springframework.web.filter.GenericFilterBean;
|
||||
*/
|
||||
public class RememberMeAuthenticationFilter extends GenericFilterBean implements ApplicationEventPublisherAware {
|
||||
|
||||
// ~ Instance fields
|
||||
// ================================================================================================
|
||||
|
||||
private ApplicationEventPublisher eventPublisher;
|
||||
|
||||
private AuthenticationSuccessHandler successHandler;
|
||||
@@ -82,9 +79,6 @@ public class RememberMeAuthenticationFilter extends GenericFilterBean implements
|
||||
this.rememberMeServices = rememberMeServices;
|
||||
}
|
||||
|
||||
// ~ Methods
|
||||
// ========================================================================================================
|
||||
|
||||
@Override
|
||||
public void afterPropertiesSet() {
|
||||
Assert.notNull(authenticationManager, "authenticationManager must be specified");
|
||||
|
||||
-3
@@ -87,9 +87,6 @@ public class TokenBasedRememberMeServices extends AbstractRememberMeServices {
|
||||
super(key, userDetailsService);
|
||||
}
|
||||
|
||||
// ~ Methods
|
||||
// ========================================================================================================
|
||||
|
||||
@Override
|
||||
protected UserDetails processAutoLoginCookie(String[] cookieTokens, HttpServletRequest request,
|
||||
HttpServletResponse response) {
|
||||
|
||||
-9
@@ -29,16 +29,10 @@ import org.springframework.util.Assert;
|
||||
*/
|
||||
public class SessionFixationProtectionEvent extends AbstractAuthenticationEvent {
|
||||
|
||||
// ~ Instance fields
|
||||
// ================================================================================================
|
||||
|
||||
private final String oldSessionId;
|
||||
|
||||
private final String newSessionId;
|
||||
|
||||
// ~ Constructors
|
||||
// ===================================================================================================
|
||||
|
||||
/**
|
||||
* Constructs a new session fixation protection event.
|
||||
* @param authentication The authentication object
|
||||
@@ -53,9 +47,6 @@ public class SessionFixationProtectionEvent extends AbstractAuthenticationEvent
|
||||
this.newSessionId = newSessionId;
|
||||
}
|
||||
|
||||
// ~ Methods
|
||||
// ========================================================================================================
|
||||
|
||||
/**
|
||||
* Getter for the session ID before it was changed.
|
||||
* @return the old session ID.
|
||||
|
||||
-9
@@ -27,14 +27,8 @@ import org.springframework.security.core.userdetails.UserDetails;
|
||||
*/
|
||||
public class AuthenticationSwitchUserEvent extends AbstractAuthenticationEvent {
|
||||
|
||||
// ~ Instance fields
|
||||
// ================================================================================================
|
||||
|
||||
private final UserDetails targetUser;
|
||||
|
||||
// ~ Constructors
|
||||
// ===================================================================================================
|
||||
|
||||
/**
|
||||
* Switch user context event constructor
|
||||
* @param authentication The current <code>Authentication</code> object
|
||||
@@ -45,9 +39,6 @@ public class AuthenticationSwitchUserEvent extends AbstractAuthenticationEvent {
|
||||
this.targetUser = targetUser;
|
||||
}
|
||||
|
||||
// ~ Methods
|
||||
// ========================================================================================================
|
||||
|
||||
public UserDetails getTargetUser() {
|
||||
return targetUser;
|
||||
}
|
||||
|
||||
-9
@@ -108,16 +108,10 @@ import org.springframework.web.util.UrlPathHelper;
|
||||
*/
|
||||
public class SwitchUserFilter extends GenericFilterBean implements ApplicationEventPublisherAware, MessageSourceAware {
|
||||
|
||||
// ~ Static fields/initializers
|
||||
// =====================================================================================
|
||||
|
||||
public static final String SPRING_SECURITY_SWITCH_USERNAME_KEY = "username";
|
||||
|
||||
public static final String ROLE_PREVIOUS_ADMINISTRATOR = "ROLE_PREVIOUS_ADMINISTRATOR";
|
||||
|
||||
// ~ Instance fields
|
||||
// ================================================================================================
|
||||
|
||||
private ApplicationEventPublisher eventPublisher;
|
||||
|
||||
private AuthenticationDetailsSource<HttpServletRequest, ?> authenticationDetailsSource = new WebAuthenticationDetailsSource();
|
||||
@@ -146,9 +140,6 @@ public class SwitchUserFilter extends GenericFilterBean implements ApplicationEv
|
||||
|
||||
private AuthenticationFailureHandler failureHandler;
|
||||
|
||||
// ~ Methods
|
||||
// ========================================================================================================
|
||||
|
||||
@Override
|
||||
public void afterPropertiesSet() {
|
||||
Assert.notNull(this.userDetailsService, "userDetailsService must be specified");
|
||||
|
||||
-8
@@ -35,15 +35,10 @@ public final class SwitchUserGrantedAuthority implements GrantedAuthority {
|
||||
|
||||
private static final long serialVersionUID = SpringSecurityCoreVersion.SERIAL_VERSION_UID;
|
||||
|
||||
// ~ Instance fields
|
||||
// ================================================================================================
|
||||
private final String role;
|
||||
|
||||
private final Authentication source;
|
||||
|
||||
// ~ Constructors
|
||||
// ===================================================================================================
|
||||
|
||||
public SwitchUserGrantedAuthority(String role, Authentication source) {
|
||||
Assert.notNull(role, "role cannot be null");
|
||||
Assert.notNull(source, "source cannot be null");
|
||||
@@ -51,9 +46,6 @@ public final class SwitchUserGrantedAuthority implements GrantedAuthority {
|
||||
this.source = source;
|
||||
}
|
||||
|
||||
// ~ Methods
|
||||
// ========================================================================================================
|
||||
|
||||
/**
|
||||
* Returns the original user associated with a successful user switch.
|
||||
* @return The original <code>Authentication</code> object of the switched user.
|
||||
|
||||
-6
@@ -42,14 +42,8 @@ import org.springframework.util.Assert;
|
||||
*/
|
||||
public class BasicAuthenticationEntryPoint implements AuthenticationEntryPoint, InitializingBean {
|
||||
|
||||
// ~ Instance fields
|
||||
// ================================================================================================
|
||||
|
||||
private String realmName;
|
||||
|
||||
// ~ Methods
|
||||
// ========================================================================================================
|
||||
|
||||
public void afterPropertiesSet() {
|
||||
Assert.hasText(realmName, "realmName must be specified");
|
||||
}
|
||||
|
||||
-6
@@ -89,9 +89,6 @@ import org.springframework.web.filter.OncePerRequestFilter;
|
||||
*/
|
||||
public class BasicAuthenticationFilter extends OncePerRequestFilter {
|
||||
|
||||
// ~ Instance fields
|
||||
// ================================================================================================
|
||||
|
||||
private AuthenticationEntryPoint authenticationEntryPoint;
|
||||
|
||||
private AuthenticationManager authenticationManager;
|
||||
@@ -132,9 +129,6 @@ public class BasicAuthenticationFilter extends OncePerRequestFilter {
|
||||
this.authenticationEntryPoint = authenticationEntryPoint;
|
||||
}
|
||||
|
||||
// ~ Methods
|
||||
// ========================================================================================================
|
||||
|
||||
@Override
|
||||
public void afterPropertiesSet() {
|
||||
Assert.notNull(this.authenticationManager, "An AuthenticationManager is required");
|
||||
|
||||
-9
@@ -46,14 +46,8 @@ import org.springframework.security.web.AuthenticationEntryPoint;
|
||||
*/
|
||||
public class DigestAuthenticationEntryPoint implements AuthenticationEntryPoint, InitializingBean, Ordered {
|
||||
|
||||
// ~ Static fields/initializers
|
||||
// =====================================================================================
|
||||
|
||||
private static final Log logger = LogFactory.getLog(DigestAuthenticationEntryPoint.class);
|
||||
|
||||
// ~ Instance fields
|
||||
// ================================================================================================
|
||||
|
||||
private String key;
|
||||
|
||||
private String realmName;
|
||||
@@ -62,9 +56,6 @@ public class DigestAuthenticationEntryPoint implements AuthenticationEntryPoint,
|
||||
|
||||
private int order = Integer.MAX_VALUE; // ~ default
|
||||
|
||||
// ~ Methods
|
||||
// ========================================================================================================
|
||||
|
||||
public int getOrder() {
|
||||
return order;
|
||||
}
|
||||
|
||||
-9
@@ -89,14 +89,8 @@ import org.springframework.web.filter.GenericFilterBean;
|
||||
*/
|
||||
public class DigestAuthenticationFilter extends GenericFilterBean implements MessageSourceAware {
|
||||
|
||||
// ~ Static fields/initializers
|
||||
// =====================================================================================
|
||||
|
||||
private static final Log logger = LogFactory.getLog(DigestAuthenticationFilter.class);
|
||||
|
||||
// ~ Instance fields
|
||||
// ================================================================================================
|
||||
|
||||
private AuthenticationDetailsSource<HttpServletRequest, ?> authenticationDetailsSource = new WebAuthenticationDetailsSource();
|
||||
|
||||
private DigestAuthenticationEntryPoint authenticationEntryPoint;
|
||||
@@ -111,9 +105,6 @@ public class DigestAuthenticationFilter extends GenericFilterBean implements Mes
|
||||
|
||||
private boolean createAuthenticatedToken = false;
|
||||
|
||||
// ~ Methods
|
||||
// ========================================================================================================
|
||||
|
||||
@Override
|
||||
public void afterPropertiesSet() {
|
||||
Assert.notNull(this.userDetailsService, "A UserDetailsService is required");
|
||||
|
||||
-3
@@ -25,9 +25,6 @@ import org.springframework.security.core.AuthenticationException;
|
||||
*/
|
||||
public class NonceExpiredException extends AuthenticationException {
|
||||
|
||||
// ~ Constructors
|
||||
// ===================================================================================================
|
||||
|
||||
/**
|
||||
* Constructs a <code>NonceExpiredException</code> with the specified message.
|
||||
* @param msg the detail message
|
||||
|
||||
-3
@@ -253,9 +253,6 @@ public class HttpSessionSecurityContextRepository implements SecurityContextRepo
|
||||
this.springSecurityContextKey = springSecurityContextKey;
|
||||
}
|
||||
|
||||
// ~ Inner Classes
|
||||
// ==================================================================================================
|
||||
|
||||
private static class SaveToSessionRequestWrapper extends HttpServletRequestWrapper {
|
||||
|
||||
private final SaveContextOnUpdateOrErrorResponseWrapper response;
|
||||
|
||||
-3
@@ -30,9 +30,6 @@ import javax.servlet.http.HttpServletResponse;
|
||||
*/
|
||||
public interface RequestRejectedHandler {
|
||||
|
||||
// ~ Methods
|
||||
// ========================================================================================================
|
||||
|
||||
/**
|
||||
* Handles an request rejected failure.
|
||||
* @param request that resulted in an <code>RequestRejectedException</code>
|
||||
|
||||
-6
@@ -49,14 +49,8 @@ import org.springframework.web.filter.GenericFilterBean;
|
||||
*/
|
||||
public class JaasApiIntegrationFilter extends GenericFilterBean {
|
||||
|
||||
// ~ Instance fields
|
||||
// ================================================================================================
|
||||
|
||||
private boolean createEmptySubject;
|
||||
|
||||
// ~ Methods
|
||||
// ========================================================================================================
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* Attempts to obtain and run as a JAAS <code>Subject</code> using
|
||||
|
||||
-12
@@ -52,18 +52,12 @@ import java.util.*;
|
||||
*/
|
||||
public class DefaultSavedRequest implements SavedRequest {
|
||||
|
||||
// ~ Static fields/initializers
|
||||
// =====================================================================================
|
||||
|
||||
protected static final Log logger = LogFactory.getLog(DefaultSavedRequest.class);
|
||||
|
||||
private static final String HEADER_IF_NONE_MATCH = "If-None-Match";
|
||||
|
||||
private static final String HEADER_IF_MODIFIED_SINCE = "If-Modified-Since";
|
||||
|
||||
// ~ Instance fields
|
||||
// ================================================================================================
|
||||
|
||||
private final ArrayList<SavedCookie> cookies = new ArrayList<>();
|
||||
|
||||
private final ArrayList<Locale> locales = new ArrayList<>();
|
||||
@@ -92,9 +86,6 @@ public class DefaultSavedRequest implements SavedRequest {
|
||||
|
||||
private final int serverPort;
|
||||
|
||||
// ~ Constructors
|
||||
// ===================================================================================================
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
public DefaultSavedRequest(HttpServletRequest request, PortResolver portResolver) {
|
||||
Assert.notNull(request, "Request required");
|
||||
@@ -154,9 +145,6 @@ public class DefaultSavedRequest implements SavedRequest {
|
||||
this.serverPort = builder.serverPort;
|
||||
}
|
||||
|
||||
// ~ Methods
|
||||
// ========================================================================================================
|
||||
|
||||
/**
|
||||
* @since 4.2
|
||||
*/
|
||||
|
||||
@@ -41,18 +41,12 @@ import java.util.NoSuchElementException;
|
||||
*/
|
||||
public class Enumerator<T> implements Enumeration<T> {
|
||||
|
||||
// ~ Instance fields
|
||||
// ================================================================================================
|
||||
|
||||
/**
|
||||
* The <code>Iterator</code> over which the <code>Enumeration</code> represented by
|
||||
* this class actually operates.
|
||||
*/
|
||||
private Iterator<T> iterator = null;
|
||||
|
||||
// ~ Constructors
|
||||
// ===================================================================================================
|
||||
|
||||
/**
|
||||
* Return an Enumeration over the values of the specified Collection.
|
||||
* @param collection Collection whose values should be enumerated
|
||||
@@ -116,9 +110,6 @@ public class Enumerator<T> implements Enumeration<T> {
|
||||
this(map.values().iterator(), clone);
|
||||
}
|
||||
|
||||
// ~ Methods
|
||||
// ========================================================================================================
|
||||
|
||||
/**
|
||||
* Tests if this enumeration contains more elements.
|
||||
* @return <code>true</code> if and only if this enumeration object contains at least
|
||||
|
||||
-6
@@ -35,9 +35,6 @@ import java.util.TimeZone;
|
||||
*/
|
||||
public class FastHttpDateFormat {
|
||||
|
||||
// ~ Static fields/initializers
|
||||
// =====================================================================================
|
||||
|
||||
/** HTTP date format. */
|
||||
protected static final SimpleDateFormat format = new SimpleDateFormat("EEE, dd MMM yyyy HH:mm:ss zzz", Locale.US);
|
||||
|
||||
@@ -70,9 +67,6 @@ public class FastHttpDateFormat {
|
||||
/** Parser cache. */
|
||||
protected static final HashMap<String, Long> parseCache = new HashMap<>();
|
||||
|
||||
// ~ Methods
|
||||
// ========================================================================================================
|
||||
|
||||
/**
|
||||
* Formats a specified date to HTTP format. If local format is not <code>null</code>,
|
||||
* it's used instead.
|
||||
|
||||
-12
@@ -54,9 +54,6 @@ import org.apache.commons.logging.LogFactory;
|
||||
*/
|
||||
class SavedRequestAwareWrapper extends HttpServletRequestWrapper {
|
||||
|
||||
// ~ Static fields/initializers
|
||||
// =====================================================================================
|
||||
|
||||
protected static final Log logger = LogFactory.getLog(SavedRequestAwareWrapper.class);
|
||||
|
||||
protected static final TimeZone GMT_ZONE = TimeZone.getTimeZone("GMT");
|
||||
@@ -64,9 +61,6 @@ class SavedRequestAwareWrapper extends HttpServletRequestWrapper {
|
||||
/** The default Locale if none are specified. */
|
||||
protected static Locale defaultLocale = Locale.getDefault();
|
||||
|
||||
// ~ Instance fields
|
||||
// ================================================================================================
|
||||
|
||||
protected SavedRequest savedRequest = null;
|
||||
|
||||
/**
|
||||
@@ -76,9 +70,6 @@ class SavedRequestAwareWrapper extends HttpServletRequestWrapper {
|
||||
*/
|
||||
protected final SimpleDateFormat[] formats = new SimpleDateFormat[3];
|
||||
|
||||
// ~ Constructors
|
||||
// ===================================================================================================
|
||||
|
||||
SavedRequestAwareWrapper(SavedRequest saved, HttpServletRequest request) {
|
||||
super(request);
|
||||
savedRequest = saved;
|
||||
@@ -92,9 +83,6 @@ class SavedRequestAwareWrapper extends HttpServletRequestWrapper {
|
||||
formats[2].setTimeZone(GMT_ZONE);
|
||||
}
|
||||
|
||||
// ~ Methods
|
||||
// ========================================================================================================
|
||||
|
||||
@Override
|
||||
public long getDateHeader(String name) {
|
||||
String value = getHeader(name);
|
||||
|
||||
-6
@@ -68,9 +68,6 @@ import org.springframework.web.filter.GenericFilterBean;
|
||||
*/
|
||||
public class SecurityContextHolderAwareRequestFilter extends GenericFilterBean {
|
||||
|
||||
// ~ Instance fields
|
||||
// ================================================================================================
|
||||
|
||||
private String rolePrefix = "ROLE_";
|
||||
|
||||
private HttpServletRequestFactory requestFactory;
|
||||
@@ -83,9 +80,6 @@ public class SecurityContextHolderAwareRequestFilter extends GenericFilterBean {
|
||||
|
||||
private AuthenticationTrustResolver trustResolver = new AuthenticationTrustResolverImpl();
|
||||
|
||||
// ~ Methods
|
||||
// ========================================================================================================
|
||||
|
||||
public void setRolePrefix(String rolePrefix) {
|
||||
Assert.notNull(rolePrefix, "Role prefix must not be null");
|
||||
this.rolePrefix = rolePrefix;
|
||||
|
||||
-9
@@ -49,9 +49,6 @@ import org.springframework.util.Assert;
|
||||
*/
|
||||
public class SecurityContextHolderAwareRequestWrapper extends HttpServletRequestWrapper {
|
||||
|
||||
// ~ Instance fields
|
||||
// ================================================================================================
|
||||
|
||||
private final AuthenticationTrustResolver trustResolver;
|
||||
|
||||
/**
|
||||
@@ -60,9 +57,6 @@ public class SecurityContextHolderAwareRequestWrapper extends HttpServletRequest
|
||||
*/
|
||||
private final String rolePrefix;
|
||||
|
||||
// ~ Constructors
|
||||
// ===================================================================================================
|
||||
|
||||
/**
|
||||
* Creates a new instance with {@link AuthenticationTrustResolverImpl}.
|
||||
* @param request
|
||||
@@ -88,9 +82,6 @@ public class SecurityContextHolderAwareRequestWrapper extends HttpServletRequest
|
||||
this.trustResolver = trustResolver;
|
||||
}
|
||||
|
||||
// ~ Methods
|
||||
// ========================================================================================================
|
||||
|
||||
/**
|
||||
* Obtain the current active <code>Authentication</code>
|
||||
* @return the authentication object or <code>null</code>
|
||||
|
||||
-6
@@ -66,9 +66,6 @@ import org.springframework.web.filter.GenericFilterBean;
|
||||
*/
|
||||
public class ConcurrentSessionFilter extends GenericFilterBean {
|
||||
|
||||
// ~ Instance fields
|
||||
// ================================================================================================
|
||||
|
||||
private final SessionRegistry sessionRegistry;
|
||||
|
||||
private String expiredUrl;
|
||||
@@ -79,9 +76,6 @@ public class ConcurrentSessionFilter extends GenericFilterBean {
|
||||
|
||||
private SessionInformationExpiredStrategy sessionInformationExpiredStrategy;
|
||||
|
||||
// ~ Methods
|
||||
// ========================================================================================================
|
||||
|
||||
public ConcurrentSessionFilter(SessionRegistry sessionRegistry) {
|
||||
Assert.notNull(sessionRegistry, "SessionRegistry required");
|
||||
this.sessionRegistry = sessionRegistry;
|
||||
|
||||
-3
@@ -29,9 +29,6 @@ import org.springframework.security.core.session.SessionCreationEvent;
|
||||
*/
|
||||
public class HttpSessionCreatedEvent extends SessionCreationEvent {
|
||||
|
||||
// ~ Constructors
|
||||
// ===================================================================================================
|
||||
|
||||
public HttpSessionCreatedEvent(HttpSession session) {
|
||||
super(session);
|
||||
}
|
||||
|
||||
-3
@@ -33,9 +33,6 @@ import java.util.*;
|
||||
*/
|
||||
public class HttpSessionDestroyedEvent extends SessionDestroyedEvent {
|
||||
|
||||
// ~ Constructors
|
||||
// ===================================================================================================
|
||||
|
||||
public HttpSessionDestroyedEvent(HttpSession session) {
|
||||
super(session);
|
||||
}
|
||||
|
||||
-6
@@ -46,14 +46,8 @@ import javax.servlet.http.HttpSessionListener;
|
||||
*/
|
||||
public class HttpSessionEventPublisher implements HttpSessionListener, HttpSessionIdListener {
|
||||
|
||||
// ~ Static fields/initializers
|
||||
// =====================================================================================
|
||||
|
||||
private static final String LOGGER_NAME = HttpSessionEventPublisher.class.getName();
|
||||
|
||||
// ~ Methods
|
||||
// ========================================================================================================
|
||||
|
||||
ApplicationContext getContext(ServletContext servletContext) {
|
||||
return SecurityWebApplicationContextUtils.findRequiredWebApplicationContext(servletContext);
|
||||
}
|
||||
|
||||
-6
@@ -49,14 +49,8 @@ import org.springframework.web.filter.GenericFilterBean;
|
||||
*/
|
||||
public class SessionManagementFilter extends GenericFilterBean {
|
||||
|
||||
// ~ Static fields/initializers
|
||||
// =====================================================================================
|
||||
|
||||
static final String FILTER_APPLIED = "__spring_security_session_mgmt_filter_applied";
|
||||
|
||||
// ~ Instance fields
|
||||
// ================================================================================================
|
||||
|
||||
private final SecurityContextRepository securityContextRepository;
|
||||
|
||||
private SessionAuthenticationStrategy sessionAuthenticationStrategy;
|
||||
|
||||
@@ -30,9 +30,6 @@ import javax.servlet.http.HttpServletRequest;
|
||||
*/
|
||||
public final class UrlUtils {
|
||||
|
||||
// ~ Methods
|
||||
// ========================================================================================================
|
||||
|
||||
public static String buildFullRequestUrl(HttpServletRequest r) {
|
||||
return buildFullRequestUrl(r.getScheme(), r.getServerName(), r.getServerPort(), r.getRequestURI(),
|
||||
r.getQueryString());
|
||||
|
||||
@@ -29,13 +29,8 @@ import javax.servlet.ServletContext;
|
||||
@SuppressWarnings("unchecked")
|
||||
public class MockFilterConfig implements FilterConfig {
|
||||
|
||||
// ~ Instance fields
|
||||
// ================================================================================================
|
||||
private Map map = new HashMap();
|
||||
|
||||
// ~ Methods
|
||||
// ========================================================================================================
|
||||
|
||||
public String getFilterName() {
|
||||
throw new UnsupportedOperationException("mock method not implemented");
|
||||
}
|
||||
|
||||
@@ -27,24 +27,15 @@ import javax.servlet.ServletRequest;
|
||||
*/
|
||||
public class MockPortResolver implements PortResolver {
|
||||
|
||||
// ~ Instance fields
|
||||
// ================================================================================================
|
||||
|
||||
private int http = 80;
|
||||
|
||||
private int https = 443;
|
||||
|
||||
// ~ Constructors
|
||||
// ===================================================================================================
|
||||
|
||||
public MockPortResolver(int http, int https) {
|
||||
this.http = http;
|
||||
this.https = https;
|
||||
}
|
||||
|
||||
// ~ Methods
|
||||
// ========================================================================================================
|
||||
|
||||
public int getServerPort(ServletRequest request) {
|
||||
if ((request.getScheme() != null) && request.getScheme().equals("https")) {
|
||||
return https;
|
||||
|
||||
@@ -37,9 +37,6 @@ import org.springframework.security.web.util.UrlUtils;
|
||||
*/
|
||||
public class FilterInvocationTests {
|
||||
|
||||
// ~ Methods
|
||||
// ========================================================================================================
|
||||
|
||||
@Test
|
||||
public void testGettersAndStringMethods() {
|
||||
MockHttpServletRequest request = new MockHttpServletRequest(null, null);
|
||||
|
||||
@@ -31,8 +31,6 @@ import org.junit.Test;
|
||||
*/
|
||||
public class PortMapperImplTests {
|
||||
|
||||
// ~ Methods
|
||||
// ========================================================================================================
|
||||
@Test
|
||||
public void testDefaultMappingsAreKnown() {
|
||||
PortMapperImpl portMapper = new PortMapperImpl();
|
||||
|
||||
@@ -29,8 +29,6 @@ import org.springframework.mock.web.MockHttpServletRequest;
|
||||
*/
|
||||
public class PortResolverImplTests {
|
||||
|
||||
// ~ Methods
|
||||
// ========================================================================================================
|
||||
@Test
|
||||
public void testDetectsBuggyIeHttpRequest() {
|
||||
PortResolverImpl pr = new PortResolverImpl();
|
||||
|
||||
-3
@@ -48,9 +48,6 @@ public class DefaultWebInvocationPrivilegeEvaluatorTests {
|
||||
|
||||
private FilterSecurityInterceptor interceptor;
|
||||
|
||||
// ~ Methods
|
||||
// ========================================================================================================
|
||||
|
||||
@Before
|
||||
public final void setUp() {
|
||||
interceptor = new FilterSecurityInterceptor();
|
||||
|
||||
-5
@@ -44,8 +44,6 @@ import static org.mockito.Mockito.mock;
|
||||
@SuppressWarnings("unchecked")
|
||||
public class ChannelDecisionManagerImplTests {
|
||||
|
||||
// ~ Methods
|
||||
// ========================================================================================================
|
||||
@Test
|
||||
public void testCannotSetEmptyChannelProcessorsList() throws Exception {
|
||||
ChannelDecisionManagerImpl cdm = new ChannelDecisionManagerImpl();
|
||||
@@ -190,9 +188,6 @@ public class ChannelDecisionManagerImplTests {
|
||||
}
|
||||
}
|
||||
|
||||
// ~ Inner Classes
|
||||
// ==================================================================================================
|
||||
|
||||
private class MockChannelProcessor implements ChannelProcessor {
|
||||
|
||||
private String configAttribute;
|
||||
|
||||
-6
@@ -39,9 +39,6 @@ import org.springframework.security.web.access.intercept.FilterInvocationSecurit
|
||||
*/
|
||||
public class ChannelProcessingFilterTests {
|
||||
|
||||
// ~ Methods
|
||||
// ========================================================================================================
|
||||
|
||||
@Test(expected = IllegalArgumentException.class)
|
||||
public void testDetectsMissingChannelDecisionManager() {
|
||||
ChannelProcessingFilter filter = new ChannelProcessingFilter();
|
||||
@@ -152,9 +149,6 @@ public class ChannelProcessingFilterTests {
|
||||
filter.afterPropertiesSet();
|
||||
}
|
||||
|
||||
// ~ Inner Classes
|
||||
// ==================================================================================================
|
||||
|
||||
private class MockChannelDecisionManager implements ChannelDecisionManager {
|
||||
|
||||
private String supportAttribute;
|
||||
|
||||
-2
@@ -40,8 +40,6 @@ import static org.mockito.Mockito.mock;
|
||||
*/
|
||||
public class RetryWithHttpEntryPointTests {
|
||||
|
||||
// ~ Methods
|
||||
// ========================================================================================================
|
||||
@Test
|
||||
public void testDetectsMissingPortMapper() {
|
||||
RetryWithHttpEntryPoint ep = new RetryWithHttpEntryPoint();
|
||||
|
||||
-2
@@ -36,8 +36,6 @@ import java.util.Map;
|
||||
*/
|
||||
public class RetryWithHttpsEntryPointTests {
|
||||
|
||||
// ~ Methods
|
||||
// ========================================================================================================
|
||||
@Test
|
||||
public void testDetectsMissingPortMapper() {
|
||||
RetryWithHttpsEntryPoint ep = new RetryWithHttpsEntryPoint();
|
||||
|
||||
-2
@@ -35,8 +35,6 @@ import org.springframework.security.web.access.channel.SecureChannelProcessor;
|
||||
*/
|
||||
public class SecureChannelProcessorTests {
|
||||
|
||||
// ~ Methods
|
||||
// ========================================================================================================
|
||||
@Test
|
||||
public void testDecideDetectsAcceptableChannel() throws Exception {
|
||||
MockHttpServletRequest request = new MockHttpServletRequest();
|
||||
|
||||
-2
@@ -45,8 +45,6 @@ public class DefaultFilterInvocationSecurityMetadataSourceTests {
|
||||
|
||||
private Collection<ConfigAttribute> def = SecurityConfig.createList("ROLE_ONE");
|
||||
|
||||
// ~ Methods
|
||||
// ========================================================================================================
|
||||
private void createFids(String pattern, String method) {
|
||||
LinkedHashMap<RequestMatcher, Collection<ConfigAttribute>> requestMap = new LinkedHashMap<>();
|
||||
requestMap.put(new AntPathRequestMatcher(pattern, method), this.def);
|
||||
|
||||
-3
@@ -62,9 +62,6 @@ public class FilterSecurityInterceptorTests {
|
||||
|
||||
private ApplicationEventPublisher publisher;
|
||||
|
||||
// ~ Methods
|
||||
// ========================================================================================================
|
||||
|
||||
@Before
|
||||
public final void setUp() {
|
||||
interceptor = new FilterSecurityInterceptor();
|
||||
|
||||
-6
@@ -68,9 +68,6 @@ public class AbstractAuthenticationProcessingFilterTests {
|
||||
|
||||
SimpleUrlAuthenticationFailureHandler failureHandler;
|
||||
|
||||
// ~ Methods
|
||||
// ========================================================================================================
|
||||
|
||||
private MockHttpServletRequest createMockAuthenticationRequest() {
|
||||
MockHttpServletRequest request = new MockHttpServletRequest();
|
||||
|
||||
@@ -476,9 +473,6 @@ public class AbstractAuthenticationProcessingFilterTests {
|
||||
filter.setRememberMeServices(null);
|
||||
}
|
||||
|
||||
// ~ Inner Classes
|
||||
// ==================================================================================================
|
||||
|
||||
private class MockAuthenticationFilter extends AbstractAuthenticationProcessingFilter {
|
||||
|
||||
private static final String DEFAULT_FILTER_PROCESSING_URL = "/j_mock_post";
|
||||
|
||||
-6
@@ -48,9 +48,6 @@ import static org.mockito.Mockito.mock;
|
||||
*/
|
||||
public class AnonymousAuthenticationFilterTests {
|
||||
|
||||
// ~ Methods
|
||||
// ========================================================================================================
|
||||
|
||||
private void executeFilterInContainerSimulator(FilterConfig filterConfig, Filter filter, ServletRequest request,
|
||||
ServletResponse response, FilterChain filterChain) throws ServletException, IOException {
|
||||
filter.doFilter(request, response, filterChain);
|
||||
@@ -109,9 +106,6 @@ public class AnonymousAuthenticationFilterTests {
|
||||
// again
|
||||
}
|
||||
|
||||
// ~ Inner Classes
|
||||
// ==================================================================================================
|
||||
|
||||
private class MockFilterChain implements FilterChain {
|
||||
|
||||
private boolean expectToProceed;
|
||||
|
||||
-3
@@ -34,9 +34,6 @@ import org.springframework.security.web.PortMapperImpl;
|
||||
*/
|
||||
public class LoginUrlAuthenticationEntryPointTests {
|
||||
|
||||
// ~ Methods
|
||||
// ========================================================================================================
|
||||
|
||||
@Test(expected = IllegalArgumentException.class)
|
||||
public void testDetectsMissingLoginFormUrl() {
|
||||
new LoginUrlAuthenticationEntryPoint(null);
|
||||
|
||||
-3
@@ -35,9 +35,6 @@ import org.springframework.security.core.AuthenticationException;
|
||||
*/
|
||||
public class UsernamePasswordAuthenticationFilterTests {
|
||||
|
||||
// ~ Methods
|
||||
// ========================================================================================================
|
||||
|
||||
@Test
|
||||
public void testNormalOperation() {
|
||||
MockHttpServletRequest request = new MockHttpServletRequest("POST", "/");
|
||||
|
||||
-3
@@ -27,9 +27,6 @@ import java.security.cert.X509Certificate;
|
||||
*/
|
||||
public class X509TestUtils {
|
||||
|
||||
// ~ Methods
|
||||
// ========================================================================================================
|
||||
|
||||
/**
|
||||
* Builds an X.509 certificate. In human-readable form it is:
|
||||
*
|
||||
|
||||
-3
@@ -482,9 +482,6 @@ public class AbstractRememberMeServicesTests {
|
||||
assertThat(returnedCookie.getMaxAge()).isZero();
|
||||
}
|
||||
|
||||
// ~ Inner Classes
|
||||
// ==================================================================================================
|
||||
|
||||
static class MockRememberMeServices extends AbstractRememberMeServices {
|
||||
|
||||
boolean loginSuccessCalled;
|
||||
|
||||
-2
@@ -28,8 +28,6 @@ import org.springframework.security.web.authentication.NullRememberMeServices;
|
||||
*/
|
||||
public class NullRememberMeServicesTests {
|
||||
|
||||
// ~ Methods
|
||||
// ========================================================================================================
|
||||
@Test
|
||||
public void testAlwaysReturnsNull() {
|
||||
NullRememberMeServices services = new NullRememberMeServices();
|
||||
|
||||
-6
@@ -46,9 +46,6 @@ public class RememberMeAuthenticationFilterTests {
|
||||
|
||||
Authentication remembered = new TestingAuthenticationToken("remembered", "password", "ROLE_REMEMBERED");
|
||||
|
||||
// ~ Methods
|
||||
// ========================================================================================================
|
||||
|
||||
@Before
|
||||
public void setUp() {
|
||||
SecurityContextHolder.clearContext();
|
||||
@@ -155,9 +152,6 @@ public class RememberMeAuthenticationFilterTests {
|
||||
verifyZeroInteractions(fc);
|
||||
}
|
||||
|
||||
// ~ Inner Classes
|
||||
// ==================================================================================================
|
||||
|
||||
private class MockRememberMeServices implements RememberMeServices {
|
||||
|
||||
private Authentication authToReturn;
|
||||
|
||||
-3
@@ -54,9 +54,6 @@ public class TokenBasedRememberMeServicesTests {
|
||||
|
||||
private TokenBasedRememberMeServices services;
|
||||
|
||||
// ~ Methods
|
||||
// ========================================================================================================
|
||||
|
||||
@Before
|
||||
public void createTokenBasedRememberMeServices() {
|
||||
uds = mock(UserDetailsService.class);
|
||||
|
||||
-2
@@ -547,8 +547,6 @@ public class SwitchUserFilterTests {
|
||||
SwitchUserFilter filter = new SwitchUserFilter();
|
||||
filter.setSwitchFailureUrl("/foo");
|
||||
}
|
||||
// ~ Inner Classes
|
||||
// ==================================================================================================
|
||||
|
||||
private class MockUserDetailsService implements UserDetailsService {
|
||||
|
||||
|
||||
-6
@@ -50,16 +50,10 @@ import java.nio.charset.StandardCharsets;
|
||||
*/
|
||||
public class BasicAuthenticationFilterTests {
|
||||
|
||||
// ~ Instance fields
|
||||
// ================================================================================================
|
||||
|
||||
private BasicAuthenticationFilter filter;
|
||||
|
||||
private AuthenticationManager manager;
|
||||
|
||||
// ~ Methods
|
||||
// ========================================================================================================
|
||||
|
||||
@Before
|
||||
public void setUp() {
|
||||
SecurityContextHolder.clearContext();
|
||||
|
||||
-5
@@ -31,11 +31,6 @@ import org.springframework.util.StringUtils;
|
||||
*/
|
||||
public class DigestAuthUtilsTests {
|
||||
|
||||
// ~ Constructors
|
||||
// ===================================================================================================
|
||||
|
||||
// ~ Methods
|
||||
// ========================================================================================================
|
||||
@Test
|
||||
public void testSplitEachArrayElementAndCreateMapNormalOperation() {
|
||||
// note it ignores malformed entries (ie those without an equals sign)
|
||||
|
||||
-3
@@ -37,9 +37,6 @@ import static org.assertj.core.api.Assertions.fail;
|
||||
*/
|
||||
public class DigestAuthenticationEntryPointTests {
|
||||
|
||||
// ~ Methods
|
||||
// ========================================================================================================
|
||||
|
||||
private void checkNonceValid(String nonce) {
|
||||
// Check the nonce seems to be generated correctly
|
||||
// format of nonce is:
|
||||
|
||||
-9
@@ -54,9 +54,6 @@ import static org.mockito.Mockito.verify;
|
||||
*/
|
||||
public class DigestAuthenticationFilterTests {
|
||||
|
||||
// ~ Static fields/initializers
|
||||
// =====================================================================================
|
||||
|
||||
private static final String NC = "00000002";
|
||||
|
||||
private static final String CNONCE = "c822c727a648aba7";
|
||||
@@ -78,17 +75,11 @@ public class DigestAuthenticationFilterTests {
|
||||
*/
|
||||
private static final String NONCE = generateNonce(60);
|
||||
|
||||
// ~ Instance fields
|
||||
// ================================================================================================
|
||||
|
||||
// private ApplicationContext ctx;
|
||||
private DigestAuthenticationFilter filter;
|
||||
|
||||
private MockHttpServletRequest request;
|
||||
|
||||
// ~ Methods
|
||||
// ========================================================================================================
|
||||
|
||||
private String createAuthorizationHeader(String username, String realm, String nonce, String uri,
|
||||
String responseDigest, String qop, String nc, String cnonce) {
|
||||
return "Digest username=\"" + username + "\", realm=\"" + realm + "\", nonce=\"" + nonce + "\", uri=\"" + uri
|
||||
|
||||
-8
@@ -57,8 +57,6 @@ import org.springframework.security.core.context.SecurityContextHolder;
|
||||
*/
|
||||
public class JaasApiIntegrationFilterTests {
|
||||
|
||||
// ~ Instance fields
|
||||
// ================================================================================================
|
||||
private JaasApiIntegrationFilter filter;
|
||||
|
||||
private MockHttpServletRequest request;
|
||||
@@ -73,9 +71,6 @@ public class JaasApiIntegrationFilterTests {
|
||||
|
||||
private CallbackHandler callbackHandler;
|
||||
|
||||
// ~ Methods
|
||||
// ========================================================================================================
|
||||
|
||||
@Before
|
||||
public void onBeforeTests() throws Exception {
|
||||
this.filter = new JaasApiIntegrationFilter();
|
||||
@@ -193,9 +188,6 @@ public class JaasApiIntegrationFilterTests {
|
||||
assertJaasSubjectEquals(new Subject());
|
||||
}
|
||||
|
||||
// ~ Helper Methods
|
||||
// ====================================================================================================
|
||||
|
||||
private void assertJaasSubjectEquals(final Subject expectedValue) throws Exception {
|
||||
MockFilterChain chain = new MockFilterChain() {
|
||||
|
||||
|
||||
-3
@@ -113,9 +113,6 @@ public class SecurityContextHolderAwareRequestFilterTests {
|
||||
SecurityContextHolder.clearContext();
|
||||
}
|
||||
|
||||
// ~ Methods
|
||||
// ========================================================================================================
|
||||
|
||||
@Test
|
||||
public void expectedRequestWrapperClassIsUsed() throws Exception {
|
||||
this.filter.setRolePrefix("ROLE_");
|
||||
|
||||
-3
@@ -33,9 +33,6 @@ import org.springframework.web.context.support.StaticWebApplicationContext;
|
||||
*/
|
||||
public class HttpSessionEventPublisherTests {
|
||||
|
||||
// ~ Methods
|
||||
// ========================================================================================================
|
||||
|
||||
/**
|
||||
* It's not that complicated so we'll just run it straight through here.
|
||||
*/
|
||||
|
||||
-6
@@ -28,18 +28,12 @@ import org.springframework.security.web.session.HttpSessionDestroyedEvent;
|
||||
*/
|
||||
public class MockApplicationListener implements ApplicationListener<ApplicationEvent> {
|
||||
|
||||
// ~ Instance fields
|
||||
// ================================================================================================
|
||||
|
||||
private HttpSessionCreatedEvent createdEvent;
|
||||
|
||||
private HttpSessionDestroyedEvent destroyedEvent;
|
||||
|
||||
private HttpSessionIdChangedEvent sessionIdChangedEvent;
|
||||
|
||||
// ~ Methods
|
||||
// ========================================================================================================
|
||||
|
||||
public HttpSessionCreatedEvent getCreatedEvent() {
|
||||
return createdEvent;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user