Cleanup explicit type arguments
This commit is contained in:
parent
c5b5cc507c
commit
3ea9d376b2
|
@ -55,10 +55,10 @@ public abstract class AbstractConfiguredSecurityBuilder<O, B extends SecurityBui
|
|||
extends AbstractSecurityBuilder<O> {
|
||||
private final Log logger = LogFactory.getLog(getClass());
|
||||
|
||||
private final LinkedHashMap<Class<? extends SecurityConfigurer<O, B>>, List<SecurityConfigurer<O, B>>> configurers = new LinkedHashMap<Class<? extends SecurityConfigurer<O, B>>, List<SecurityConfigurer<O, B>>>();
|
||||
private final List<SecurityConfigurer<O, B>> configurersAddedInInitializing = new ArrayList<SecurityConfigurer<O, B>>();
|
||||
private final LinkedHashMap<Class<? extends SecurityConfigurer<O, B>>, List<SecurityConfigurer<O, B>>> configurers = new LinkedHashMap<>();
|
||||
private final List<SecurityConfigurer<O, B>> configurersAddedInInitializing = new ArrayList<>();
|
||||
|
||||
private final Map<Class<? extends Object>, Object> sharedObjects = new HashMap<Class<? extends Object>, Object>();
|
||||
private final Map<Class<? extends Object>, Object> sharedObjects = new HashMap<>();
|
||||
|
||||
private final boolean allowConfigurersOfSameType;
|
||||
|
||||
|
@ -199,7 +199,7 @@ public abstract class AbstractConfiguredSecurityBuilder<O, B extends SecurityBui
|
|||
List<SecurityConfigurer<O, B>> configs = allowConfigurersOfSameType ? this.configurers
|
||||
.get(clazz) : null;
|
||||
if (configs == null) {
|
||||
configs = new ArrayList<SecurityConfigurer<O, B>>(1);
|
||||
configs = new ArrayList<>(1);
|
||||
}
|
||||
configs.add(configurer);
|
||||
this.configurers.put(clazz, configs);
|
||||
|
@ -386,7 +386,7 @@ public abstract class AbstractConfiguredSecurityBuilder<O, B extends SecurityBui
|
|||
}
|
||||
|
||||
private Collection<SecurityConfigurer<O, B>> getConfigurers() {
|
||||
List<SecurityConfigurer<O, B>> result = new ArrayList<SecurityConfigurer<O, B>>();
|
||||
List<SecurityConfigurer<O, B>> result = new ArrayList<>();
|
||||
for (List<SecurityConfigurer<O, B>> configs : this.configurers.values()) {
|
||||
result.addAll(configs);
|
||||
}
|
||||
|
|
|
@ -111,7 +111,7 @@ public abstract class SecurityConfigurerAdapter<O, B extends SecurityBuilder<O>>
|
|||
*/
|
||||
private static final class CompositeObjectPostProcessor implements
|
||||
ObjectPostProcessor<Object> {
|
||||
private List<ObjectPostProcessor<? extends Object>> postProcessors = new ArrayList<ObjectPostProcessor<?>>();
|
||||
private List<ObjectPostProcessor<? extends Object>> postProcessors = new ArrayList<>();
|
||||
|
||||
@SuppressWarnings({ "rawtypes", "unchecked" })
|
||||
public Object postProcess(Object object) {
|
||||
|
|
|
@ -241,7 +241,7 @@ public class GlobalMethodSecurityConfiguration
|
|||
* @return the {@link AccessDecisionManager} to use
|
||||
*/
|
||||
protected AccessDecisionManager accessDecisionManager() {
|
||||
List<AccessDecisionVoter<? extends Object>> decisionVoters = new ArrayList<AccessDecisionVoter<? extends Object>>();
|
||||
List<AccessDecisionVoter<? extends Object>> decisionVoters = new ArrayList<>();
|
||||
ExpressionBasedPreInvocationAdvice expressionAdvice = new ExpressionBasedPreInvocationAdvice();
|
||||
expressionAdvice.setExpressionHandler(getExpressionHandler());
|
||||
if (prePostEnabled()) {
|
||||
|
|
|
@ -83,7 +83,7 @@ public final class WebSecurity extends
|
|||
|
||||
private final List<RequestMatcher> ignoredRequests = new ArrayList<>();
|
||||
|
||||
private final List<SecurityBuilder<? extends SecurityFilterChain>> securityFilterChainBuilders = new ArrayList<SecurityBuilder<? extends SecurityFilterChain>>();
|
||||
private final List<SecurityBuilder<? extends SecurityFilterChain>> securityFilterChainBuilders = new ArrayList<>();
|
||||
|
||||
private IgnoredRequestConfigurer ignoredRequestRegistry;
|
||||
|
||||
|
|
|
@ -48,7 +48,7 @@ final class AutowiredWebSecurityConfigurersIgnoreParents {
|
|||
|
||||
@SuppressWarnings({ "rawtypes", "unchecked" })
|
||||
public List<SecurityConfigurer<Filter, WebSecurity>> getWebSecurityConfigurers() {
|
||||
List<SecurityConfigurer<Filter, WebSecurity>> webSecurityConfigurers = new ArrayList<SecurityConfigurer<Filter, WebSecurity>>();
|
||||
List<SecurityConfigurer<Filter, WebSecurity>> webSecurityConfigurers = new ArrayList<>();
|
||||
Map<String, WebSecurityConfigurer> beansOfType = beanFactory
|
||||
.getBeansOfType(WebSecurityConfigurer.class);
|
||||
for (Entry<String, WebSecurityConfigurer> entry : beansOfType.entrySet()) {
|
||||
|
@ -56,4 +56,4 @@ final class AutowiredWebSecurityConfigurersIgnoreParents {
|
|||
}
|
||||
return webSecurityConfigurers;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -415,7 +415,7 @@ public abstract class WebSecurityConfigurerAdapter implements
|
|||
* @return the shared Objects
|
||||
*/
|
||||
private Map<Class<? extends Object>, Object> createSharedObjects() {
|
||||
Map<Class<? extends Object>, Object> sharedObjects = new HashMap<Class<? extends Object>, Object>();
|
||||
Map<Class<? extends Object>, Object> sharedObjects = new HashMap<>();
|
||||
sharedObjects.putAll(localConfigureAuthenticationBldr.getSharedObjects());
|
||||
sharedObjects.put(UserDetailsService.class, userDetailsService());
|
||||
sharedObjects.put(ApplicationContext.class, context);
|
||||
|
|
|
@ -114,7 +114,7 @@ public abstract class AbstractConfigAttributeRequestMatcherRegistry<C> extends
|
|||
+ ". Try completing it with something like requestUrls().<something>.hasRole('USER')");
|
||||
}
|
||||
|
||||
LinkedHashMap<RequestMatcher, Collection<ConfigAttribute>> requestMap = new LinkedHashMap<RequestMatcher, Collection<ConfigAttribute>>();
|
||||
LinkedHashMap<RequestMatcher, Collection<ConfigAttribute>> requestMap = new LinkedHashMap<>();
|
||||
for (UrlMapping mapping : getUrlMappings()) {
|
||||
RequestMatcher matcher = mapping.getRequestMatcher();
|
||||
Collection<ConfigAttribute> configAttrs = mapping.getConfigAttrs();
|
||||
|
|
|
@ -80,7 +80,7 @@ import org.springframework.security.web.util.matcher.RequestMatcher;
|
|||
public final class ChannelSecurityConfigurer<H extends HttpSecurityBuilder<H>> extends
|
||||
AbstractHttpConfigurer<ChannelSecurityConfigurer<H>, H> {
|
||||
private ChannelProcessingFilter channelFilter = new ChannelProcessingFilter();
|
||||
private LinkedHashMap<RequestMatcher, Collection<ConfigAttribute>> requestMap = new LinkedHashMap<RequestMatcher, Collection<ConfigAttribute>>();
|
||||
private LinkedHashMap<RequestMatcher, Collection<ConfigAttribute>> requestMap = new LinkedHashMap<>();
|
||||
private List<ChannelProcessor> channelProcessors;
|
||||
|
||||
private final ChannelRequestMatcherRegistry REGISTRY;
|
||||
|
@ -240,4 +240,4 @@ public final class ChannelSecurityConfigurer<H extends HttpSecurityBuilder<H>> e
|
|||
return addAttribute(attribute, requestMatchers);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -284,7 +284,7 @@ public final class CsrfConfigurer<H extends HttpSecurityBuilder<H>>
|
|||
|
||||
InvalidSessionAccessDeniedHandler invalidSessionDeniedHandler = new InvalidSessionAccessDeniedHandler(
|
||||
invalidSessionStrategy);
|
||||
LinkedHashMap<Class<? extends AccessDeniedException>, AccessDeniedHandler> handlers = new LinkedHashMap<Class<? extends AccessDeniedException>, AccessDeniedHandler>();
|
||||
LinkedHashMap<Class<? extends AccessDeniedException>, AccessDeniedHandler> handlers = new LinkedHashMap<>();
|
||||
handlers.put(MissingCsrfTokenException.class, invalidSessionDeniedHandler);
|
||||
return new DelegatingAccessDeniedHandler(handlers, defaultAccessDeniedHandler);
|
||||
}
|
||||
|
|
|
@ -184,7 +184,7 @@ public final class ExpressionUrlAuthorizationConfigurer<H extends HttpSecurityBu
|
|||
@Override
|
||||
@SuppressWarnings("rawtypes")
|
||||
final List<AccessDecisionVoter<? extends Object>> getDecisionVoters(H http) {
|
||||
List<AccessDecisionVoter<? extends Object>> decisionVoters = new ArrayList<AccessDecisionVoter<? extends Object>>();
|
||||
List<AccessDecisionVoter<? extends Object>> decisionVoters = new ArrayList<>();
|
||||
WebExpressionVoter expressionVoter = new WebExpressionVoter();
|
||||
expressionVoter.setExpressionHandler(getExpressionHandler(http));
|
||||
decisionVoters.add(expressionVoter);
|
||||
|
|
|
@ -173,7 +173,7 @@ public final class UrlAuthorizationConfigurer<H extends HttpSecurityBuilder<H>>
|
|||
@Override
|
||||
@SuppressWarnings("rawtypes")
|
||||
final List<AccessDecisionVoter<? extends Object>> getDecisionVoters(H http) {
|
||||
List<AccessDecisionVoter<? extends Object>> decisionVoters = new ArrayList<AccessDecisionVoter<? extends Object>>();
|
||||
List<AccessDecisionVoter<? extends Object>> decisionVoters = new ArrayList<>();
|
||||
decisionVoters.add(new RoleVoter());
|
||||
decisionVoters.add(new AuthenticatedVoter());
|
||||
return decisionVoters;
|
||||
|
|
|
@ -321,7 +321,7 @@ public final class OpenIDLoginConfigurer<H extends HttpSecurityBuilder<H>> exten
|
|||
* @return the {@link AxFetchListFactory} to use
|
||||
*/
|
||||
private AxFetchListFactory attributesToFetchFactory() {
|
||||
Map<String, List<OpenIDAttribute>> identityToAttrs = new HashMap<String, List<OpenIDAttribute>>();
|
||||
Map<String, List<OpenIDAttribute>> identityToAttrs = new HashMap<>();
|
||||
for (AttributeExchangeConfigurer conf : this.attributeExchangeConfigurers) {
|
||||
identityToAttrs.put(conf.identifier, conf.getAttributes());
|
||||
}
|
||||
|
|
|
@ -233,7 +233,7 @@ public class MessageSecurityMetadataSourceRegistry {
|
|||
* @return the {@link MessageSecurityMetadataSource} to use
|
||||
*/
|
||||
protected MessageSecurityMetadataSource createMetadataSource() {
|
||||
LinkedHashMap<MessageMatcher<?>, String> matcherToExpression = new LinkedHashMap<MessageMatcher<?>, String>();
|
||||
LinkedHashMap<MessageMatcher<?>, String> matcherToExpression = new LinkedHashMap<>();
|
||||
for (Map.Entry<MatcherBuilder, String> entry : this.matcherToExpression
|
||||
.entrySet()) {
|
||||
matcherToExpression.put(entry.getKey().build(), entry.getValue());
|
||||
|
|
|
@ -159,7 +159,7 @@ public abstract class AbstractSecurityWebSocketMessageBrokerConfigurer extends
|
|||
MessageExpressionVoter<Object> voter = new MessageExpressionVoter<>();
|
||||
voter.setExpressionHandler(getMessageExpressionHandler());
|
||||
|
||||
List<AccessDecisionVoter<? extends Object>> voters = new ArrayList<AccessDecisionVoter<? extends Object>>();
|
||||
List<AccessDecisionVoter<? extends Object>> voters = new ArrayList<>();
|
||||
voters.add(voter);
|
||||
|
||||
AffirmativeBased manager = new AffirmativeBased(voters);
|
||||
|
|
|
@ -43,7 +43,7 @@ public class PasswordEncoderParser {
|
|||
private static final Map<String, Class<?>> ENCODER_CLASSES;
|
||||
|
||||
static {
|
||||
ENCODER_CLASSES = new HashMap<String, Class<?>>();
|
||||
ENCODER_CLASSES = new HashMap<>();
|
||||
ENCODER_CLASSES.put(OPT_HASH_BCRYPT, BCryptPasswordEncoder.class);
|
||||
}
|
||||
|
||||
|
|
|
@ -261,7 +261,7 @@ final class AuthenticationConfigBuilder {
|
|||
.rootBeanDefinition(OPEN_ID_CONSUMER_CLASS);
|
||||
BeanDefinitionBuilder axFactory = BeanDefinitionBuilder
|
||||
.rootBeanDefinition(OPEN_ID_ATTRIBUTE_FACTORY_CLASS);
|
||||
ManagedMap<String, ManagedList<BeanDefinition>> axMap = new ManagedMap<String, ManagedList<BeanDefinition>>();
|
||||
ManagedMap<String, ManagedList<BeanDefinition>> axMap = new ManagedMap<>();
|
||||
|
||||
for (Element attrExElt : attrExElts) {
|
||||
String identifierMatch = attrExElt.getAttribute("identifier-match");
|
||||
|
|
|
@ -144,7 +144,7 @@ public class CsrfBeanDefinitionParser implements BeanDefinitionParser {
|
|||
if (invalidSessionStrategy == null) {
|
||||
return defaultDeniedHandler;
|
||||
}
|
||||
ManagedMap<Class<? extends AccessDeniedException>, BeanDefinition> handlers = new ManagedMap<Class<? extends AccessDeniedException>, BeanDefinition>();
|
||||
ManagedMap<Class<? extends AccessDeniedException>, BeanDefinition> handlers = new ManagedMap<>();
|
||||
BeanDefinitionBuilder invalidSessionHandlerBldr = BeanDefinitionBuilder
|
||||
.rootBeanDefinition(InvalidSessionAccessDeniedHandler.class);
|
||||
invalidSessionHandlerBldr.addConstructorArgValue(invalidSessionStrategy);
|
||||
|
|
|
@ -381,7 +381,7 @@ public class GlobalMethodSecurityBeanDefinitionParser implements BeanDefinitionP
|
|||
|
||||
private Map<String, List<ConfigAttribute>> parseProtectPointcuts(
|
||||
ParserContext parserContext, List<Element> protectPointcutElts) {
|
||||
Map<String, List<ConfigAttribute>> pointcutMap = new LinkedHashMap<String, List<ConfigAttribute>>();
|
||||
Map<String, List<ConfigAttribute>> pointcutMap = new LinkedHashMap<>();
|
||||
|
||||
for (Element childElt : protectPointcutElts) {
|
||||
String accessConfig = childElt.getAttribute(ATT_ACCESS);
|
||||
|
|
|
@ -44,7 +44,7 @@ public class MethodSecurityMetadataSourceBeanDefinitionParser extends
|
|||
public AbstractBeanDefinition parseInternal(Element elt, ParserContext pc) {
|
||||
// Parse the included methods
|
||||
List<Element> methods = DomUtils.getChildElementsByTagName(elt, Elements.PROTECT);
|
||||
Map<String, List<ConfigAttribute>> mappings = new LinkedHashMap<String, List<ConfigAttribute>>();
|
||||
Map<String, List<ConfigAttribute>> mappings = new LinkedHashMap<>();
|
||||
|
||||
for (Element protectmethodElt : methods) {
|
||||
String[] tokens = StringUtils
|
||||
|
|
|
@ -62,7 +62,7 @@ final class ProtectPointcutPostProcessor implements BeanPostProcessor {
|
|||
private static final Log logger = LogFactory
|
||||
.getLog(ProtectPointcutPostProcessor.class);
|
||||
|
||||
private final Map<String, List<ConfigAttribute>> pointcutMap = new LinkedHashMap<String, List<ConfigAttribute>>();
|
||||
private final Map<String, List<ConfigAttribute>> pointcutMap = new LinkedHashMap<>();
|
||||
private final MapBasedMethodSecurityMetadataSource mapBasedMethodSecurityMetadataSource;
|
||||
private final Set<PointcutExpression> pointCutExpressions = new LinkedHashSet<>();
|
||||
private final PointcutParser parser;
|
||||
|
|
|
@ -368,8 +368,8 @@ public class GlobalMethodSecurityConfigurationTests {
|
|||
}
|
||||
|
||||
static class MockBeanPostProcessor implements BeanPostProcessor {
|
||||
Map<String, Object> beforeInit = new HashMap<String, Object>();
|
||||
Map<String, Object> afterInit = new HashMap<String, Object>();
|
||||
Map<String, Object> beforeInit = new HashMap<>();
|
||||
Map<String, Object> afterInit = new HashMap<>();
|
||||
|
||||
@Override
|
||||
public Object postProcessBeforeInitialization(Object bean, String beanName) throws
|
||||
|
|
|
@ -176,7 +176,7 @@ public class RoleHierarchyImpl implements RoleHierarchy {
|
|||
* will become a key that references a set of the reachable lower roles.
|
||||
*/
|
||||
private void buildRolesReachableInOneStepMap() {
|
||||
this.rolesReachableInOneStepMap = new HashMap<GrantedAuthority, Set<GrantedAuthority>>();
|
||||
this.rolesReachableInOneStepMap = new HashMap<>();
|
||||
try (BufferedReader bufferedReader = new BufferedReader(
|
||||
new StringReader(this.roleHierarchyStringRepresentation))) {
|
||||
for (String readLine; (readLine = bufferedReader.readLine()) != null;) {
|
||||
|
@ -187,7 +187,7 @@ public class RoleHierarchyImpl implements RoleHierarchy {
|
|||
GrantedAuthority lowerRole = new SimpleGrantedAuthority(roles[i].replaceAll("^\\s+|\\s+$", ""));
|
||||
Set<GrantedAuthority> rolesReachableInOneStepSet;
|
||||
if (!this.rolesReachableInOneStepMap.containsKey(higherRole)) {
|
||||
rolesReachableInOneStepSet = new HashSet<GrantedAuthority>();
|
||||
rolesReachableInOneStepSet = new HashSet<>();
|
||||
this.rolesReachableInOneStepMap.put(higherRole, rolesReachableInOneStepSet);
|
||||
} else {
|
||||
rolesReachableInOneStepSet = this.rolesReachableInOneStepMap.get(higherRole);
|
||||
|
|
|
@ -42,7 +42,7 @@ public final class DelegatingMethodSecurityMetadataSource extends
|
|||
.emptyList();
|
||||
|
||||
private final List<MethodSecurityMetadataSource> methodSecurityMetadataSources;
|
||||
private final Map<DefaultCacheKey, Collection<ConfigAttribute>> attributeCache = new HashMap<DefaultCacheKey, Collection<ConfigAttribute>>();
|
||||
private final Map<DefaultCacheKey, Collection<ConfigAttribute>> attributeCache = new HashMap<>();
|
||||
|
||||
// ~ Constructor
|
||||
// ====================================================================================================
|
||||
|
|
|
@ -63,7 +63,7 @@ public class DefaultAuthenticationEventPublisher implements AuthenticationEventP
|
|||
private final Log logger = LogFactory.getLog(getClass());
|
||||
|
||||
private ApplicationEventPublisher applicationEventPublisher;
|
||||
private final HashMap<String, Constructor<? extends AbstractAuthenticationEvent>> exceptionMappings = new HashMap<String, Constructor<? extends AbstractAuthenticationEvent>>();
|
||||
private final HashMap<String, Constructor<? extends AbstractAuthenticationEvent>> exceptionMappings = new HashMap<>();
|
||||
|
||||
public DefaultAuthenticationEventPublisher() {
|
||||
this(null);
|
||||
|
|
|
@ -131,7 +131,7 @@ public class DelegatingSecurityContextExecutorService extends
|
|||
if (tasks == null) {
|
||||
return null;
|
||||
}
|
||||
List<Callable<T>> results = new ArrayList<Callable<T>>(tasks.size());
|
||||
List<Callable<T>> results = new ArrayList<>(tasks.size());
|
||||
for (Callable<T> task : tasks) {
|
||||
results.add(wrap(task));
|
||||
}
|
||||
|
@ -141,4 +141,4 @@ public class DelegatingSecurityContextExecutorService extends
|
|||
private ExecutorService getDelegate() {
|
||||
return (ExecutorService) getDelegateExecutor();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -88,7 +88,7 @@ public class MapBasedAttributes2GrantedAuthoritiesMapper implements
|
|||
* @return the processed Map
|
||||
*/
|
||||
private Map<String, Collection<GrantedAuthority>> preProcessMap(Map<?, ?> orgMap) {
|
||||
Map<String, Collection<GrantedAuthority>> result = new HashMap<String, Collection<GrantedAuthority>>(
|
||||
Map<String, Collection<GrantedAuthority>> result = new HashMap<>(
|
||||
orgMap.size());
|
||||
|
||||
for (Map.Entry<?, ?> entry : orgMap.entrySet()) {
|
||||
|
|
|
@ -43,7 +43,7 @@ class UnmodifiableListDeserializer extends JsonDeserializer<List> {
|
|||
public List deserialize(JsonParser jp, DeserializationContext ctxt) throws IOException, JsonProcessingException {
|
||||
ObjectMapper mapper = (ObjectMapper) jp.getCodec();
|
||||
JsonNode node = mapper.readTree(jp);
|
||||
List<Object> result = new ArrayList<Object>();
|
||||
List<Object> result = new ArrayList<>();
|
||||
if (node != null) {
|
||||
if (node instanceof ArrayNode) {
|
||||
ArrayNode arrayNode = (ArrayNode) node;
|
||||
|
|
|
@ -39,7 +39,7 @@ public class RoleHierarchyUtilsTests {
|
|||
"ROLE_C > ROLE_D" + EOL;
|
||||
// @formatter:on
|
||||
|
||||
Map<String, List<String>> roleHierarchyMap = new TreeMap<String, List<String>>();
|
||||
Map<String, List<String>> roleHierarchyMap = new TreeMap<>();
|
||||
roleHierarchyMap.put("ROLE_A", asList("ROLE_B", "ROLE_C"));
|
||||
roleHierarchyMap.put("ROLE_B", asList("ROLE_D"));
|
||||
roleHierarchyMap.put("ROLE_C", asList("ROLE_D"));
|
||||
|
@ -61,7 +61,7 @@ public class RoleHierarchyUtilsTests {
|
|||
|
||||
@Test(expected = IllegalArgumentException.class)
|
||||
public void roleHierarchyFromMapWhenRoleNullThenThrowsIllegalArgumentException() throws Exception {
|
||||
Map<String, List<String>> roleHierarchyMap = new HashMap<String, List<String>>();
|
||||
Map<String, List<String>> roleHierarchyMap = new HashMap<>();
|
||||
roleHierarchyMap.put(null, asList("ROLE_B", "ROLE_C"));
|
||||
|
||||
RoleHierarchyUtils.roleHierarchyFromMap(roleHierarchyMap);
|
||||
|
@ -69,7 +69,7 @@ public class RoleHierarchyUtilsTests {
|
|||
|
||||
@Test(expected = IllegalArgumentException.class)
|
||||
public void roleHierarchyFromMapWhenRoleEmptyThenThrowsIllegalArgumentException() throws Exception {
|
||||
Map<String, List<String>> roleHierarchyMap = new HashMap<String, List<String>>();
|
||||
Map<String, List<String>> roleHierarchyMap = new HashMap<>();
|
||||
roleHierarchyMap.put("", asList("ROLE_B", "ROLE_C"));
|
||||
|
||||
RoleHierarchyUtils.roleHierarchyFromMap(roleHierarchyMap);
|
||||
|
@ -77,7 +77,7 @@ public class RoleHierarchyUtilsTests {
|
|||
|
||||
@Test(expected = IllegalArgumentException.class)
|
||||
public void roleHierarchyFromMapWhenImpliedRolesNullThenThrowsIllegalArgumentException() throws Exception {
|
||||
Map<String, List<String>> roleHierarchyMap = new HashMap<String, List<String>>();
|
||||
Map<String, List<String>> roleHierarchyMap = new HashMap<>();
|
||||
roleHierarchyMap.put("ROLE_A", null);
|
||||
|
||||
RoleHierarchyUtils.roleHierarchyFromMap(roleHierarchyMap);
|
||||
|
@ -85,7 +85,7 @@ public class RoleHierarchyUtilsTests {
|
|||
|
||||
@Test(expected = IllegalArgumentException.class)
|
||||
public void roleHierarchyFromMapWhenImpliedRolesEmptyThenThrowsIllegalArgumentException() throws Exception {
|
||||
Map<String, List<String>> roleHierarchyMap = new HashMap<String, List<String>>();
|
||||
Map<String, List<String>> roleHierarchyMap = new HashMap<>();
|
||||
roleHierarchyMap.put("ROLE_A", Collections.<String>emptyList());
|
||||
|
||||
RoleHierarchyUtils.roleHierarchyFromMap(roleHierarchyMap);
|
||||
|
|
|
@ -113,7 +113,7 @@ public class ConsensusBasedTests {
|
|||
RoleVoter roleVoter = new RoleVoter();
|
||||
DenyVoter denyForSureVoter = new DenyVoter();
|
||||
DenyAgainVoter denyAgainForSureVoter = new DenyAgainVoter();
|
||||
List<AccessDecisionVoter<? extends Object>> voters = new Vector<AccessDecisionVoter<? extends Object>>();
|
||||
List<AccessDecisionVoter<? extends Object>> voters = new Vector<>();
|
||||
voters.add(roleVoter);
|
||||
voters.add(denyForSureVoter);
|
||||
voters.add(denyAgainForSureVoter);
|
||||
|
|
|
@ -43,7 +43,7 @@ public class UnanimousBasedTests {
|
|||
RoleVoter roleVoter = new RoleVoter();
|
||||
DenyVoter denyForSureVoter = new DenyVoter();
|
||||
DenyAgainVoter denyAgainForSureVoter = new DenyAgainVoter();
|
||||
List<AccessDecisionVoter<? extends Object>> voters = new Vector<AccessDecisionVoter<? extends Object>>();
|
||||
List<AccessDecisionVoter<? extends Object>> voters = new Vector<>();
|
||||
voters.add(roleVoter);
|
||||
voters.add(denyForSureVoter);
|
||||
voters.add(denyAgainForSureVoter);
|
||||
|
@ -56,7 +56,7 @@ public class UnanimousBasedTests {
|
|||
|
||||
DenyVoter denyForSureVoter = new DenyVoter();
|
||||
DenyAgainVoter denyAgainForSureVoter = new DenyAgainVoter();
|
||||
List<AccessDecisionVoter<? extends Object>> voters = new Vector<AccessDecisionVoter<? extends Object>>();
|
||||
List<AccessDecisionVoter<? extends Object>> voters = new Vector<>();
|
||||
voters.add(roleVoter);
|
||||
voters.add(denyForSureVoter);
|
||||
voters.add(denyAgainForSureVoter);
|
||||
|
|
|
@ -203,12 +203,12 @@ public class SpringSecurityLdapTemplate extends LdapTemplate {
|
|||
String formattedFilter = MessageFormat.format(filter, encodedParams);
|
||||
logger.debug("Using filter: " + formattedFilter);
|
||||
|
||||
final HashSet<Map<String, List<String>>> set = new HashSet<Map<String, List<String>>>();
|
||||
final HashSet<Map<String, List<String>>> set = new HashSet<>();
|
||||
|
||||
ContextMapper roleMapper = new ContextMapper() {
|
||||
public Object mapFromContext(Object ctx) {
|
||||
DirContextAdapter adapter = (DirContextAdapter) ctx;
|
||||
Map<String, List<String>> record = new HashMap<String, List<String>>();
|
||||
Map<String, List<String>> record = new HashMap<>();
|
||||
if (attributeNames == null || attributeNames.length == 0) {
|
||||
try {
|
||||
for (NamingEnumeration ae = adapter.getAttributes().getAll(); ae
|
||||
|
|
|
@ -400,7 +400,7 @@ public class ActiveDirectoryLdapAuthenticationProviderTests {
|
|||
|
||||
@Test(expected = IllegalArgumentException.class)
|
||||
public void setContextEnvironmentPropertiesEmpty() {
|
||||
provider.setContextEnvironmentProperties(new Hashtable<String, Object>());
|
||||
provider.setContextEnvironmentProperties(new Hashtable<>());
|
||||
}
|
||||
|
||||
@Test
|
||||
|
|
|
@ -36,7 +36,7 @@ public class LdapAuthorityTests {
|
|||
|
||||
@Before
|
||||
public void setUp() {
|
||||
Map<String, List<String>> attributes = new HashMap<String, List<String>>();
|
||||
Map<String, List<String>> attributes = new HashMap<>();
|
||||
attributes.put(SpringSecurityLdapTemplate.DN_KEY, Arrays.asList(DN));
|
||||
attributes.put("mail",
|
||||
Arrays.asList("filip@ldap.test.org", "filip@ldap.test2.org"));
|
||||
|
|
|
@ -108,7 +108,7 @@ public final class ExpressionBasedMessageSecurityMetadataSourceFactory {
|
|||
public static MessageSecurityMetadataSource createExpressionMessageMetadataSource(
|
||||
LinkedHashMap<MessageMatcher<?>, String> matcherToExpression, SecurityExpressionHandler<Message<Object>> handler) {
|
||||
|
||||
LinkedHashMap<MessageMatcher<?>, Collection<ConfigAttribute>> matcherToAttrs = new LinkedHashMap<MessageMatcher<?>, Collection<ConfigAttribute>>();
|
||||
LinkedHashMap<MessageMatcher<?>, Collection<ConfigAttribute>> matcherToAttrs = new LinkedHashMap<>();
|
||||
|
||||
for (Map.Entry<MessageMatcher<?>, String> entry : matcherToExpression.entrySet()) {
|
||||
MessageMatcher<?> matcher = entry.getKey();
|
||||
|
|
|
@ -43,7 +43,7 @@ public final class SecurityContextChannelInterceptor extends ChannelInterceptorA
|
|||
implements ExecutorChannelInterceptor {
|
||||
private final SecurityContext EMPTY_CONTEXT = SecurityContextHolder
|
||||
.createEmptyContext();
|
||||
private static final ThreadLocal<Stack<SecurityContext>> ORIGINAL_CONTEXT = new ThreadLocal<Stack<SecurityContext>>();
|
||||
private static final ThreadLocal<Stack<SecurityContext>> ORIGINAL_CONTEXT = new ThreadLocal<>();
|
||||
|
||||
private final String authenticationHeaderName;
|
||||
|
||||
|
|
|
@ -58,7 +58,7 @@ public class ExpressionBasedMessageSecurityMetadataSourceFactoryTests {
|
|||
public void setup() {
|
||||
expression1 = "permitAll";
|
||||
expression2 = "denyAll";
|
||||
matcherToExpression = new LinkedHashMap<MessageMatcher<?>, String>();
|
||||
matcherToExpression = new LinkedHashMap<>();
|
||||
matcherToExpression.put(matcher1, expression1);
|
||||
matcherToExpression.put(matcher2, expression2);
|
||||
|
||||
|
|
|
@ -54,7 +54,7 @@ public class DefaultMessageSecurityMetadataSourceTests {
|
|||
|
||||
@Before
|
||||
public void setup() {
|
||||
messageMap = new LinkedHashMap<MessageMatcher<?>, Collection<ConfigAttribute>>();
|
||||
messageMap = new LinkedHashMap<>();
|
||||
messageMap.put(matcher1, Arrays.<ConfigAttribute> asList(config1));
|
||||
messageMap.put(matcher2, Arrays.<ConfigAttribute> asList(config2));
|
||||
|
||||
|
|
|
@ -62,7 +62,7 @@ public class OAuth2BodyExtractorsTests {
|
|||
messageReaders.add(new DecoderHttpMessageReader<>(new Jackson2JsonDecoder()));
|
||||
messageReaders.add(new FormHttpMessageReader());
|
||||
|
||||
this.hints = new HashMap<String, Object>();
|
||||
this.hints = new HashMap<>();
|
||||
this.context = new BodyExtractor.Context() {
|
||||
@Override
|
||||
public List<HttpMessageReader<?>> messageReaders() {
|
||||
|
|
|
@ -34,7 +34,7 @@ public class RegexBasedAxFetchListFactory implements AxFetchListFactory {
|
|||
* which should be fetched for that pattern.
|
||||
*/
|
||||
public RegexBasedAxFetchListFactory(Map<String, List<OpenIDAttribute>> regexMap) {
|
||||
idToAttributes = new LinkedHashMap<Pattern, List<OpenIDAttribute>>();
|
||||
idToAttributes = new LinkedHashMap<>();
|
||||
for (Map.Entry<String, List<OpenIDAttribute>> entry : regexMap.entrySet()) {
|
||||
idToAttributes.put(Pattern.compile(entry.getKey()), entry.getValue());
|
||||
}
|
||||
|
|
|
@ -273,7 +273,7 @@ class KeyConfig {
|
|||
class SubjectAttributeUserTokenConverter extends DefaultUserAuthenticationConverter {
|
||||
@Override
|
||||
public Map<String, ?> convertUserAuthentication(Authentication authentication) {
|
||||
Map<String, Object> response = new LinkedHashMap<String, Object>();
|
||||
Map<String, Object> response = new LinkedHashMap<>();
|
||||
response.put("sub", authentication.getName());
|
||||
if (authentication.getAuthorities() != null && !authentication.getAuthorities().isEmpty()) {
|
||||
response.put(AUTHORITIES, AuthorityUtils.authorityListToSet(authentication.getAuthorities()));
|
||||
|
|
|
@ -60,7 +60,7 @@ public final class ExpressionBasedFilterInvocationSecurityMetadataSource
|
|||
ExpressionParser parser) {
|
||||
Assert.notNull(parser, "SecurityExpressionHandler returned a null parser object");
|
||||
|
||||
LinkedHashMap<RequestMatcher, Collection<ConfigAttribute>> requestToExpressionAttributesMap = new LinkedHashMap<RequestMatcher, Collection<ConfigAttribute>>(
|
||||
LinkedHashMap<RequestMatcher, Collection<ConfigAttribute>> requestToExpressionAttributesMap = new LinkedHashMap<>(
|
||||
requestMap);
|
||||
|
||||
for (Map.Entry<RequestMatcher, Collection<ConfigAttribute>> entry : requestMap
|
||||
|
|
|
@ -92,9 +92,9 @@ public class StrictHttpFirewall implements HttpFirewall {
|
|||
|
||||
private static final List<String> FORBIDDEN_BACKSLASH = Collections.unmodifiableList(Arrays.asList("\\", "%5c", "%5C"));
|
||||
|
||||
private Set<String> encodedUrlBlacklist = new HashSet<String>();
|
||||
private Set<String> encodedUrlBlacklist = new HashSet<>();
|
||||
|
||||
private Set<String> decodedUrlBlacklist = new HashSet<String>();
|
||||
private Set<String> decodedUrlBlacklist = new HashSet<>();
|
||||
|
||||
private Set<String> allowedHttpMethods = createDefaultAllowedHttpMethods();
|
||||
|
||||
|
|
|
@ -266,7 +266,7 @@ public class DefaultSavedRequest implements SavedRequest {
|
|||
|
||||
@Override
|
||||
public List<Cookie> getCookies() {
|
||||
List<Cookie> cookieList = new ArrayList<Cookie>(cookies.size());
|
||||
List<Cookie> cookieList = new ArrayList<>(cookies.size());
|
||||
|
||||
for (SavedCookie savedCookie : cookies) {
|
||||
cookieList.add(savedCookie.getCookie());
|
||||
|
|
|
@ -91,7 +91,7 @@ public class ThrowableAnalyzer {
|
|||
* Creates a new <code>ThrowableAnalyzer</code> instance.
|
||||
*/
|
||||
public ThrowableAnalyzer() {
|
||||
this.extractorMap = new TreeMap<Class<? extends Throwable>, ThrowableCauseExtractor>(
|
||||
this.extractorMap = new TreeMap<>(
|
||||
CLASS_HIERARCHY_COMPARATOR);
|
||||
|
||||
initExtractorMap();
|
||||
|
|
|
@ -53,7 +53,7 @@ public class DelegatingAccessDeniedHandlerTests {
|
|||
|
||||
@Before
|
||||
public void setup() {
|
||||
handlers = new LinkedHashMap<Class<? extends AccessDeniedException>, AccessDeniedHandler>();
|
||||
handlers = new LinkedHashMap<>();
|
||||
}
|
||||
|
||||
@Test
|
||||
|
|
|
@ -35,7 +35,7 @@ public class ExpressionBasedFilterInvocationSecurityMetadataSourceTests {
|
|||
@Test
|
||||
public void expectedAttributeIsReturned() {
|
||||
final String expression = "hasRole('X')";
|
||||
LinkedHashMap<RequestMatcher, Collection<ConfigAttribute>> requestMap = new LinkedHashMap<RequestMatcher, Collection<ConfigAttribute>>();
|
||||
LinkedHashMap<RequestMatcher, Collection<ConfigAttribute>> requestMap = new LinkedHashMap<>();
|
||||
requestMap.put(AnyRequestMatcher.INSTANCE, SecurityConfig.createList(expression));
|
||||
ExpressionBasedFilterInvocationSecurityMetadataSource mds = new ExpressionBasedFilterInvocationSecurityMetadataSource(
|
||||
requestMap, new DefaultWebSecurityExpressionHandler());
|
||||
|
@ -52,7 +52,7 @@ public class ExpressionBasedFilterInvocationSecurityMetadataSourceTests {
|
|||
|
||||
@Test(expected = IllegalArgumentException.class)
|
||||
public void invalidExpressionIsRejected() throws Exception {
|
||||
LinkedHashMap<RequestMatcher, Collection<ConfigAttribute>> requestMap = new LinkedHashMap<RequestMatcher, Collection<ConfigAttribute>>();
|
||||
LinkedHashMap<RequestMatcher, Collection<ConfigAttribute>> requestMap = new LinkedHashMap<>();
|
||||
requestMap.put(AnyRequestMatcher.INSTANCE,
|
||||
SecurityConfig.createList("hasRole('X'"));
|
||||
ExpressionBasedFilterInvocationSecurityMetadataSource mds = new ExpressionBasedFilterInvocationSecurityMetadataSource(
|
||||
|
|
|
@ -46,7 +46,7 @@ public class DefaultFilterInvocationSecurityMetadataSourceTests {
|
|||
// ~ Methods
|
||||
// ========================================================================================================
|
||||
private void createFids(String pattern, String method) {
|
||||
LinkedHashMap<RequestMatcher, Collection<ConfigAttribute>> requestMap = new LinkedHashMap<RequestMatcher, Collection<ConfigAttribute>>();
|
||||
LinkedHashMap<RequestMatcher, Collection<ConfigAttribute>> requestMap = new LinkedHashMap<>();
|
||||
requestMap.put(new AntPathRequestMatcher(pattern, method), this.def);
|
||||
this.fids = new DefaultFilterInvocationSecurityMetadataSource(requestMap);
|
||||
}
|
||||
|
@ -134,7 +134,7 @@ public class DefaultFilterInvocationSecurityMetadataSourceTests {
|
|||
// SEC-1236
|
||||
@Test
|
||||
public void mixingPatternsWithAndWithoutHttpMethodsIsSupported() throws Exception {
|
||||
LinkedHashMap<RequestMatcher, Collection<ConfigAttribute>> requestMap = new LinkedHashMap<RequestMatcher, Collection<ConfigAttribute>>();
|
||||
LinkedHashMap<RequestMatcher, Collection<ConfigAttribute>> requestMap = new LinkedHashMap<>();
|
||||
Collection<ConfigAttribute> userAttrs = SecurityConfig.createList("A");
|
||||
|
||||
requestMap.put(new AntPathRequestMatcher("/user/**", null), userAttrs);
|
||||
|
|
|
@ -69,7 +69,7 @@ public class DelegatingAuthenticationFailureHandlerTests {
|
|||
|
||||
@Before
|
||||
public void setup() {
|
||||
handlers = new LinkedHashMap<Class<? extends AuthenticationException>, AuthenticationFailureHandler>();
|
||||
handlers = new LinkedHashMap<>();
|
||||
}
|
||||
|
||||
@Test
|
||||
|
|
|
@ -154,7 +154,7 @@ public class J2eeBasedPreAuthenticatedWebAuthenticationDetailsSourceTests {
|
|||
|
||||
private MappableAttributesRetriever getMappableRolesRetriever(String[] mappedRoles) {
|
||||
SimpleMappableAttributesRetriever result = new SimpleMappableAttributesRetriever();
|
||||
result.setMappableAttributes(new HashSet<String>(Arrays.asList(mappedRoles)));
|
||||
result.setMappableAttributes(new HashSet<>(Arrays.asList(mappedRoles)));
|
||||
return result;
|
||||
}
|
||||
|
||||
|
|
|
@ -124,7 +124,7 @@ public class CsrfRequestDataValueProcessorTests {
|
|||
public void createGetExtraHiddenFieldsHasCsrfToken() {
|
||||
CsrfToken token = new DefaultCsrfToken("1", "a", "b");
|
||||
this.exchange.getAttributes().put(DEFAULT_CSRF_ATTR_NAME, token);
|
||||
Map<String, String> expected = new HashMap<String, String>();
|
||||
Map<String, String> expected = new HashMap<>();
|
||||
expected.put(token.getParameterName(), token.getToken());
|
||||
|
||||
CsrfRequestDataValueProcessor processor = new CsrfRequestDataValueProcessor();
|
||||
|
|
Loading…
Reference in New Issue