1
0
mirror of synced 2026-08-04 17:27:13 +00:00

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:
Phillip Webb
2020-07-23 15:09:07 -07:00
committed by Rob Winch
parent b7fc18262d
commit 71bc145ae4
406 changed files with 12 additions and 2190 deletions
@@ -34,9 +34,6 @@ public class ServiceProperties implements InitializingBean {
public static final String DEFAULT_CAS_SERVICE_PARAMETER = "service";
// ~ Instance fields
// ================================================================================================
private String service;
private boolean authenticateAllArtifacts;
@@ -47,9 +44,6 @@ public class ServiceProperties implements InitializingBean {
private String serviceParameter = DEFAULT_CAS_SERVICE_PARAMETER;
// ~ Methods
// ========================================================================================================
public void afterPropertiesSet() {
Assert.hasLength(this.service, "service cannot be empty.");
Assert.hasLength(this.artifactParameter, "artifactParameter cannot be empty.");
@@ -56,14 +56,8 @@ import org.springframework.util.Assert;
*/
public class CasAuthenticationProvider implements AuthenticationProvider, InitializingBean, MessageSourceAware {
// ~ Static fields/initializers
// =====================================================================================
private static final Log logger = LogFactory.getLog(CasAuthenticationProvider.class);
// ~ Instance fields
// ================================================================================================
private AuthenticationUserDetailsService<CasAssertionAuthenticationToken> authenticationUserDetailsService;
private final UserDetailsChecker userDetailsChecker = new AccountStatusUserDetailsChecker();
@@ -80,9 +74,6 @@ public class CasAuthenticationProvider implements AuthenticationProvider, Initia
private GrantedAuthoritiesMapper authoritiesMapper = new NullAuthoritiesMapper();
// ~ Methods
// ========================================================================================================
public void afterPropertiesSet() {
Assert.notNull(this.authenticationUserDetailsService, "An authenticationUserDetailsService must be set");
Assert.notNull(this.ticketValidator, "A ticketValidator must be set");
@@ -36,8 +36,6 @@ public class CasAuthenticationToken extends AbstractAuthenticationToken implemen
private static final long serialVersionUID = SpringSecurityCoreVersion.SERIAL_VERSION_UID;
// ~ Instance fields
// ================================================================================================
private final Object credentials;
private final Object principal;
@@ -48,9 +46,6 @@ public class CasAuthenticationToken extends AbstractAuthenticationToken implemen
private final Assertion assertion;
// ~ Constructors
// ===================================================================================================
/**
* Constructor.
* @param key to identify if this object made by a given
@@ -110,9 +105,6 @@ public class CasAuthenticationToken extends AbstractAuthenticationToken implemen
setAuthenticated(true);
}
// ~ Methods
// ========================================================================================================
private static Integer extractKeyHash(String key) {
Assert.hasLength(key, "key cannot be null or empty");
return key.hashCode();
@@ -32,19 +32,10 @@ import org.springframework.util.Assert;
*/
public class EhCacheBasedTicketCache implements StatelessTicketCache, InitializingBean {
// ~ Static fields/initializers
// =====================================================================================
private static final Log logger = LogFactory.getLog(EhCacheBasedTicketCache.class);
// ~ Instance fields
// ================================================================================================
private Ehcache cache;
// ~ Methods
// ========================================================================================================
public void afterPropertiesSet() {
Assert.notNull(cache, "cache mandatory");
}
@@ -29,27 +29,15 @@ import org.springframework.util.Assert;
*/
public class SpringCacheBasedTicketCache implements StatelessTicketCache {
// ~ Static fields/initializers
// =====================================================================================
private static final Log logger = LogFactory.getLog(SpringCacheBasedTicketCache.class);
// ~ Instance fields
// ================================================================================================
private final Cache cache;
// ~ Constructors
// ===================================================================================================
public SpringCacheBasedTicketCache(Cache cache) {
Assert.notNull(cache, "cache mandatory");
this.cache = cache;
}
// ~ Methods
// ========================================================================================================
public CasAuthenticationToken getByTicketId(final String serviceTicket) {
final Cache.ValueWrapper element = serviceTicket != null ? cache.get(serviceTicket) : null;
@@ -60,8 +60,6 @@ package org.springframework.security.cas.authentication;
*/
public interface StatelessTicketCache {
// ~ Methods ================================================================
/**
* Retrieves the <code>CasAuthenticationToken</code> associated with the specified
* ticket.
@@ -44,8 +44,6 @@ import org.springframework.util.Assert;
*/
public class CasAuthenticationEntryPoint implements AuthenticationEntryPoint, InitializingBean {
// ~ Instance fields
// ================================================================================================
private ServiceProperties serviceProperties;
private String loginUrl;
@@ -61,9 +59,6 @@ public class CasAuthenticationEntryPoint implements AuthenticationEntryPoint, In
*/
private boolean encodeServiceUrlWithSessionId = true;
// ~ Methods
// ========================================================================================================
public void afterPropertiesSet() {
Assert.hasLength(this.loginUrl, "loginUrl must be specified");
Assert.notNull(this.serviceProperties, "serviceProperties must be specified");
@@ -173,9 +173,6 @@ import org.springframework.util.Assert;
*/
public class CasAuthenticationFilter extends AbstractAuthenticationProcessingFilter {
// ~ Static fields/initializers
// =====================================================================================
/**
* Used to identify a CAS request for a stateful user agent, such as a web browser.
*/
@@ -205,17 +202,11 @@ public class CasAuthenticationFilter extends AbstractAuthenticationProcessingFil
private AuthenticationFailureHandler proxyFailureHandler = new SimpleUrlAuthenticationFailureHandler();
// ~ Constructors
// ===================================================================================================
public CasAuthenticationFilter() {
super("/login/cas");
setAuthenticationFailureHandler(new SimpleUrlAuthenticationFailureHandler());
}
// ~ Methods
// ========================================================================================================
@Override
protected final void successfulAuthentication(HttpServletRequest request, HttpServletResponse response,
FilterChain chain, Authentication authResult) throws IOException, ServletException {
@@ -37,14 +37,8 @@ final class DefaultServiceAuthenticationDetails extends WebAuthenticationDetails
private static final long serialVersionUID = 6192409090610517700L;
// ~ Instance fields
// ================================================================================================
private final String serviceUrl;
// ~ Constructors
// ===================================================================================================
/**
* Creates a new instance
* @param request the current {@link HttpServletRequest} to obtain the
@@ -63,9 +57,6 @@ final class DefaultServiceAuthenticationDetails extends WebAuthenticationDetails
request.getRequestURI(), query);
}
// ~ Methods
// ========================================================================================================
/**
* Returns the current URL minus the artifact parameter and its value, if present.
* @see org.springframework.security.cas.web.authentication.ServiceAuthenticationDetails#getServiceUrl()
@@ -37,16 +37,10 @@ import org.springframework.util.Assert;
public class ServiceAuthenticationDetailsSource
implements AuthenticationDetailsSource<HttpServletRequest, ServiceAuthenticationDetails> {
// ~ Instance fields
// ================================================================================================
private final Pattern artifactPattern;
private ServiceProperties serviceProperties;
// ~ Constructors
// ===================================================================================================
/**
* Creates an implementation that uses the specified ServiceProperties and the default
* CAS artifactParameterName.
@@ -69,9 +63,6 @@ public class ServiceAuthenticationDetailsSource
this.artifactPattern = DefaultServiceAuthenticationDetails.createArtifactPattern(artifactParameterName);
}
// ~ Methods
// ========================================================================================================
/**
* @param context the {@code HttpServletRequest} object.
* @return the {@code ServiceAuthenticationDetails} containing information about the
@@ -50,9 +50,6 @@ import java.util.*;
@SuppressWarnings("unchecked")
public class CasAuthenticationProviderTests {
// ~ Methods
// ========================================================================================================
private UserDetails makeUserDetails() {
return new User("user", "password", true, true, true, true,
AuthorityUtils.createAuthorityList("ROLE_ONE", "ROLE_TWO"));
@@ -372,9 +369,6 @@ public class CasAuthenticationProviderTests {
assertThat(cap.supports(CasAuthenticationToken.class)).isTrue();
}
// ~ Inner Classes
// ==================================================================================================
private class MockAuthoritiesPopulator implements AuthenticationUserDetailsService {
public UserDetails loadUserDetails(final Authentication token) throws UsernameNotFoundException {
@@ -37,8 +37,6 @@ public class EhCacheBasedTicketCacheTests extends AbstractStatelessTicketCacheTe
private static CacheManager cacheManager;
// ~ Methods
// ========================================================================================================
@BeforeClass
public static void initCacheManaer() {
cacheManager = CacheManager.create();
@@ -34,9 +34,6 @@ public class SpringCacheBasedTicketCacheTests extends AbstractStatelessTicketCac
private static CacheManager cacheManager;
// ~ Methods
// ========================================================================================================
@BeforeClass
public static void initCacheManaer() {
cacheManager = new ConcurrentMapCacheManager();
@@ -33,8 +33,6 @@ import org.springframework.security.cas.ServiceProperties;
*/
public class CasAuthenticationEntryPointTests {
// ~ Methods
// ========================================================================================================
@Test
public void testDetectsMissingLoginFormUrl() throws Exception {
CasAuthenticationEntryPoint ep = new CasAuthenticationEntryPoint();
@@ -45,9 +45,6 @@ import static org.mockito.Mockito.*;
*/
public class CasAuthenticationFilterTests {
// ~ Methods
// ========================================================================================================
@After
public void tearDown() {
SecurityContextHolder.clearContext();
@@ -29,9 +29,6 @@ import org.springframework.security.cas.ServiceProperties;
*/
public class ServicePropertiesTests {
// ~ Methods
// ========================================================================================================
@Test(expected = IllegalArgumentException.class)
public void detectsMissingService() throws Exception {
ServiceProperties sp = new ServiceProperties();