mirror of
				https://github.com/spring-projects/spring-security.git
				synced 2025-10-31 06:38:42 +00:00 
			
		
		
		
	Polish diamond operator usage
This commit is contained in:
		
							parent
							
								
									f3e95c8175
								
							
						
					
					
						commit
						31f8caec5f
					
				| @ -1,5 +1,5 @@ | ||||
| /* | ||||
|  * Copyright 2002-2023 the original author or authors. | ||||
|  * Copyright 2002-2024 the original author or authors. | ||||
|  * | ||||
|  * Licensed under the Apache License, Version 2.0 (the "License"); | ||||
|  * you may not use this file except in compliance with the License. | ||||
|  | ||||
| @ -1,5 +1,5 @@ | ||||
| /* | ||||
|  * Copyright 2002-2019 the original author or authors. | ||||
|  * Copyright 2002-2024 the original author or authors. | ||||
|  * | ||||
|  * Licensed under the Apache License, Version 2.0 (the "License"); | ||||
|  * you may not use this file except in compliance with the License. | ||||
| @ -95,7 +95,7 @@ class InitializeAuthenticationProviderBeanManagerConfigurer extends GlobalAuthen | ||||
| 				.getBeanNamesForType(type); | ||||
| 			for (String beanName : beanNames) { | ||||
| 				T bean = InitializeAuthenticationProviderBeanManagerConfigurer.this.context.getBean(beanName, type); | ||||
| 				beanWithNames.add(new BeanWithName<T>(bean, beanName)); | ||||
| 				beanWithNames.add(new BeanWithName<>(bean, beanName)); | ||||
| 			} | ||||
| 			return beanWithNames; | ||||
| 		} | ||||
|  | ||||
| @ -134,7 +134,7 @@ class InitializeUserDetailsBeanManagerConfigurer extends GlobalAuthenticationCon | ||||
| 			String[] beanNames = InitializeUserDetailsBeanManagerConfigurer.this.context.getBeanNamesForType(type); | ||||
| 			for (String beanName : beanNames) { | ||||
| 				T bean = InitializeUserDetailsBeanManagerConfigurer.this.context.getBean(beanName, type); | ||||
| 				beanWithNames.add(new BeanWithName<T>(bean, beanName)); | ||||
| 				beanWithNames.add(new BeanWithName<>(bean, beanName)); | ||||
| 			} | ||||
| 			return beanWithNames; | ||||
| 		} | ||||
|  | ||||
| @ -97,7 +97,7 @@ public class GlobalMethodSecurityConfiguration implements ImportAware, SmartInit | ||||
| 
 | ||||
| 	private static final Log logger = LogFactory.getLog(GlobalMethodSecurityConfiguration.class); | ||||
| 
 | ||||
| 	private ObjectPostProcessor<Object> objectPostProcessor = new ObjectPostProcessor<Object>() { | ||||
| 	private ObjectPostProcessor<Object> objectPostProcessor = new ObjectPostProcessor<>() { | ||||
| 
 | ||||
| 		@Override | ||||
| 		public <T> T postProcess(T object) { | ||||
|  | ||||
| @ -1,5 +1,5 @@ | ||||
| /* | ||||
|  * Copyright 2015-2018 the original author or authors. | ||||
|  * Copyright 2015-2024 the original author or authors. | ||||
|  * | ||||
|  * Licensed under the Apache License, Version 2.0 (the "License"); | ||||
|  * you may not use this file except in compliance with the License. | ||||
| @ -42,7 +42,7 @@ import org.springframework.security.core.userdetails.User; | ||||
|  */ | ||||
| class UserDeserializer extends JsonDeserializer<User> { | ||||
| 
 | ||||
| 	private static final TypeReference<Set<SimpleGrantedAuthority>> SIMPLE_GRANTED_AUTHORITY_SET = new TypeReference<Set<SimpleGrantedAuthority>>() { | ||||
| 	private static final TypeReference<Set<SimpleGrantedAuthority>> SIMPLE_GRANTED_AUTHORITY_SET = new TypeReference<>() { | ||||
| 	}; | ||||
| 
 | ||||
| 	/** | ||||
|  | ||||
| @ -1,5 +1,5 @@ | ||||
| /* | ||||
|  * Copyright 2015-2022 the original author or authors. | ||||
|  * Copyright 2015-2024 the original author or authors. | ||||
|  * | ||||
|  * Licensed under the Apache License, Version 2.0 (the "License"); | ||||
|  * you may not use this file except in compliance with the License. | ||||
| @ -50,10 +50,10 @@ import org.springframework.security.core.GrantedAuthority; | ||||
|  */ | ||||
| class UsernamePasswordAuthenticationTokenDeserializer extends JsonDeserializer<UsernamePasswordAuthenticationToken> { | ||||
| 
 | ||||
| 	private static final TypeReference<List<GrantedAuthority>> GRANTED_AUTHORITY_LIST = new TypeReference<List<GrantedAuthority>>() { | ||||
| 	private static final TypeReference<List<GrantedAuthority>> GRANTED_AUTHORITY_LIST = new TypeReference<>() { | ||||
| 	}; | ||||
| 
 | ||||
| 	private static final TypeReference<Object> OBJECT = new TypeReference<Object>() { | ||||
| 	private static final TypeReference<Object> OBJECT = new TypeReference<>() { | ||||
| 	}; | ||||
| 
 | ||||
| 	/** | ||||
|  | ||||
| @ -1,5 +1,5 @@ | ||||
| /* | ||||
|  * Copyright 2002-2016 the original author or authors. | ||||
|  * Copyright 2002-2024 the original author or authors. | ||||
|  * | ||||
|  * Licensed under the Apache License, Version 2.0 (the "License"); | ||||
|  * you may not use this file except in compliance with the License. | ||||
| @ -29,7 +29,7 @@ public interface MessageMatcher<T> { | ||||
| 	/** | ||||
| 	 * Matches every {@link Message} | ||||
| 	 */ | ||||
| 	MessageMatcher<Object> ANY_MESSAGE = new MessageMatcher<Object>() { | ||||
| 	MessageMatcher<Object> ANY_MESSAGE = new MessageMatcher<>() { | ||||
| 
 | ||||
| 		@Override | ||||
| 		public boolean matches(Message<?> message) { | ||||
|  | ||||
| @ -1,5 +1,5 @@ | ||||
| /* | ||||
|  * Copyright 2002-2020 the original author or authors. | ||||
|  * Copyright 2002-2024 the original author or authors. | ||||
|  * | ||||
|  * Licensed under the Apache License, Version 2.0 (the "License"); | ||||
|  * you may not use this file except in compliance with the License. | ||||
| @ -31,7 +31,7 @@ import com.fasterxml.jackson.databind.ObjectMapper; | ||||
|  */ | ||||
| abstract class JsonNodeUtils { | ||||
| 
 | ||||
| 	static final TypeReference<Set<String>> STRING_SET = new TypeReference<Set<String>>() { | ||||
| 	static final TypeReference<Set<String>> STRING_SET = new TypeReference<>() { | ||||
| 	}; | ||||
| 
 | ||||
| 	static final TypeReference<Map<String, Object>> STRING_OBJECT_MAP = new TypeReference<Map<String, Object>>() { | ||||
|  | ||||
| @ -1,5 +1,5 @@ | ||||
| /* | ||||
|  * Copyright 2002-2019 the original author or authors. | ||||
|  * Copyright 2002-2024 the original author or authors. | ||||
|  * | ||||
|  * Licensed under the Apache License, Version 2.0 (the "License"); | ||||
|  * you may not use this file except in compliance with the License. | ||||
| @ -70,7 +70,7 @@ public final class ReactiveOidcIdTokenDecoderFactory implements ReactiveJwtDecod | ||||
| 
 | ||||
| 	private static final Map<JwsAlgorithm, String> JCA_ALGORITHM_MAPPINGS; | ||||
| 	static { | ||||
| 		Map<JwsAlgorithm, String> mappings = new HashMap<JwsAlgorithm, String>(); | ||||
| 		Map<JwsAlgorithm, String> mappings = new HashMap<>(); | ||||
| 		mappings.put(MacAlgorithm.HS256, "HmacSHA256"); | ||||
| 		mappings.put(MacAlgorithm.HS384, "HmacSHA384"); | ||||
| 		mappings.put(MacAlgorithm.HS512, "HmacSHA512"); | ||||
|  | ||||
| @ -1,5 +1,5 @@ | ||||
| /* | ||||
|  * Copyright 2002-2021 the original author or authors. | ||||
|  * Copyright 2002-2024 the original author or authors. | ||||
|  * | ||||
|  * Licensed under the Apache License, Version 2.0 (the "License"); | ||||
|  * you may not use this file except in compliance with the License. | ||||
| @ -66,7 +66,7 @@ public final class ClientRegistrations { | ||||
| 		rest.setRequestFactory(requestFactory); | ||||
| 	} | ||||
| 
 | ||||
| 	private static final ParameterizedTypeReference<Map<String, Object>> typeReference = new ParameterizedTypeReference<Map<String, Object>>() { | ||||
| 	private static final ParameterizedTypeReference<Map<String, Object>> typeReference = new ParameterizedTypeReference<>() { | ||||
| 	}; | ||||
| 
 | ||||
| 	private ClientRegistrations() { | ||||
|  | ||||
| @ -71,7 +71,7 @@ public class DefaultOAuth2UserService implements OAuth2UserService<OAuth2UserReq | ||||
| 
 | ||||
| 	private static final String INVALID_USER_INFO_RESPONSE_ERROR_CODE = "invalid_user_info_response"; | ||||
| 
 | ||||
| 	private static final ParameterizedTypeReference<Map<String, Object>> PARAMETERIZED_RESPONSE_TYPE = new ParameterizedTypeReference<Map<String, Object>>() { | ||||
| 	private static final ParameterizedTypeReference<Map<String, Object>> PARAMETERIZED_RESPONSE_TYPE = new ParameterizedTypeReference<>() { | ||||
| 	}; | ||||
| 
 | ||||
| 	private Converter<OAuth2UserRequest, RequestEntity<?>> requestEntityConverter = new OAuth2UserRequestEntityConverter(); | ||||
|  | ||||
| @ -73,10 +73,10 @@ public class DefaultReactiveOAuth2UserService implements ReactiveOAuth2UserServi | ||||
| 
 | ||||
| 	private static final String MISSING_USER_NAME_ATTRIBUTE_ERROR_CODE = "missing_user_name_attribute"; | ||||
| 
 | ||||
| 	private static final ParameterizedTypeReference<Map<String, Object>> STRING_OBJECT_MAP = new ParameterizedTypeReference<Map<String, Object>>() { | ||||
| 	private static final ParameterizedTypeReference<Map<String, Object>> STRING_OBJECT_MAP = new ParameterizedTypeReference<>() { | ||||
| 	}; | ||||
| 
 | ||||
| 	private static final ParameterizedTypeReference<Map<String, String>> STRING_STRING_MAP = new ParameterizedTypeReference<Map<String, String>>() { | ||||
| 	private static final ParameterizedTypeReference<Map<String, String>> STRING_STRING_MAP = new ParameterizedTypeReference<>() { | ||||
| 	}; | ||||
| 
 | ||||
| 	private Converter<OAuth2UserRequest, Converter<Map<String, Object>, Map<String, Object>>> attributesConverter = ( | ||||
|  | ||||
| @ -1,5 +1,5 @@ | ||||
| /* | ||||
|  * Copyright 2002-2022 the original author or authors. | ||||
|  * Copyright 2002-2024 the original author or authors. | ||||
|  * | ||||
|  * Licensed under the Apache License, Version 2.0 (the "License"); | ||||
|  * you may not use this file except in compliance with the License. | ||||
| @ -49,7 +49,7 @@ public class OAuth2AccessTokenResponseHttpMessageConverter | ||||
| 
 | ||||
| 	private static final Charset DEFAULT_CHARSET = StandardCharsets.UTF_8; | ||||
| 
 | ||||
| 	private static final ParameterizedTypeReference<Map<String, Object>> STRING_OBJECT_MAP = new ParameterizedTypeReference<Map<String, Object>>() { | ||||
| 	private static final ParameterizedTypeReference<Map<String, Object>> STRING_OBJECT_MAP = new ParameterizedTypeReference<>() { | ||||
| 	}; | ||||
| 
 | ||||
| 	private GenericHttpMessageConverter<Object> jsonMessageConverter = HttpMessageConverters.getJsonMessageConverter(); | ||||
|  | ||||
| @ -1,5 +1,5 @@ | ||||
| /* | ||||
|  * Copyright 2002-2020 the original author or authors. | ||||
|  * Copyright 2002-2024 the original author or authors. | ||||
|  * | ||||
|  * Licensed under the Apache License, Version 2.0 (the "License"); | ||||
|  * you may not use this file except in compliance with the License. | ||||
| @ -49,7 +49,7 @@ public class OAuth2ErrorHttpMessageConverter extends AbstractHttpMessageConverte | ||||
| 
 | ||||
| 	private static final Charset DEFAULT_CHARSET = StandardCharsets.UTF_8; | ||||
| 
 | ||||
| 	private static final ParameterizedTypeReference<Map<String, Object>> STRING_OBJECT_MAP = new ParameterizedTypeReference<Map<String, Object>>() { | ||||
| 	private static final ParameterizedTypeReference<Map<String, Object>> STRING_OBJECT_MAP = new ParameterizedTypeReference<>() { | ||||
| 	}; | ||||
| 
 | ||||
| 	private GenericHttpMessageConverter<Object> jsonMessageConverter = HttpMessageConverters.getJsonMessageConverter(); | ||||
|  | ||||
| @ -1,5 +1,5 @@ | ||||
| /* | ||||
|  * Copyright 2002-2020 the original author or authors. | ||||
|  * Copyright 2002-2024 the original author or authors. | ||||
|  * | ||||
|  * Licensed under the Apache License, Version 2.0 (the "License"); | ||||
|  * you may not use this file except in compliance with the License. | ||||
| @ -53,7 +53,7 @@ class OAuth2AccessTokenResponseBodyExtractor | ||||
| 
 | ||||
| 	private static final String INVALID_TOKEN_RESPONSE_ERROR_CODE = "invalid_token_response"; | ||||
| 
 | ||||
| 	private static final ParameterizedTypeReference<Map<String, Object>> STRING_OBJECT_MAP = new ParameterizedTypeReference<Map<String, Object>>() { | ||||
| 	private static final ParameterizedTypeReference<Map<String, Object>> STRING_OBJECT_MAP = new ParameterizedTypeReference<>() { | ||||
| 	}; | ||||
| 
 | ||||
| 	OAuth2AccessTokenResponseBodyExtractor() { | ||||
|  | ||||
| @ -75,7 +75,7 @@ final class JwtDecoderProviderConfigurationUtils { | ||||
| 		rest.setRequestFactory(requestFactory); | ||||
| 	} | ||||
| 
 | ||||
| 	private static final ParameterizedTypeReference<Map<String, Object>> STRING_OBJECT_MAP = new ParameterizedTypeReference<Map<String, Object>>() { | ||||
| 	private static final ParameterizedTypeReference<Map<String, Object>> STRING_OBJECT_MAP = new ParameterizedTypeReference<>() { | ||||
| 	}; | ||||
| 
 | ||||
| 	private JwtDecoderProviderConfigurationUtils() { | ||||
|  | ||||
| @ -1,5 +1,5 @@ | ||||
| /* | ||||
|  * Copyright 2002-2023 the original author or authors. | ||||
|  * Copyright 2002-2024 the original author or authors. | ||||
|  * | ||||
|  * Licensed under the Apache License, Version 2.0 (the "License"); | ||||
|  * you may not use this file except in compliance with the License. | ||||
| @ -49,7 +49,7 @@ final class ReactiveJwtDecoderProviderConfigurationUtils { | ||||
| 
 | ||||
| 	private static final String OAUTH_METADATA_PATH = "/.well-known/oauth-authorization-server"; | ||||
| 
 | ||||
| 	private static final ParameterizedTypeReference<Map<String, Object>> STRING_OBJECT_MAP = new ParameterizedTypeReference<Map<String, Object>>() { | ||||
| 	private static final ParameterizedTypeReference<Map<String, Object>> STRING_OBJECT_MAP = new ParameterizedTypeReference<>() { | ||||
| 	}; | ||||
| 
 | ||||
| 	static <C extends SecurityContext> Mono<ConfigurableJWTProcessor<C>> addJWSAlgorithms( | ||||
|  | ||||
| @ -62,7 +62,7 @@ public class SpringOpaqueTokenIntrospector implements OpaqueTokenIntrospector { | ||||
| 
 | ||||
| 	private static final String AUTHORITY_PREFIX = "SCOPE_"; | ||||
| 
 | ||||
| 	private static final ParameterizedTypeReference<Map<String, Object>> STRING_OBJECT_MAP = new ParameterizedTypeReference<Map<String, Object>>() { | ||||
| 	private static final ParameterizedTypeReference<Map<String, Object>> STRING_OBJECT_MAP = new ParameterizedTypeReference<>() { | ||||
| 	}; | ||||
| 
 | ||||
| 	private final Log logger = LogFactory.getLog(getClass()); | ||||
|  | ||||
| @ -58,7 +58,7 @@ public class SpringReactiveOpaqueTokenIntrospector implements ReactiveOpaqueToke | ||||
| 
 | ||||
| 	private static final String AUTHORITY_PREFIX = "SCOPE_"; | ||||
| 
 | ||||
| 	private static final ParameterizedTypeReference<Map<String, Object>> STRING_OBJECT_MAP = new ParameterizedTypeReference<Map<String, Object>>() { | ||||
| 	private static final ParameterizedTypeReference<Map<String, Object>> STRING_OBJECT_MAP = new ParameterizedTypeReference<>() { | ||||
| 	}; | ||||
| 
 | ||||
| 	private final URI introspectionUri; | ||||
|  | ||||
| @ -1,5 +1,5 @@ | ||||
| /* | ||||
|  * Copyright 2019 the original author or authors. | ||||
|  * Copyright 2019-2024 the original author or authors. | ||||
|  * | ||||
|  * Licensed under the Apache License, Version 2.0 (the "License"); | ||||
|  * you may not use this file except in compliance with the License. | ||||
| @ -81,8 +81,7 @@ public interface PayloadExchangeMatcher { | ||||
| 		 * @return | ||||
| 		 */ | ||||
| 		public static Mono<MatchResult> match(Map<String, ? extends Object> variables) { | ||||
| 			MatchResult result = new MatchResult(true, | ||||
| 					(variables != null) ? new HashMap<String, Object>(variables) : null); | ||||
| 			MatchResult result = new MatchResult(true, (variables != null) ? new HashMap<>(variables) : null); | ||||
| 			return Mono.just(result); | ||||
| 		} | ||||
| 
 | ||||
|  | ||||
| @ -1,5 +1,5 @@ | ||||
| /* | ||||
|  * Copyright 2004, 2005, 2006 Acegi Technology Pty Limited | ||||
|  * Copyright 2004-2024 Acegi Technology Pty Limited | ||||
|  * | ||||
|  * Licensed under the Apache License, Version 2.0 (the "License"); | ||||
|  * you may not use this file except in compliance with the License. | ||||
| @ -138,7 +138,6 @@ public class LoginUrlAuthenticationEntryPoint implements AuthenticationEntryPoin | ||||
| 		logger.debug(LogMessage.format("Server side forward to: %s", loginForm)); | ||||
| 		RequestDispatcher dispatcher = request.getRequestDispatcher(loginForm); | ||||
| 		dispatcher.forward(request, response); | ||||
| 		return; | ||||
| 	} | ||||
| 
 | ||||
| 	protected String buildRedirectUrlToLoginPage(HttpServletRequest request, HttpServletResponse response, | ||||
|  | ||||
| @ -1,5 +1,5 @@ | ||||
| /* | ||||
|  * Copyright 2002-2016 the original author or authors. | ||||
|  * Copyright 2002-2024 the original author or authors. | ||||
|  * | ||||
|  * Licensed under the Apache License, Version 2.0 (the "License"); | ||||
|  * you may not use this file except in compliance with the License. | ||||
| @ -129,7 +129,7 @@ final class DefaultWASUsernameAndGroupsExtractor implements WASUsernameAndGroups | ||||
| 			final Collection<String> groups = (Collection<String>) invokeMethod(getGroupsForUserMethod(), userReg, | ||||
| 					new Object[] { securityName }); | ||||
| 			logger.debug(LogMessage.format("Groups for user %s: %s", securityName, groups)); | ||||
| 			return new ArrayList<String>(groups); | ||||
| 			return new ArrayList<>(groups); | ||||
| 		} | ||||
| 		catch (Exception ex) { | ||||
| 			logger.error("Exception occured while looking up groups for user", ex); | ||||
|  | ||||
| @ -737,7 +737,7 @@ public class StrictHttpFirewall implements HttpFirewall { | ||||
| 				validateAllowedHeaderName(name); | ||||
| 			} | ||||
| 			Enumeration<String> headers = super.getHeaders(name); | ||||
| 			return new Enumeration<String>() { | ||||
| 			return new Enumeration<>() { | ||||
| 
 | ||||
| 				@Override | ||||
| 				public boolean hasMoreElements() { | ||||
| @ -757,7 +757,7 @@ public class StrictHttpFirewall implements HttpFirewall { | ||||
| 		@Override | ||||
| 		public Enumeration<String> getHeaderNames() { | ||||
| 			Enumeration<String> names = super.getHeaderNames(); | ||||
| 			return new Enumeration<String>() { | ||||
| 			return new Enumeration<>() { | ||||
| 
 | ||||
| 				@Override | ||||
| 				public boolean hasMoreElements() { | ||||
| @ -803,7 +803,7 @@ public class StrictHttpFirewall implements HttpFirewall { | ||||
| 		@Override | ||||
| 		public Enumeration<String> getParameterNames() { | ||||
| 			Enumeration<String> paramaterNames = super.getParameterNames(); | ||||
| 			return new Enumeration<String>() { | ||||
| 			return new Enumeration<>() { | ||||
| 
 | ||||
| 				@Override | ||||
| 				public boolean hasMoreElements() { | ||||
|  | ||||
| @ -1,5 +1,5 @@ | ||||
| /* | ||||
|  * Copyright 2015-2018 the original author or authors. | ||||
|  * Copyright 2015-2024 the original author or authors. | ||||
|  * | ||||
|  * Licensed under the Apache License, Version 2.0 (the "License"); | ||||
|  * you may not use this file except in compliance with the License. | ||||
| @ -46,7 +46,7 @@ import org.springframework.security.web.authentication.preauth.PreAuthenticatedA | ||||
|  */ | ||||
| class PreAuthenticatedAuthenticationTokenDeserializer extends JsonDeserializer<PreAuthenticatedAuthenticationToken> { | ||||
| 
 | ||||
| 	private static final TypeReference<List<GrantedAuthority>> GRANTED_AUTHORITY_LIST = new TypeReference<List<GrantedAuthority>>() { | ||||
| 	private static final TypeReference<List<GrantedAuthority>> GRANTED_AUTHORITY_LIST = new TypeReference<>() { | ||||
| 	}; | ||||
| 
 | ||||
| 	/** | ||||
|  | ||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user