Use diamond type
This commit is contained in:
+1
-1
@@ -60,7 +60,7 @@ public final class SecurityNamespaceHandler implements NamespaceHandler {
|
||||
private static final String FILTER_CHAIN_PROXY_CLASSNAME = "org.springframework.security.web.FilterChainProxy";
|
||||
private static final String MESSAGE_CLASSNAME = "org.springframework.messaging.Message";
|
||||
private final Log logger = LogFactory.getLog(getClass());
|
||||
private final Map<String, BeanDefinitionParser> parsers = new HashMap<String, BeanDefinitionParser>();
|
||||
private final Map<String, BeanDefinitionParser> parsers = new HashMap<>();
|
||||
private final BeanDefinitionDecorator interceptMethodsBDD = new InterceptMethodsBeanDefinitionDecorator();
|
||||
private BeanDefinitionDecorator filterChainMapBDD;
|
||||
|
||||
|
||||
+5
-5
@@ -220,9 +220,9 @@ public abstract class AbstractConfiguredSecurityBuilder<O, B extends SecurityBui
|
||||
public <C extends SecurityConfigurer<O, B>> List<C> getConfigurers(Class<C> clazz) {
|
||||
List<C> configs = (List<C>) this.configurers.get(clazz);
|
||||
if (configs == null) {
|
||||
return new ArrayList<C>();
|
||||
return new ArrayList<>();
|
||||
}
|
||||
return new ArrayList<C>(configs);
|
||||
return new ArrayList<>(configs);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -236,9 +236,9 @@ public abstract class AbstractConfiguredSecurityBuilder<O, B extends SecurityBui
|
||||
public <C extends SecurityConfigurer<O, B>> List<C> removeConfigurers(Class<C> clazz) {
|
||||
List<C> configs = (List<C>) this.configurers.remove(clazz);
|
||||
if (configs == null) {
|
||||
return new ArrayList<C>();
|
||||
return new ArrayList<>();
|
||||
}
|
||||
return new ArrayList<C>(configs);
|
||||
return new ArrayList<>(configs);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -459,4 +459,4 @@ public abstract class AbstractConfiguredSecurityBuilder<O, B extends SecurityBui
|
||||
return order >= CONFIGURING.order;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
+6
-6
@@ -54,7 +54,7 @@ public class AuthenticationManagerBuilder
|
||||
private final Log logger = LogFactory.getLog(getClass());
|
||||
|
||||
private AuthenticationManager parentAuthenticationManager;
|
||||
private List<AuthenticationProvider> authenticationProviders = new ArrayList<AuthenticationProvider>();
|
||||
private List<AuthenticationProvider> authenticationProviders = new ArrayList<>();
|
||||
private UserDetailsService defaultUserDetailsService;
|
||||
private Boolean eraseCredentials;
|
||||
private AuthenticationEventPublisher eventPublisher;
|
||||
@@ -131,7 +131,7 @@ public class AuthenticationManagerBuilder
|
||||
*/
|
||||
public InMemoryUserDetailsManagerConfigurer<AuthenticationManagerBuilder> inMemoryAuthentication()
|
||||
throws Exception {
|
||||
return apply(new InMemoryUserDetailsManagerConfigurer<AuthenticationManagerBuilder>());
|
||||
return apply(new InMemoryUserDetailsManagerConfigurer<>());
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -161,7 +161,7 @@ public class AuthenticationManagerBuilder
|
||||
*/
|
||||
public JdbcUserDetailsManagerConfigurer<AuthenticationManagerBuilder> jdbcAuthentication()
|
||||
throws Exception {
|
||||
return apply(new JdbcUserDetailsManagerConfigurer<AuthenticationManagerBuilder>());
|
||||
return apply(new JdbcUserDetailsManagerConfigurer<>());
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -184,7 +184,7 @@ public class AuthenticationManagerBuilder
|
||||
public <T extends UserDetailsService> DaoAuthenticationConfigurer<AuthenticationManagerBuilder, T> userDetailsService(
|
||||
T userDetailsService) throws Exception {
|
||||
this.defaultUserDetailsService = userDetailsService;
|
||||
return apply(new DaoAuthenticationConfigurer<AuthenticationManagerBuilder, T>(
|
||||
return apply(new DaoAuthenticationConfigurer<>(
|
||||
userDetailsService));
|
||||
}
|
||||
|
||||
@@ -203,7 +203,7 @@ public class AuthenticationManagerBuilder
|
||||
*/
|
||||
public LdapAuthenticationProviderConfigurer<AuthenticationManagerBuilder> ldapAuthentication()
|
||||
throws Exception {
|
||||
return apply(new LdapAuthenticationProviderConfigurer<AuthenticationManagerBuilder>());
|
||||
return apply(new LdapAuthenticationProviderConfigurer<>());
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -289,4 +289,4 @@ public class AuthenticationManagerBuilder
|
||||
this.defaultUserDetailsService = configurer.getUserDetailsService();
|
||||
return (C) super.apply(configurer);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
+1
-2
@@ -18,7 +18,6 @@ package org.springframework.security.config.annotation.authentication.configurer
|
||||
import java.util.ArrayList;
|
||||
|
||||
import org.springframework.security.config.annotation.authentication.ProviderManagerBuilder;
|
||||
import org.springframework.security.core.userdetails.UserDetails;
|
||||
import org.springframework.security.provisioning.InMemoryUserDetailsManager;
|
||||
|
||||
/**
|
||||
@@ -39,6 +38,6 @@ public class InMemoryUserDetailsManagerConfigurer<B extends ProviderManagerBuild
|
||||
* Creates a new instance
|
||||
*/
|
||||
public InMemoryUserDetailsManagerConfigurer() {
|
||||
super(new InMemoryUserDetailsManager(new ArrayList<UserDetails>()));
|
||||
super(new InMemoryUserDetailsManager(new ArrayList<>()));
|
||||
}
|
||||
}
|
||||
|
||||
+1
-1
@@ -49,7 +49,7 @@ public class JdbcUserDetailsManagerConfigurer<B extends ProviderManagerBuilder<B
|
||||
|
||||
private DataSource dataSource;
|
||||
|
||||
private List<Resource> initScripts = new ArrayList<Resource>();
|
||||
private List<Resource> initScripts = new ArrayList<>();
|
||||
|
||||
public JdbcUserDetailsManagerConfigurer(JdbcUserDetailsManager manager) {
|
||||
super(manager);
|
||||
|
||||
+1
-1
@@ -41,7 +41,7 @@ import org.springframework.security.provisioning.UserDetailsManager;
|
||||
public class UserDetailsManagerConfigurer<B extends ProviderManagerBuilder<B>, C extends UserDetailsManagerConfigurer<B, C>>
|
||||
extends UserDetailsServiceConfigurer<B, C, UserDetailsManager> {
|
||||
|
||||
private final List<UserDetailsBuilder> userBuilders = new ArrayList<UserDetailsBuilder>();
|
||||
private final List<UserDetailsBuilder> userBuilders = new ArrayList<>();
|
||||
|
||||
private final List<UserDetails> users = new ArrayList<>();
|
||||
|
||||
|
||||
+2
-2
@@ -41,8 +41,8 @@ final class AutowireBeanFactoryObjectPostProcessor
|
||||
implements ObjectPostProcessor<Object>, DisposableBean, SmartInitializingSingleton {
|
||||
private final Log logger = LogFactory.getLog(getClass());
|
||||
private final AutowireCapableBeanFactory autowireBeanFactory;
|
||||
private final List<DisposableBean> disposableBeans = new ArrayList<DisposableBean>();
|
||||
private final List<SmartInitializingSingleton> smartSingletons = new ArrayList<SmartInitializingSingleton>();
|
||||
private final List<DisposableBean> disposableBeans = new ArrayList<>();
|
||||
private final List<SmartInitializingSingleton> smartSingletons = new ArrayList<>();
|
||||
|
||||
public AutowireBeanFactoryObjectPostProcessor(
|
||||
AutowireCapableBeanFactory autowireBeanFactory) {
|
||||
|
||||
+2
-2
@@ -213,7 +213,7 @@ public class GlobalMethodSecurityConfiguration
|
||||
getExpressionHandler());
|
||||
PostInvocationAdviceProvider postInvocationAdviceProvider = new PostInvocationAdviceProvider(
|
||||
postAdvice);
|
||||
List<AfterInvocationProvider> afterInvocationProviders = new ArrayList<AfterInvocationProvider>();
|
||||
List<AfterInvocationProvider> afterInvocationProviders = new ArrayList<>();
|
||||
afterInvocationProviders.add(postInvocationAdviceProvider);
|
||||
invocationProviderManager.setProviders(afterInvocationProviders);
|
||||
return invocationProviderManager;
|
||||
@@ -350,7 +350,7 @@ public class GlobalMethodSecurityConfiguration
|
||||
*/
|
||||
@Bean
|
||||
public MethodSecurityMetadataSource methodSecurityMetadataSource() {
|
||||
List<MethodSecurityMetadataSource> sources = new ArrayList<MethodSecurityMetadataSource>();
|
||||
List<MethodSecurityMetadataSource> sources = new ArrayList<>();
|
||||
ExpressionBasedAnnotationAttributeFactory attributeFactory = new ExpressionBasedAnnotationAttributeFactory(
|
||||
getExpressionHandler());
|
||||
MethodSecurityMetadataSource customMethodSecurityMetadataSource = customMethodSecurityMetadataSource();
|
||||
|
||||
+1
-1
@@ -61,7 +61,7 @@ final class GlobalMethodSecuritySelector implements ImportSelector {
|
||||
|
||||
boolean jsr250Enabled = attributes.getBoolean("jsr250Enabled");
|
||||
|
||||
List<String> classNames = new ArrayList<String>(4);
|
||||
List<String> classNames = new ArrayList<>(4);
|
||||
if(isProxy) {
|
||||
classNames.add(MethodSecurityMetadataSourceAdvisorRegistrar.class.getName());
|
||||
}
|
||||
|
||||
+3
-3
@@ -169,7 +169,7 @@ public abstract class AbstractRequestMatcherRegistry<C> {
|
||||
}
|
||||
HandlerMappingIntrospector introspector = this.context.getBean(HANDLER_MAPPING_INTROSPECTOR_BEAN_NAME,
|
||||
HandlerMappingIntrospector.class);
|
||||
List<MvcRequestMatcher> matchers = new ArrayList<MvcRequestMatcher>(
|
||||
List<MvcRequestMatcher> matchers = new ArrayList<>(
|
||||
mvcPatterns.length);
|
||||
for (String mvcPattern : mvcPatterns) {
|
||||
MvcRequestMatcher matcher = new MvcRequestMatcher(introspector, mvcPattern);
|
||||
@@ -257,7 +257,7 @@ public abstract class AbstractRequestMatcherRegistry<C> {
|
||||
public static List<RequestMatcher> antMatchers(HttpMethod httpMethod,
|
||||
String... antPatterns) {
|
||||
String method = httpMethod == null ? null : httpMethod.toString();
|
||||
List<RequestMatcher> matchers = new ArrayList<RequestMatcher>();
|
||||
List<RequestMatcher> matchers = new ArrayList<>();
|
||||
for (String pattern : antPatterns) {
|
||||
matchers.add(new AntPathRequestMatcher(pattern, method));
|
||||
}
|
||||
@@ -290,7 +290,7 @@ public abstract class AbstractRequestMatcherRegistry<C> {
|
||||
public static List<RequestMatcher> regexMatchers(HttpMethod httpMethod,
|
||||
String... regexPatterns) {
|
||||
String method = httpMethod == null ? null : httpMethod.toString();
|
||||
List<RequestMatcher> matchers = new ArrayList<RequestMatcher>();
|
||||
List<RequestMatcher> matchers = new ArrayList<>();
|
||||
for (String pattern : regexPatterns) {
|
||||
matchers.add(new RegexRequestMatcher(pattern, method));
|
||||
}
|
||||
|
||||
+1
-1
@@ -57,7 +57,7 @@ import org.springframework.web.filter.CorsFilter;
|
||||
@SuppressWarnings("serial")
|
||||
final class FilterComparator implements Comparator<Filter>, Serializable {
|
||||
private static final int STEP = 100;
|
||||
private Map<String, Integer> filterToOrder = new HashMap<String, Integer>();
|
||||
private Map<String, Integer> filterToOrder = new HashMap<>();
|
||||
|
||||
FilterComparator() {
|
||||
int order = 100;
|
||||
|
||||
+23
-23
@@ -119,7 +119,7 @@ public final class HttpSecurity extends
|
||||
implements SecurityBuilder<DefaultSecurityFilterChain>,
|
||||
HttpSecurityBuilder<HttpSecurity> {
|
||||
private final RequestMatcherConfigurer requestMatcherConfigurer;
|
||||
private List<Filter> filters = new ArrayList<Filter>();
|
||||
private List<Filter> filters = new ArrayList<>();
|
||||
private RequestMatcher requestMatcher = AnyRequestMatcher.INSTANCE;
|
||||
private FilterComparator comparator = new FilterComparator();
|
||||
|
||||
@@ -232,7 +232,7 @@ public final class HttpSecurity extends
|
||||
* @see OpenIDLoginConfigurer
|
||||
*/
|
||||
public OpenIDLoginConfigurer<HttpSecurity> openidLogin() throws Exception {
|
||||
return getOrApply(new OpenIDLoginConfigurer<HttpSecurity>());
|
||||
return getOrApply(new OpenIDLoginConfigurer<>());
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -332,7 +332,7 @@ public final class HttpSecurity extends
|
||||
* @see HeadersConfigurer
|
||||
*/
|
||||
public HeadersConfigurer<HttpSecurity> headers() throws Exception {
|
||||
return getOrApply(new HeadersConfigurer<HttpSecurity>());
|
||||
return getOrApply(new HeadersConfigurer<>());
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -345,7 +345,7 @@ public final class HttpSecurity extends
|
||||
* @throws Exception
|
||||
*/
|
||||
public CorsConfigurer<HttpSecurity> cors() throws Exception {
|
||||
return getOrApply(new CorsConfigurer<HttpSecurity>());
|
||||
return getOrApply(new CorsConfigurer<>());
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -397,7 +397,7 @@ public final class HttpSecurity extends
|
||||
* @throws Exception
|
||||
*/
|
||||
public SessionManagementConfigurer<HttpSecurity> sessionManagement() throws Exception {
|
||||
return getOrApply(new SessionManagementConfigurer<HttpSecurity>());
|
||||
return getOrApply(new SessionManagementConfigurer<>());
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -440,7 +440,7 @@ public final class HttpSecurity extends
|
||||
* @see #requiresChannel()
|
||||
*/
|
||||
public PortMapperConfigurer<HttpSecurity> portMapper() throws Exception {
|
||||
return getOrApply(new PortMapperConfigurer<HttpSecurity>());
|
||||
return getOrApply(new PortMapperConfigurer<>());
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -512,7 +512,7 @@ public final class HttpSecurity extends
|
||||
* @throws Exception
|
||||
*/
|
||||
public JeeConfigurer<HttpSecurity> jee() throws Exception {
|
||||
return getOrApply(new JeeConfigurer<HttpSecurity>());
|
||||
return getOrApply(new JeeConfigurer<>());
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -542,7 +542,7 @@ public final class HttpSecurity extends
|
||||
* @throws Exception
|
||||
*/
|
||||
public X509Configurer<HttpSecurity> x509() throws Exception {
|
||||
return getOrApply(new X509Configurer<HttpSecurity>());
|
||||
return getOrApply(new X509Configurer<>());
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -579,7 +579,7 @@ public final class HttpSecurity extends
|
||||
* @throws Exception
|
||||
*/
|
||||
public RememberMeConfigurer<HttpSecurity> rememberMe() throws Exception {
|
||||
return getOrApply(new RememberMeConfigurer<HttpSecurity>());
|
||||
return getOrApply(new RememberMeConfigurer<>());
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -649,7 +649,7 @@ public final class HttpSecurity extends
|
||||
public ExpressionUrlAuthorizationConfigurer<HttpSecurity>.ExpressionInterceptUrlRegistry authorizeRequests()
|
||||
throws Exception {
|
||||
ApplicationContext context = getContext();
|
||||
return getOrApply(new ExpressionUrlAuthorizationConfigurer<HttpSecurity>(context))
|
||||
return getOrApply(new ExpressionUrlAuthorizationConfigurer<>(context))
|
||||
.getRegistry();
|
||||
}
|
||||
|
||||
@@ -664,7 +664,7 @@ public final class HttpSecurity extends
|
||||
* @throws Exception
|
||||
*/
|
||||
public RequestCacheConfigurer<HttpSecurity> requestCache() throws Exception {
|
||||
return getOrApply(new RequestCacheConfigurer<HttpSecurity>());
|
||||
return getOrApply(new RequestCacheConfigurer<>());
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -675,7 +675,7 @@ public final class HttpSecurity extends
|
||||
* @throws Exception
|
||||
*/
|
||||
public ExceptionHandlingConfigurer<HttpSecurity> exceptionHandling() throws Exception {
|
||||
return getOrApply(new ExceptionHandlingConfigurer<HttpSecurity>());
|
||||
return getOrApply(new ExceptionHandlingConfigurer<>());
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -687,7 +687,7 @@ public final class HttpSecurity extends
|
||||
* @throws Exception
|
||||
*/
|
||||
public SecurityContextConfigurer<HttpSecurity> securityContext() throws Exception {
|
||||
return getOrApply(new SecurityContextConfigurer<HttpSecurity>());
|
||||
return getOrApply(new SecurityContextConfigurer<>());
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -699,7 +699,7 @@ public final class HttpSecurity extends
|
||||
* @throws Exception
|
||||
*/
|
||||
public ServletApiConfigurer<HttpSecurity> servletApi() throws Exception {
|
||||
return getOrApply(new ServletApiConfigurer<HttpSecurity>());
|
||||
return getOrApply(new ServletApiConfigurer<>());
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -726,7 +726,7 @@ public final class HttpSecurity extends
|
||||
*/
|
||||
public CsrfConfigurer<HttpSecurity> csrf() throws Exception {
|
||||
ApplicationContext context = getContext();
|
||||
return getOrApply(new CsrfConfigurer<HttpSecurity>(context));
|
||||
return getOrApply(new CsrfConfigurer<>(context));
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -767,7 +767,7 @@ public final class HttpSecurity extends
|
||||
* @throws Exception
|
||||
*/
|
||||
public LogoutConfigurer<HttpSecurity> logout() throws Exception {
|
||||
return getOrApply(new LogoutConfigurer<HttpSecurity>());
|
||||
return getOrApply(new LogoutConfigurer<>());
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -830,7 +830,7 @@ public final class HttpSecurity extends
|
||||
* @throws Exception
|
||||
*/
|
||||
public AnonymousConfigurer<HttpSecurity> anonymous() throws Exception {
|
||||
return getOrApply(new AnonymousConfigurer<HttpSecurity>());
|
||||
return getOrApply(new AnonymousConfigurer<>());
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -894,7 +894,7 @@ public final class HttpSecurity extends
|
||||
* @throws Exception
|
||||
*/
|
||||
public FormLoginConfigurer<HttpSecurity> formLogin() throws Exception {
|
||||
return getOrApply(new FormLoginConfigurer<HttpSecurity>());
|
||||
return getOrApply(new FormLoginConfigurer<>());
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -988,7 +988,7 @@ public final class HttpSecurity extends
|
||||
* @throws Exception
|
||||
*/
|
||||
public OAuth2LoginConfigurer<HttpSecurity> oauth2Login() throws Exception {
|
||||
return getOrApply(new OAuth2LoginConfigurer<HttpSecurity>());
|
||||
return getOrApply(new OAuth2LoginConfigurer<>());
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -1028,7 +1028,7 @@ public final class HttpSecurity extends
|
||||
public ChannelSecurityConfigurer<HttpSecurity>.ChannelRequestMatcherRegistry requiresChannel()
|
||||
throws Exception {
|
||||
ApplicationContext context = getContext();
|
||||
return getOrApply(new ChannelSecurityConfigurer<HttpSecurity>(context))
|
||||
return getOrApply(new ChannelSecurityConfigurer<>(context))
|
||||
.getRegistry();
|
||||
}
|
||||
|
||||
@@ -1062,7 +1062,7 @@ public final class HttpSecurity extends
|
||||
* @throws Exception
|
||||
*/
|
||||
public HttpBasicConfigurer<HttpSecurity> httpBasic() throws Exception {
|
||||
return getOrApply(new HttpBasicConfigurer<HttpSecurity>());
|
||||
return getOrApply(new HttpBasicConfigurer<>());
|
||||
}
|
||||
|
||||
public <C> void setSharedObject(Class<C> sharedType, C object) {
|
||||
@@ -1382,7 +1382,7 @@ public final class HttpSecurity extends
|
||||
private MvcMatchersRequestMatcherConfigurer(ApplicationContext context,
|
||||
List<MvcRequestMatcher> matchers) {
|
||||
super(context);
|
||||
this.matchers = new ArrayList<RequestMatcher>(matchers);
|
||||
this.matchers = new ArrayList<>(matchers);
|
||||
}
|
||||
|
||||
public RequestMatcherConfigurer servletPath(String servletPath) {
|
||||
@@ -1403,7 +1403,7 @@ public final class HttpSecurity extends
|
||||
public class RequestMatcherConfigurer
|
||||
extends AbstractRequestMatcherRegistry<RequestMatcherConfigurer> {
|
||||
|
||||
protected List<RequestMatcher> matchers = new ArrayList<RequestMatcher>();
|
||||
protected List<RequestMatcher> matchers = new ArrayList<>();
|
||||
|
||||
/**
|
||||
* @param context
|
||||
|
||||
+2
-2
@@ -79,7 +79,7 @@ public final class WebSecurity extends
|
||||
SecurityBuilder<Filter>, ApplicationContextAware {
|
||||
private final Log logger = LogFactory.getLog(getClass());
|
||||
|
||||
private final List<RequestMatcher> ignoredRequests = new ArrayList<RequestMatcher>();
|
||||
private final List<RequestMatcher> ignoredRequests = new ArrayList<>();
|
||||
|
||||
private final List<SecurityBuilder<? extends SecurityFilterChain>> securityFilterChainBuilders = new ArrayList<SecurityBuilder<? extends SecurityFilterChain>>();
|
||||
|
||||
@@ -281,7 +281,7 @@ public final class WebSecurity extends
|
||||
+ WebSecurity.class.getSimpleName()
|
||||
+ ".addSecurityFilterChainBuilder directly");
|
||||
int chainSize = ignoredRequests.size() + securityFilterChainBuilders.size();
|
||||
List<SecurityFilterChain> securityFilterChains = new ArrayList<SecurityFilterChain>(
|
||||
List<SecurityFilterChain> securityFilterChains = new ArrayList<>(
|
||||
chainSize);
|
||||
for (RequestMatcher ignoredRequest : ignoredRequests) {
|
||||
securityFilterChains.add(new DefaultSecurityFilterChain(ignoredRequest));
|
||||
|
||||
+2
-2
@@ -216,7 +216,7 @@ public abstract class WebSecurityConfigurerAdapter implements
|
||||
.requestCache().and()
|
||||
.anonymous().and()
|
||||
.servletApi().and()
|
||||
.apply(new DefaultLoginPageConfigurer<HttpSecurity>()).and()
|
||||
.apply(new DefaultLoginPageConfigurer<>()).and()
|
||||
.logout();
|
||||
// @formatter:on
|
||||
ClassLoader classLoader = this.context.getClassLoader();
|
||||
@@ -517,7 +517,7 @@ public abstract class WebSecurityConfigurerAdapter implements
|
||||
String[] beanNamesForType = BeanFactoryUtils
|
||||
.beanNamesForTypeIncludingAncestors(applicationContext,
|
||||
AuthenticationManager.class);
|
||||
return new HashSet<String>(Arrays.asList(beanNamesForType));
|
||||
return new HashSet<>(Arrays.asList(beanNamesForType));
|
||||
}
|
||||
|
||||
private static void validateBeanCycle(Object auth, Set<String> beanNames) {
|
||||
|
||||
+1
-1
@@ -39,7 +39,7 @@ import org.springframework.security.web.util.matcher.RequestMatcher;
|
||||
*/
|
||||
public abstract class AbstractConfigAttributeRequestMatcherRegistry<C> extends
|
||||
AbstractRequestMatcherRegistry<C> {
|
||||
private List<UrlMapping> urlMappings = new ArrayList<UrlMapping>();
|
||||
private List<UrlMapping> urlMappings = new ArrayList<>();
|
||||
private List<RequestMatcher> unmappedMatchers;
|
||||
|
||||
/**
|
||||
|
||||
+2
-2
@@ -80,7 +80,7 @@ public final class CsrfConfigurer<H extends HttpSecurityBuilder<H>>
|
||||
private CsrfTokenRepository csrfTokenRepository = new LazyCsrfTokenRepository(
|
||||
new HttpSessionCsrfTokenRepository());
|
||||
private RequestMatcher requireCsrfProtectionMatcher = CsrfFilter.DEFAULT_CSRF_MATCHER;
|
||||
private List<RequestMatcher> ignoredCsrfProtectionMatchers = new ArrayList<RequestMatcher>();
|
||||
private List<RequestMatcher> ignoredCsrfProtectionMatchers = new ArrayList<>();
|
||||
private final ApplicationContext context;
|
||||
|
||||
/**
|
||||
@@ -327,4 +327,4 @@ public final class CsrfConfigurer<H extends HttpSecurityBuilder<H>>
|
||||
return this;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
+1
-1
@@ -68,7 +68,7 @@ public final class ExceptionHandlingConfigurer<H extends HttpSecurityBuilder<H>>
|
||||
|
||||
private AccessDeniedHandler accessDeniedHandler;
|
||||
|
||||
private LinkedHashMap<RequestMatcher, AuthenticationEntryPoint> defaultEntryPointMappings = new LinkedHashMap<RequestMatcher, AuthenticationEntryPoint>();
|
||||
private LinkedHashMap<RequestMatcher, AuthenticationEntryPoint> defaultEntryPointMappings = new LinkedHashMap<>();
|
||||
|
||||
/**
|
||||
* Creates a new instance
|
||||
|
||||
+3
-3
@@ -62,7 +62,7 @@ import org.springframework.util.Assert;
|
||||
*/
|
||||
public class HeadersConfigurer<H extends HttpSecurityBuilder<H>> extends
|
||||
AbstractHttpConfigurer<HeadersConfigurer<H>, H> {
|
||||
private List<HeaderWriter> headerWriters = new ArrayList<HeaderWriter>();
|
||||
private List<HeaderWriter> headerWriters = new ArrayList<>();
|
||||
|
||||
// --- default header writers ---
|
||||
|
||||
@@ -766,7 +766,7 @@ public class HeadersConfigurer<H extends HttpSecurityBuilder<H>> extends
|
||||
* @return
|
||||
*/
|
||||
private List<HeaderWriter> getHeaderWriters() {
|
||||
List<HeaderWriter> writers = new ArrayList<HeaderWriter>();
|
||||
List<HeaderWriter> writers = new ArrayList<>();
|
||||
addIfNotNull(writers, contentTypeOptions.writer);
|
||||
addIfNotNull(writers, xssProtection.writer);
|
||||
addIfNotNull(writers, cacheControl.writer);
|
||||
@@ -848,4 +848,4 @@ public class HeadersConfigurer<H extends HttpSecurityBuilder<H>> extends
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
+1
-1
@@ -97,7 +97,7 @@ public final class HttpBasicConfigurer<B extends HttpSecurityBuilder<B>> extends
|
||||
public HttpBasicConfigurer() throws Exception {
|
||||
realmName(DEFAULT_REALM);
|
||||
|
||||
LinkedHashMap<RequestMatcher, AuthenticationEntryPoint> entryPoints = new LinkedHashMap<RequestMatcher, AuthenticationEntryPoint>();
|
||||
LinkedHashMap<RequestMatcher, AuthenticationEntryPoint> entryPoints = new LinkedHashMap<>();
|
||||
entryPoints.put(X_REQUESTED_WITH, new HttpStatusEntryPoint(HttpStatus.UNAUTHORIZED));
|
||||
|
||||
DelegatingAuthenticationEntryPoint defaultEntryPoint = new DelegatingAuthenticationEntryPoint(
|
||||
|
||||
+1
-1
@@ -72,7 +72,7 @@ public final class JeeConfigurer<H extends HttpSecurityBuilder<H>> extends
|
||||
AbstractHttpConfigurer<JeeConfigurer<H>, H> {
|
||||
private J2eePreAuthenticatedProcessingFilter j2eePreAuthenticatedProcessingFilter;
|
||||
private AuthenticationUserDetailsService<PreAuthenticatedAuthenticationToken> authenticationUserDetailsService;
|
||||
private Set<String> mappableRoles = new HashSet<String>();
|
||||
private Set<String> mappableRoles = new HashSet<>();
|
||||
|
||||
/**
|
||||
* Creates a new instance
|
||||
|
||||
+2
-2
@@ -65,7 +65,7 @@ import org.springframework.util.Assert;
|
||||
*/
|
||||
public final class LogoutConfigurer<H extends HttpSecurityBuilder<H>> extends
|
||||
AbstractHttpConfigurer<LogoutConfigurer<H>, H> {
|
||||
private List<LogoutHandler> logoutHandlers = new ArrayList<LogoutHandler>();
|
||||
private List<LogoutHandler> logoutHandlers = new ArrayList<>();
|
||||
private SecurityContextLogoutHandler contextLogoutHandler = new SecurityContextLogoutHandler();
|
||||
private String logoutSuccessUrl = "/login?logout";
|
||||
private LogoutSuccessHandler logoutSuccessHandler;
|
||||
@@ -75,7 +75,7 @@ public final class LogoutConfigurer<H extends HttpSecurityBuilder<H>> extends
|
||||
private boolean customLogoutSuccess;
|
||||
|
||||
private LinkedHashMap<RequestMatcher, LogoutSuccessHandler> defaultLogoutSuccessHandlerMappings =
|
||||
new LinkedHashMap<RequestMatcher, LogoutSuccessHandler>();
|
||||
new LinkedHashMap<>();
|
||||
|
||||
/**
|
||||
* Creates a new instance
|
||||
|
||||
+1
-1
@@ -34,7 +34,7 @@ import org.springframework.security.web.PortMapperImpl;
|
||||
public final class PortMapperConfigurer<H extends HttpSecurityBuilder<H>> extends
|
||||
AbstractHttpConfigurer<PortMapperConfigurer<H>, H> {
|
||||
private PortMapper portMapper;
|
||||
private Map<String, String> httpsPortMappings = new HashMap<String, String>();
|
||||
private Map<String, String> httpsPortMappings = new HashMap<>();
|
||||
|
||||
/**
|
||||
* Creates a new instance
|
||||
|
||||
+1
-1
@@ -139,7 +139,7 @@ public final class RequestCacheConfigurer<H extends HttpSecurityBuilder<H>> exte
|
||||
|
||||
boolean isCsrfEnabled = http.getConfigurer(CsrfConfigurer.class) != null;
|
||||
|
||||
List<RequestMatcher> matchers = new ArrayList<RequestMatcher>();
|
||||
List<RequestMatcher> matchers = new ArrayList<>();
|
||||
if (isCsrfEnabled) {
|
||||
RequestMatcher getRequests = new AntPathRequestMatcher("/**", "GET");
|
||||
matchers.add(0, getRequests);
|
||||
|
||||
+1
-1
@@ -100,7 +100,7 @@ public final class SessionManagementConfigurer<H extends HttpSecurityBuilder<H>>
|
||||
private SessionAuthenticationStrategy providedSessionAuthenticationStrategy;
|
||||
private InvalidSessionStrategy invalidSessionStrategy;
|
||||
private SessionInformationExpiredStrategy expiredSessionStrategy;
|
||||
private List<SessionAuthenticationStrategy> sessionAuthenticationStrategies = new ArrayList<SessionAuthenticationStrategy>();
|
||||
private List<SessionAuthenticationStrategy> sessionAuthenticationStrategies = new ArrayList<>();
|
||||
private SessionRegistry sessionRegistry;
|
||||
private Integer maximumSessions;
|
||||
private String expiredUrl;
|
||||
|
||||
+1
-1
@@ -121,7 +121,7 @@ public final class X509Configurer<H extends HttpSecurityBuilder<H>> extends
|
||||
* @return the {@link X509Configurer} for further customizations
|
||||
*/
|
||||
public X509Configurer<H> userDetailsService(UserDetailsService userDetailsService) {
|
||||
UserDetailsByNameServiceWrapper<PreAuthenticatedAuthenticationToken> authenticationUserDetailsService = new UserDetailsByNameServiceWrapper<PreAuthenticatedAuthenticationToken>();
|
||||
UserDetailsByNameServiceWrapper<PreAuthenticatedAuthenticationToken> authenticationUserDetailsService = new UserDetailsByNameServiceWrapper<>();
|
||||
authenticationUserDetailsService.setUserDetailsService(userDetailsService);
|
||||
return authenticationUserDetailsService(authenticationUserDetailsService);
|
||||
}
|
||||
|
||||
+4
-4
@@ -124,7 +124,7 @@ public final class OpenIDLoginConfigurer<H extends HttpSecurityBuilder<H>> exten
|
||||
private OpenIDConsumer openIDConsumer;
|
||||
private ConsumerManager consumerManager;
|
||||
private AuthenticationUserDetailsService<OpenIDAuthenticationToken> authenticationUserDetailsService;
|
||||
private List<AttributeExchangeConfigurer> attributeExchangeConfigurers = new ArrayList<AttributeExchangeConfigurer>();
|
||||
private List<AttributeExchangeConfigurer> attributeExchangeConfigurers = new ArrayList<>();
|
||||
|
||||
/**
|
||||
* Creates a new instance
|
||||
@@ -341,7 +341,7 @@ public final class OpenIDLoginConfigurer<H extends HttpSecurityBuilder<H>> exten
|
||||
if (this.authenticationUserDetailsService != null) {
|
||||
return this.authenticationUserDetailsService;
|
||||
}
|
||||
return new UserDetailsByNameServiceWrapper<OpenIDAuthenticationToken>(
|
||||
return new UserDetailsByNameServiceWrapper<>(
|
||||
http.getSharedObject(UserDetailsService.class));
|
||||
}
|
||||
|
||||
@@ -374,8 +374,8 @@ public final class OpenIDLoginConfigurer<H extends HttpSecurityBuilder<H>> exten
|
||||
*/
|
||||
public final class AttributeExchangeConfigurer {
|
||||
private final String identifier;
|
||||
private List<OpenIDAttribute> attributes = new ArrayList<OpenIDAttribute>();
|
||||
private List<AttributeConfigurer> attributeConfigurers = new ArrayList<AttributeConfigurer>();
|
||||
private List<OpenIDAttribute> attributes = new ArrayList<>();
|
||||
private List<AttributeConfigurer> attributeConfigurers = new ArrayList<>();
|
||||
|
||||
/**
|
||||
* Creates a new instance
|
||||
|
||||
+4
-4
@@ -51,9 +51,9 @@ public class MessageSecurityMetadataSourceRegistry {
|
||||
private static final String fullyAuthenticated = "fullyAuthenticated";
|
||||
private static final String rememberMe = "rememberMe";
|
||||
|
||||
private SecurityExpressionHandler<Message<Object>> expressionHandler = new DefaultMessageSecurityExpressionHandler<Object>();
|
||||
private SecurityExpressionHandler<Message<Object>> expressionHandler = new DefaultMessageSecurityExpressionHandler<>();
|
||||
|
||||
private final LinkedHashMap<MatcherBuilder, String> matcherToExpression = new LinkedHashMap<MatcherBuilder, String>();
|
||||
private final LinkedHashMap<MatcherBuilder, String> matcherToExpression = new LinkedHashMap<>();
|
||||
|
||||
private DelegatingPathMatcher pathMatcher = new DelegatingPathMatcher();
|
||||
|
||||
@@ -160,7 +160,7 @@ public class MessageSecurityMetadataSourceRegistry {
|
||||
* @see {@link MessageSecurityMetadataSourceRegistry#simpDestPathMatcher(PathMatcher)}
|
||||
*/
|
||||
private Constraint simpDestMatchers(SimpMessageType type, String... patterns) {
|
||||
List<MatcherBuilder> matchers = new ArrayList<MatcherBuilder>(patterns.length);
|
||||
List<MatcherBuilder> matchers = new ArrayList<>(patterns.length);
|
||||
for (String pattern : patterns) {
|
||||
matchers.add(new PathMatcherMessageMatcherBuilder(pattern, type));
|
||||
}
|
||||
@@ -201,7 +201,7 @@ public class MessageSecurityMetadataSourceRegistry {
|
||||
* instances
|
||||
*/
|
||||
public Constraint matchers(MessageMatcher<?>... matchers) {
|
||||
List<MatcherBuilder> builders = new ArrayList<MatcherBuilder>(matchers.length);
|
||||
List<MatcherBuilder> builders = new ArrayList<>(matchers.length);
|
||||
for (MessageMatcher<?> matcher : matchers) {
|
||||
builders.add(new PreBuiltMatcherBuilder(matcher));
|
||||
}
|
||||
|
||||
+5
-5
@@ -87,7 +87,7 @@ public abstract class AbstractSecurityWebSocketMessageBrokerConfigurer extends
|
||||
AbstractWebSocketMessageBrokerConfigurer implements SmartInitializingSingleton {
|
||||
private final WebSocketMessageSecurityMetadataSourceRegistry inboundRegistry = new WebSocketMessageSecurityMetadataSourceRegistry();
|
||||
|
||||
private SecurityExpressionHandler<Message<Object>> defaultExpressionHandler = new DefaultMessageSecurityExpressionHandler<Object>();
|
||||
private SecurityExpressionHandler<Message<Object>> defaultExpressionHandler = new DefaultMessageSecurityExpressionHandler<>();
|
||||
|
||||
private SecurityExpressionHandler<Message<Object>> expressionHandler;
|
||||
|
||||
@@ -156,7 +156,7 @@ public abstract class AbstractSecurityWebSocketMessageBrokerConfigurer extends
|
||||
public ChannelSecurityInterceptor inboundChannelSecurity() {
|
||||
ChannelSecurityInterceptor channelSecurityInterceptor = new ChannelSecurityInterceptor(
|
||||
inboundMessageSecurityMetadataSource());
|
||||
MessageExpressionVoter<Object> voter = new MessageExpressionVoter<Object>();
|
||||
MessageExpressionVoter<Object> voter = new MessageExpressionVoter<>();
|
||||
voter.setExpressionHandler(getMessageExpressionHandler());
|
||||
|
||||
List<AccessDecisionVoter<? extends Object>> voters = new ArrayList<AccessDecisionVoter<? extends Object>>();
|
||||
@@ -255,7 +255,7 @@ public abstract class AbstractSecurityWebSocketMessageBrokerConfigurer extends
|
||||
TransportHandlingSockJsService transportHandlingSockJsService = (TransportHandlingSockJsService) sockJsService;
|
||||
List<HandshakeInterceptor> handshakeInterceptors = transportHandlingSockJsService
|
||||
.getHandshakeInterceptors();
|
||||
List<HandshakeInterceptor> interceptorsToSet = new ArrayList<HandshakeInterceptor>(
|
||||
List<HandshakeInterceptor> interceptorsToSet = new ArrayList<>(
|
||||
handshakeInterceptors.size() + 1);
|
||||
interceptorsToSet.add(new CsrfTokenHandshakeInterceptor());
|
||||
interceptorsToSet.addAll(handshakeInterceptors);
|
||||
@@ -267,7 +267,7 @@ public abstract class AbstractSecurityWebSocketMessageBrokerConfigurer extends
|
||||
WebSocketHttpRequestHandler handler = (WebSocketHttpRequestHandler) object;
|
||||
List<HandshakeInterceptor> handshakeInterceptors = handler
|
||||
.getHandshakeInterceptors();
|
||||
List<HandshakeInterceptor> interceptorsToSet = new ArrayList<HandshakeInterceptor>(
|
||||
List<HandshakeInterceptor> interceptorsToSet = new ArrayList<>(
|
||||
handshakeInterceptors.size() + 1);
|
||||
interceptorsToSet.add(new CsrfTokenHandshakeInterceptor());
|
||||
interceptorsToSet.addAll(handshakeInterceptors);
|
||||
@@ -288,4 +288,4 @@ public abstract class AbstractSecurityWebSocketMessageBrokerConfigurer extends
|
||||
inboundRegistry.simpDestPathMatcher(pathMatcher);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
+1
-1
@@ -71,7 +71,7 @@ public class AuthenticationManagerBeanDefinitionParser implements BeanDefinition
|
||||
|
||||
String alias = element.getAttribute(ATT_ALIAS);
|
||||
|
||||
List<BeanMetadataElement> providers = new ManagedList<BeanMetadataElement>();
|
||||
List<BeanMetadataElement> providers = new ManagedList<>();
|
||||
NamespaceHandlerResolver resolver = pc.getReaderContext()
|
||||
.getNamespaceHandlerResolver();
|
||||
|
||||
|
||||
+1
-1
@@ -82,7 +82,7 @@ public class UserServiceBeanDefinitionParser extends
|
||||
+ ATT_PROPERTIES + "' attribute)");
|
||||
}
|
||||
|
||||
ManagedList<BeanDefinition> users = new ManagedList<BeanDefinition>();
|
||||
ManagedList<BeanDefinition> users = new ManagedList<>();
|
||||
|
||||
for (Object elt : userElts) {
|
||||
Element userElt = (Element) elt;
|
||||
|
||||
+3
-3
@@ -302,7 +302,7 @@ final class AuthenticationConfigBuilder {
|
||||
}
|
||||
|
||||
private ManagedList<BeanDefinition> parseOpenIDAttributes(Element attrExElt) {
|
||||
ManagedList<BeanDefinition> attributes = new ManagedList<BeanDefinition>();
|
||||
ManagedList<BeanDefinition> attributes = new ManagedList<>();
|
||||
for (Element attElt : DomUtils.getChildElementsByTagName(attrExElt,
|
||||
Elements.OPENID_ATTRIBUTE)) {
|
||||
String name = attElt.getAttribute("name");
|
||||
@@ -764,7 +764,7 @@ final class AuthenticationConfigBuilder {
|
||||
}
|
||||
|
||||
List<OrderDecorator> getFilters() {
|
||||
List<OrderDecorator> filters = new ArrayList<OrderDecorator>();
|
||||
List<OrderDecorator> filters = new ArrayList<>();
|
||||
|
||||
if (anonymousFilter != null) {
|
||||
filters.add(new OrderDecorator(anonymousFilter, ANONYMOUS_FILTER));
|
||||
@@ -810,7 +810,7 @@ final class AuthenticationConfigBuilder {
|
||||
}
|
||||
|
||||
List<BeanReference> getProviders() {
|
||||
List<BeanReference> providers = new ArrayList<BeanReference>();
|
||||
List<BeanReference> providers = new ArrayList<>();
|
||||
|
||||
if (anonymousProviderRef != null) {
|
||||
providers.add(anonymousProviderRef);
|
||||
|
||||
+2
-2
@@ -52,8 +52,8 @@ public class DefaultFilterChainValidator implements FilterChainProxy.FilterChain
|
||||
checkFilterStack(filterChain.getFilters());
|
||||
}
|
||||
|
||||
checkPathOrder(new ArrayList<SecurityFilterChain>(fcp.getFilterChains()));
|
||||
checkForDuplicateMatchers(new ArrayList<SecurityFilterChain>(
|
||||
checkPathOrder(new ArrayList<>(fcp.getFilterChains()));
|
||||
checkForDuplicateMatchers(new ArrayList<>(
|
||||
fcp.getFilterChains()));
|
||||
}
|
||||
|
||||
|
||||
+1
-1
@@ -57,7 +57,7 @@ public class FilterChainBeanDefinitionParser implements BeanDefinitionParser {
|
||||
}
|
||||
else {
|
||||
String[] filterBeanNames = StringUtils.tokenizeToStringArray(filters, ",");
|
||||
ManagedList<RuntimeBeanReference> filterChain = new ManagedList<RuntimeBeanReference>(
|
||||
ManagedList<RuntimeBeanReference> filterChain = new ManagedList<>(
|
||||
filterBeanNames.length);
|
||||
|
||||
for (String name : filterBeanNames) {
|
||||
|
||||
+1
-1
@@ -44,7 +44,7 @@ public class FilterChainMapBeanDefinitionDecorator implements BeanDefinitionDeco
|
||||
ParserContext parserContext) {
|
||||
BeanDefinition filterChainProxy = holder.getBeanDefinition();
|
||||
|
||||
ManagedList<BeanMetadataElement> securityFilterChains = new ManagedList<BeanMetadataElement>();
|
||||
ManagedList<BeanMetadataElement> securityFilterChains = new ManagedList<>();
|
||||
Element elt = (Element) node;
|
||||
|
||||
MatcherType matcherType = MatcherType.fromElement(elt);
|
||||
|
||||
+1
-1
@@ -155,7 +155,7 @@ public class FilterInvocationSecurityMetadataSourceParser implements BeanDefinit
|
||||
MatcherType matcherType, List<Element> urlElts, boolean useExpressions,
|
||||
boolean addAuthenticatedAll, ParserContext parserContext) {
|
||||
|
||||
ManagedMap<BeanMetadataElement, BeanDefinition> filterInvocationDefinitionMap = new ManagedMap<BeanMetadataElement, BeanDefinition>();
|
||||
ManagedMap<BeanMetadataElement, BeanDefinition> filterInvocationDefinitionMap = new ManagedMap<>();
|
||||
|
||||
for (Element urlElt : urlElts) {
|
||||
String access = urlElt.getAttribute(ATT_ACCESS);
|
||||
|
||||
+2
-2
@@ -91,7 +91,7 @@ public class HeadersBeanDefinitionParser implements BeanDefinitionParser {
|
||||
private ManagedList<BeanMetadataElement> headerWriters;
|
||||
|
||||
public BeanDefinition parse(Element element, ParserContext parserContext) {
|
||||
headerWriters = new ManagedList<BeanMetadataElement>();
|
||||
headerWriters = new ManagedList<>();
|
||||
BeanDefinitionBuilder builder = BeanDefinitionBuilder
|
||||
.rootBeanDefinition(HeaderWriterFilter.class);
|
||||
|
||||
@@ -220,7 +220,7 @@ public class HeadersBeanDefinitionParser implements BeanDefinitionParser {
|
||||
if (pinsElement != null) {
|
||||
List<Element> pinElements = DomUtils.getChildElements(pinsElement);
|
||||
|
||||
Map<String, String> pins = new LinkedHashMap<String, String>();
|
||||
Map<String, String> pins = new LinkedHashMap<>();
|
||||
|
||||
for (Element pinElement : pinElements) {
|
||||
String hash = pinElement.getAttribute(ATT_ALGORITHM);
|
||||
|
||||
+5
-5
@@ -370,7 +370,7 @@ class HttpConfigurationBuilder {
|
||||
boolean sessionFixationProtectionRequired = !sessionFixationAttribute
|
||||
.equals(OPT_SESSION_FIXATION_NO_PROTECTION);
|
||||
|
||||
ManagedList<BeanMetadataElement> delegateSessionStrategies = new ManagedList<BeanMetadataElement>();
|
||||
ManagedList<BeanMetadataElement> delegateSessionStrategies = new ManagedList<>();
|
||||
BeanDefinitionBuilder concurrentSessionStrategy;
|
||||
BeanDefinitionBuilder sessionFixationStrategy = null;
|
||||
BeanDefinitionBuilder registerSessionStrategy;
|
||||
@@ -601,7 +601,7 @@ class HttpConfigurationBuilder {
|
||||
metadataSourceBldr.getBeanDefinition());
|
||||
RootBeanDefinition channelDecisionManager = new RootBeanDefinition(
|
||||
ChannelDecisionManagerImpl.class);
|
||||
ManagedList<RootBeanDefinition> channelProcessors = new ManagedList<RootBeanDefinition>(
|
||||
ManagedList<RootBeanDefinition> channelProcessors = new ManagedList<>(
|
||||
3);
|
||||
RootBeanDefinition secureChannelProcessor = new RootBeanDefinition(
|
||||
SecureChannelProcessor.class);
|
||||
@@ -639,7 +639,7 @@ class HttpConfigurationBuilder {
|
||||
*/
|
||||
private ManagedMap<BeanMetadataElement, BeanDefinition> parseInterceptUrlsForChannelSecurity() {
|
||||
|
||||
ManagedMap<BeanMetadataElement, BeanDefinition> channelRequestMap = new ManagedMap<BeanMetadataElement, BeanDefinition>();
|
||||
ManagedMap<BeanMetadataElement, BeanDefinition> channelRequestMap = new ManagedMap<>();
|
||||
|
||||
for (Element urlElt : interceptUrls) {
|
||||
String path = urlElt.getAttribute(ATT_PATH_PATTERN);
|
||||
@@ -719,7 +719,7 @@ class HttpConfigurationBuilder {
|
||||
.createSecurityMetadataSource(interceptUrls, addAllAuth, httpElt, pc);
|
||||
|
||||
RootBeanDefinition accessDecisionMgr;
|
||||
ManagedList<BeanDefinition> voters = new ManagedList<BeanDefinition>(2);
|
||||
ManagedList<BeanDefinition> voters = new ManagedList<>(2);
|
||||
|
||||
if (useExpressions) {
|
||||
BeanDefinitionBuilder expressionVoter = BeanDefinitionBuilder
|
||||
@@ -820,7 +820,7 @@ class HttpConfigurationBuilder {
|
||||
}
|
||||
|
||||
List<OrderDecorator> getFilters() {
|
||||
List<OrderDecorator> filters = new ArrayList<OrderDecorator>();
|
||||
List<OrderDecorator> filters = new ArrayList<>();
|
||||
|
||||
if (cpf != null) {
|
||||
filters.add(new OrderDecorator(cpf, CHANNEL_FILTER));
|
||||
|
||||
+4
-4
@@ -138,7 +138,7 @@ public class HttpSecurityBeanDefinitionParser implements BeanDefinitionParser {
|
||||
final BeanReference portMapper = createPortMapper(element, pc);
|
||||
final BeanReference portResolver = createPortResolver(portMapper, pc);
|
||||
|
||||
ManagedList<BeanReference> authenticationProviders = new ManagedList<BeanReference>();
|
||||
ManagedList<BeanReference> authenticationProviders = new ManagedList<>();
|
||||
BeanReference authenticationManager = createAuthenticationManager(element, pc,
|
||||
authenticationProviders);
|
||||
|
||||
@@ -158,7 +158,7 @@ public class HttpSecurityBeanDefinitionParser implements BeanDefinitionParser {
|
||||
|
||||
authenticationProviders.addAll(authBldr.getProviders());
|
||||
|
||||
List<OrderDecorator> unorderedFilterChain = new ArrayList<OrderDecorator>();
|
||||
List<OrderDecorator> unorderedFilterChain = new ArrayList<>();
|
||||
|
||||
unorderedFilterChain.addAll(httpBldr.getFilters());
|
||||
unorderedFilterChain.addAll(authBldr.getFilters());
|
||||
@@ -168,7 +168,7 @@ public class HttpSecurityBeanDefinitionParser implements BeanDefinitionParser {
|
||||
checkFilterChainOrder(unorderedFilterChain, pc, pc.extractSource(element));
|
||||
|
||||
// The list of filter beans
|
||||
List<BeanMetadataElement> filterChain = new ManagedList<BeanMetadataElement>();
|
||||
List<BeanMetadataElement> filterChain = new ManagedList<>();
|
||||
|
||||
for (OrderDecorator od : unorderedFilterChain) {
|
||||
filterChain.add(od.bean);
|
||||
@@ -330,7 +330,7 @@ public class HttpSecurityBeanDefinitionParser implements BeanDefinitionParser {
|
||||
List<OrderDecorator> buildCustomFilterList(Element element, ParserContext pc) {
|
||||
List<Element> customFilterElts = DomUtils.getChildElementsByTagName(element,
|
||||
Elements.CUSTOM_FILTER);
|
||||
List<OrderDecorator> customFilters = new ArrayList<OrderDecorator>();
|
||||
List<OrderDecorator> customFilters = new ArrayList<>();
|
||||
|
||||
final String ATT_AFTER = "after";
|
||||
final String ATT_BEFORE = "before";
|
||||
|
||||
+1
-1
@@ -45,7 +45,7 @@ class LogoutBeanDefinitionParser implements BeanDefinitionParser {
|
||||
|
||||
final String rememberMeServices;
|
||||
private final String defaultLogoutUrl;
|
||||
private ManagedList<BeanMetadataElement> logoutHandlers = new ManagedList<BeanMetadataElement>();
|
||||
private ManagedList<BeanMetadataElement> logoutHandlers = new ManagedList<>();
|
||||
private boolean csrfEnabled;
|
||||
|
||||
public LogoutBeanDefinitionParser(String loginPageUrl, String rememberMeServices,
|
||||
|
||||
+3
-3
@@ -113,7 +113,7 @@ public class GlobalMethodSecurityBeanDefinitionParser implements BeanDefinitionP
|
||||
|
||||
Object source = pc.extractSource(element);
|
||||
// The list of method metadata delegates
|
||||
ManagedList<BeanMetadataElement> delegates = new ManagedList<BeanMetadataElement>();
|
||||
ManagedList<BeanMetadataElement> delegates = new ManagedList<>();
|
||||
|
||||
boolean jsr250Enabled = "enabled".equals(element.getAttribute(ATT_USE_JSR250));
|
||||
boolean useSecured = "enabled".equals(element.getAttribute(ATT_USE_SECURED));
|
||||
@@ -122,7 +122,7 @@ public class GlobalMethodSecurityBeanDefinitionParser implements BeanDefinitionP
|
||||
boolean useAspectJ = "aspectj".equals(element.getAttribute(ATT_MODE));
|
||||
|
||||
BeanDefinition preInvocationVoter = null;
|
||||
ManagedList<BeanMetadataElement> afterInvocationProviders = new ManagedList<BeanMetadataElement>();
|
||||
ManagedList<BeanMetadataElement> afterInvocationProviders = new ManagedList<>();
|
||||
|
||||
// Check for an external SecurityMetadataSource, which takes priority over other
|
||||
// sources
|
||||
@@ -399,7 +399,7 @@ public class GlobalMethodSecurityBeanDefinitionParser implements BeanDefinitionP
|
||||
|
||||
String[] attributeTokens = StringUtils
|
||||
.commaDelimitedListToStringArray(accessConfig);
|
||||
List<ConfigAttribute> attributes = new ArrayList<ConfigAttribute>(
|
||||
List<ConfigAttribute> attributes = new ArrayList<>(
|
||||
attributeTokens.length);
|
||||
|
||||
for (String token : attributeTokens) {
|
||||
|
||||
+1
-1
@@ -88,7 +88,7 @@ class InternalInterceptMethodsBeanDefinitionDecorator extends
|
||||
// Parse the included methods
|
||||
List<Element> methods = DomUtils.getChildElementsByTagName(interceptMethodsElt,
|
||||
Elements.PROTECT);
|
||||
Map<String, BeanDefinition> mappings = new ManagedMap<String, BeanDefinition>();
|
||||
Map<String, BeanDefinition> mappings = new ManagedMap<>();
|
||||
|
||||
for (Element protectmethodElt : methods) {
|
||||
BeanDefinitionBuilder attributeBuilder = BeanDefinitionBuilder
|
||||
|
||||
+3
-3
@@ -64,9 +64,9 @@ final class ProtectPointcutPostProcessor implements BeanPostProcessor {
|
||||
|
||||
private final Map<String, List<ConfigAttribute>> pointcutMap = new LinkedHashMap<String, List<ConfigAttribute>>();
|
||||
private final MapBasedMethodSecurityMetadataSource mapBasedMethodSecurityMetadataSource;
|
||||
private final Set<PointcutExpression> pointCutExpressions = new LinkedHashSet<PointcutExpression>();
|
||||
private final Set<PointcutExpression> pointCutExpressions = new LinkedHashSet<>();
|
||||
private final PointcutParser parser;
|
||||
private final Set<String> processedBeans = new HashSet<String>();
|
||||
private final Set<String> processedBeans = new HashSet<>();
|
||||
|
||||
public ProtectPointcutPostProcessor(
|
||||
MapBasedMethodSecurityMetadataSource mapBasedMethodSecurityMetadataSource) {
|
||||
@@ -75,7 +75,7 @@ final class ProtectPointcutPostProcessor implements BeanPostProcessor {
|
||||
this.mapBasedMethodSecurityMetadataSource = mapBasedMethodSecurityMetadataSource;
|
||||
|
||||
// Set up AspectJ pointcut expression parser
|
||||
Set<PointcutPrimitive> supportedPrimitives = new HashSet<PointcutPrimitive>(3);
|
||||
Set<PointcutPrimitive> supportedPrimitives = new HashSet<>(3);
|
||||
supportedPrimitives.add(PointcutPrimitive.EXECUTION);
|
||||
supportedPrimitives.add(PointcutPrimitive.ARGS);
|
||||
supportedPrimitives.add(PointcutPrimitive.REFERENCE);
|
||||
|
||||
+5
-5
@@ -116,7 +116,7 @@ public final class WebSocketMessageBrokerSecurityBeanDefinitionParser implements
|
||||
BeanDefinitionRegistry registry = parserContext.getRegistry();
|
||||
XmlReaderContext context = parserContext.getReaderContext();
|
||||
|
||||
ManagedMap<BeanDefinition, String> matcherToExpression = new ManagedMap<BeanDefinition, String>();
|
||||
ManagedMap<BeanDefinition, String> matcherToExpression = new ManagedMap<>();
|
||||
|
||||
String id = element.getAttribute(ID_ATTR);
|
||||
Element expressionHandlerElt = DomUtils.getChildElementByTagName(element,
|
||||
@@ -149,7 +149,7 @@ public final class WebSocketMessageBrokerSecurityBeanDefinitionParser implements
|
||||
|
||||
String mdsId = context.registerWithGeneratedName(mds.getBeanDefinition());
|
||||
|
||||
ManagedList<BeanDefinition> voters = new ManagedList<BeanDefinition>();
|
||||
ManagedList<BeanDefinition> voters = new ManagedList<>();
|
||||
BeanDefinitionBuilder messageExpressionVoterBldr = BeanDefinitionBuilder.rootBeanDefinition(MessageExpressionVoter.class);
|
||||
if(expressionHandlerDefined) {
|
||||
messageExpressionVoterBldr.addPropertyReference("expressionHandler", expressionHandlerRef);
|
||||
@@ -259,7 +259,7 @@ public final class WebSocketMessageBrokerSecurityBeanDefinitionParser implements
|
||||
WEB_SOCKET_AMMH_CLASS_NAME.equals(beanClassName)) {
|
||||
PropertyValue current = bd.getPropertyValues().getPropertyValue(
|
||||
CUSTOM_ARG_RESOLVERS_PROP);
|
||||
ManagedList<Object> argResolvers = new ManagedList<Object>();
|
||||
ManagedList<Object> argResolvers = new ManagedList<>();
|
||||
if (current != null) {
|
||||
argResolvers.addAll((ManagedList<?>) current.getValue());
|
||||
}
|
||||
@@ -322,7 +322,7 @@ public final class WebSocketMessageBrokerSecurityBeanDefinitionParser implements
|
||||
return;
|
||||
}
|
||||
String interceptorPropertyName = "handshakeInterceptors";
|
||||
ManagedList<? super Object> interceptors = new ManagedList<Object>();
|
||||
ManagedList<? super Object> interceptors = new ManagedList<>();
|
||||
interceptors.add(new RootBeanDefinition(CsrfTokenHandshakeInterceptor.class));
|
||||
interceptors.addAll((ManagedList<Object>) bd.getPropertyValues().get(
|
||||
interceptorPropertyName));
|
||||
@@ -371,4 +371,4 @@ public final class WebSocketMessageBrokerSecurityBeanDefinitionParser implements
|
||||
this.delegate = pathMatcher;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
+1
-1
@@ -31,7 +31,7 @@ public class ObjectPostProcessorTests {
|
||||
|
||||
@Test
|
||||
public void convertTypes() {
|
||||
assertThat((Object) PerformConversion.perform(new ArrayList<Object>()))
|
||||
assertThat((Object) PerformConversion.perform(new ArrayList<>()))
|
||||
.isInstanceOf(LinkedList.class);
|
||||
}
|
||||
}
|
||||
|
||||
+1
-1
@@ -25,7 +25,7 @@ public class DisableUseExpressionsConfig extends BaseWebConfig {
|
||||
protected void configure(HttpSecurity http) throws Exception {
|
||||
// This config is also on UrlAuthorizationConfigurer javadoc
|
||||
http
|
||||
.apply(new UrlAuthorizationConfigurer<HttpSecurity>(getApplicationContext())).getRegistry()
|
||||
.apply(new UrlAuthorizationConfigurer<>(getApplicationContext())).getRegistry()
|
||||
.antMatchers("/users**", "/sessions/**").hasRole("USER")
|
||||
.antMatchers("/signup").hasRole("ANONYMOUS")
|
||||
.anyRequest().hasRole("USER");
|
||||
|
||||
+2
-2
@@ -24,8 +24,8 @@ import java.util.*;
|
||||
* @author Luke Taylor
|
||||
*/
|
||||
public class BeanNameCollectingPostProcessor implements BeanPostProcessor {
|
||||
Set<String> beforeInitPostProcessedBeans = new HashSet<String>();
|
||||
Set<String> afterInitPostProcessedBeans = new HashSet<String>();
|
||||
Set<String> beforeInitPostProcessedBeans = new HashSet<>();
|
||||
Set<String> afterInitPostProcessedBeans = new HashSet<>();
|
||||
|
||||
public Object postProcessBeforeInitialization(Object bean, String beanName)
|
||||
throws BeansException {
|
||||
|
||||
@@ -30,10 +30,10 @@ import org.springframework.security.authentication.event.AbstractAuthenticationF
|
||||
* @since 3.1
|
||||
*/
|
||||
public class CollectingAppListener implements ApplicationListener {
|
||||
Set<ApplicationEvent> events = new HashSet<ApplicationEvent>();
|
||||
Set<AbstractAuthenticationEvent> authenticationEvents = new HashSet<AbstractAuthenticationEvent>();
|
||||
Set<AbstractAuthenticationFailureEvent> authenticationFailureEvents = new HashSet<AbstractAuthenticationFailureEvent>();
|
||||
Set<AbstractAuthorizationEvent> authorizationEvents = new HashSet<AbstractAuthorizationEvent>();
|
||||
Set<ApplicationEvent> events = new HashSet<>();
|
||||
Set<AbstractAuthenticationEvent> authenticationEvents = new HashSet<>();
|
||||
Set<AbstractAuthenticationFailureEvent> authenticationFailureEvents = new HashSet<>();
|
||||
Set<AbstractAuthorizationEvent> authorizationEvents = new HashSet<>();
|
||||
|
||||
public void onApplicationEvent(ApplicationEvent event) {
|
||||
if (event instanceof AbstractAuthenticationEvent) {
|
||||
|
||||
+1
-1
@@ -24,7 +24,7 @@ import java.util.List;
|
||||
*/
|
||||
class ConcereteSecurityConfigurerAdapter extends
|
||||
SecurityConfigurerAdapter<Object, SecurityBuilder<Object>> {
|
||||
private List<Object> list = new ArrayList<Object>();
|
||||
private List<Object> list = new ArrayList<>();
|
||||
|
||||
@Override
|
||||
public void configure(SecurityBuilder<Object> builder) throws Exception {
|
||||
|
||||
+1
-1
@@ -30,7 +30,7 @@ public class LdapAuthenticationProviderConfigurerTest {
|
||||
|
||||
@Before
|
||||
public void setUp() {
|
||||
configurer = new LdapAuthenticationProviderConfigurer<AuthenticationManagerBuilder>();
|
||||
configurer = new LdapAuthenticationProviderConfigurer<>();
|
||||
}
|
||||
|
||||
// SEC-2557
|
||||
|
||||
+2
-2
@@ -107,14 +107,14 @@ public class AbstractSecurityWebSocketMessageBrokerConfigurerDocTests {
|
||||
|
||||
private Message<String> message(SimpMessageHeaderAccessor headers, String destination) {
|
||||
headers.setSessionId("123");
|
||||
headers.setSessionAttributes(new HashMap<String, Object>());
|
||||
headers.setSessionAttributes(new HashMap<>());
|
||||
if (destination != null) {
|
||||
headers.setDestination(destination);
|
||||
}
|
||||
if (messageUser != null) {
|
||||
headers.setUser(messageUser);
|
||||
}
|
||||
return new GenericMessage<String>("hi", headers.getMessageHeaders());
|
||||
return new GenericMessage<>("hi", headers.getMessageHeaders());
|
||||
}
|
||||
|
||||
@Controller
|
||||
|
||||
+2
-2
@@ -511,14 +511,14 @@ public class AbstractSecurityWebSocketMessageBrokerConfigurerTests {
|
||||
|
||||
private Message<String> message(SimpMessageHeaderAccessor headers, String destination) {
|
||||
headers.setSessionId("123");
|
||||
headers.setSessionAttributes(new HashMap<String, Object>());
|
||||
headers.setSessionAttributes(new HashMap<>());
|
||||
if (destination != null) {
|
||||
headers.setDestination(destination);
|
||||
}
|
||||
if (messageUser != null) {
|
||||
headers.setUser(messageUser);
|
||||
}
|
||||
return new GenericMessage<String>("hi", headers.getMessageHeaders());
|
||||
return new GenericMessage<>("hi", headers.getMessageHeaders());
|
||||
}
|
||||
|
||||
private MessageChannel clientInboundChannel() {
|
||||
|
||||
+1
-1
@@ -114,7 +114,7 @@ public class AuthenticationManagerBeanDefinitionParserTests {
|
||||
|
||||
private static class AuthListener implements
|
||||
ApplicationListener<AbstractAuthenticationEvent> {
|
||||
List<AbstractAuthenticationEvent> events = new ArrayList<AbstractAuthenticationEvent>();
|
||||
List<AbstractAuthenticationEvent> events = new ArrayList<>();
|
||||
|
||||
public void onApplicationEvent(AbstractAuthenticationEvent event) {
|
||||
this.events.add(event);
|
||||
|
||||
+1
-1
@@ -287,7 +287,7 @@ public class GlobalMethodSecurityBeanDefinitionParserTests {
|
||||
+ AUTH_PROVIDER_XML);
|
||||
SecurityContextHolder.getContext().setAuthentication(bob);
|
||||
target = (BusinessService) appContext.getBean("target");
|
||||
List<String> arg = new ArrayList<String>();
|
||||
List<String> arg = new ArrayList<>();
|
||||
arg.add("joe");
|
||||
arg.add("bob");
|
||||
arg.add("sam");
|
||||
|
||||
Reference in New Issue
Block a user