Cleanup Code Style Issues

Cleanup Code Style Issues
This commit is contained in:
Rob Winch 2019-08-12 13:06:49 -05:00 committed by GitHub
commit c1db1aad91
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
172 changed files with 288 additions and 306 deletions

View File

@ -41,14 +41,14 @@ class AclClassIdUtils {
private ConversionService conversionService; private ConversionService conversionService;
public AclClassIdUtils() { AclClassIdUtils() {
GenericConversionService genericConversionService = new GenericConversionService(); GenericConversionService genericConversionService = new GenericConversionService();
genericConversionService.addConverter(String.class, Long.class, new StringToLongConverter()); genericConversionService.addConverter(String.class, Long.class, new StringToLongConverter());
genericConversionService.addConverter(String.class, UUID.class, new StringToUUIDConverter()); genericConversionService.addConverter(String.class, UUID.class, new StringToUUIDConverter());
this.conversionService = genericConversionService; this.conversionService = genericConversionService;
} }
public AclClassIdUtils(ConversionService conversionService) { AclClassIdUtils(ConversionService conversionService) {
Assert.notNull(conversionService, "conversionService must not be null"); Assert.notNull(conversionService, "conversionService must not be null");
this.conversionService = conversionService; this.conversionService = conversionService;
} }

View File

@ -559,7 +559,7 @@ public class BasicLookupStrategy implements LookupStrategy {
private final Map<Serializable, Acl> acls; private final Map<Serializable, Acl> acls;
private final List<Sid> sids; private final List<Sid> sids;
public ProcessResultSet(Map<Serializable, Acl> acls, List<Sid> sids) { ProcessResultSet(Map<Serializable, Acl> acls, List<Sid> sids) {
Assert.notNull(acls, "ACLs cannot be null"); Assert.notNull(acls, "ACLs cannot be null");
this.acls = acls; this.acls = acls;
this.sids = sids; // can be null this.sids = sids; // can be null
@ -683,7 +683,7 @@ public class BasicLookupStrategy implements LookupStrategy {
private static class StubAclParent implements Acl { private static class StubAclParent implements Acl {
private final Long id; private final Long id;
public StubAclParent(Long id) { StubAclParent(Long id) {
this.id = id; this.id = id;
} }

View File

@ -55,8 +55,8 @@ class AssertionImplMixin {
* @param attributes the key/value pairs for this attribute. * @param attributes the key/value pairs for this attribute.
*/ */
@JsonCreator @JsonCreator
public AssertionImplMixin(@JsonProperty("principal") AttributePrincipal principal, AssertionImplMixin(@JsonProperty("principal") AttributePrincipal principal,
@JsonProperty("validFromDate") Date validFromDate, @JsonProperty("validUntilDate") Date validUntilDate, @JsonProperty("validFromDate") Date validFromDate, @JsonProperty("validUntilDate") Date validUntilDate,
@JsonProperty("authenticationDate") Date authenticationDate, @JsonProperty("attributes") Map<String, Object> attributes){ @JsonProperty("authenticationDate") Date authenticationDate, @JsonProperty("attributes") Map<String, Object> attributes){
} }
} }

View File

@ -51,8 +51,8 @@ class AttributePrincipalImplMixin {
* @param proxyRetriever the ProxyRetriever implementation to call back to the CAS server. * @param proxyRetriever the ProxyRetriever implementation to call back to the CAS server.
*/ */
@JsonCreator @JsonCreator
public AttributePrincipalImplMixin(@JsonProperty("name") String name, @JsonProperty("attributes") Map<String, Object> attributes, AttributePrincipalImplMixin(@JsonProperty("name") String name, @JsonProperty("attributes") Map<String, Object> attributes,
@JsonProperty("proxyGrantingTicket") String proxyGrantingTicket, @JsonProperty("proxyGrantingTicket") String proxyGrantingTicket,
@JsonProperty("proxyRetriever") ProxyRetriever proxyRetriever) { @JsonProperty("proxyRetriever") ProxyRetriever proxyRetriever) {
} }
} }

View File

@ -69,7 +69,7 @@ class CasAuthenticationTokenMixin {
* principal and how to obtain a proxy ticket for the user. * principal and how to obtain a proxy ticket for the user.
*/ */
@JsonCreator @JsonCreator
public CasAuthenticationTokenMixin(@JsonProperty("keyHash") Integer keyHash, @JsonProperty("principal") Object principal, CasAuthenticationTokenMixin(@JsonProperty("keyHash") Integer keyHash, @JsonProperty("principal") Object principal,
@JsonProperty("credentials") Object credentials, @JsonProperty("credentials") Object credentials,
@JsonProperty("authorities") Collection<? extends GrantedAuthority> authorities, @JsonProperty("authorities") Collection<? extends GrantedAuthority> authorities,
@JsonProperty("userDetails") UserDetails userDetails, @JsonProperty("assertion") Assertion assertion) { @JsonProperty("userDetails") UserDetails userDetails, @JsonProperty("assertion") Assertion assertion) {

View File

@ -415,7 +415,7 @@ public class CasAuthenticationFilter extends AbstractAuthenticationProcessingFil
private class CasAuthenticationFailureHandler implements AuthenticationFailureHandler { private class CasAuthenticationFailureHandler implements AuthenticationFailureHandler {
private final AuthenticationFailureHandler serviceTicketFailureHandler; private final AuthenticationFailureHandler serviceTicketFailureHandler;
public CasAuthenticationFailureHandler(AuthenticationFailureHandler failureHandler) { CasAuthenticationFailureHandler(AuthenticationFailureHandler failureHandler) {
Assert.notNull(failureHandler, "failureHandler"); Assert.notNull(failureHandler, "failureHandler");
this.serviceTicketFailureHandler = failureHandler; this.serviceTicketFailureHandler = failureHandler;
} }
@ -432,4 +432,4 @@ public class CasAuthenticationFilter extends AbstractAuthenticationProcessingFil
} }
} }
} }
} }

View File

@ -414,7 +414,7 @@ public class CasAuthenticationProviderTests {
private class MockTicketValidator implements TicketValidator { private class MockTicketValidator implements TicketValidator {
private boolean returnTicket; private boolean returnTicket;
public MockTicketValidator(boolean returnTicket) { MockTicketValidator(boolean returnTicket) {
this.returnTicket = returnTicket; this.returnTicket = returnTicket;
} }

View File

@ -58,7 +58,7 @@ public abstract class AbstractConfiguredSecurityBuilder<O, B extends SecurityBui
private final LinkedHashMap<Class<? extends SecurityConfigurer<O, B>>, List<SecurityConfigurer<O, B>>> configurers = new LinkedHashMap<>(); 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 List<SecurityConfigurer<O, B>> configurersAddedInInitializing = new ArrayList<>();
private final Map<Class<? extends Object>, Object> sharedObjects = new HashMap<>(); private final Map<Class<?>, Object> sharedObjects = new HashMap<>();
private final boolean allowConfigurersOfSameType; private final boolean allowConfigurersOfSameType;
@ -174,7 +174,7 @@ public abstract class AbstractConfiguredSecurityBuilder<O, B extends SecurityBui
* Gets the shared objects * Gets the shared objects
* @return the shared Objects * @return the shared Objects
*/ */
public Map<Class<? extends Object>, Object> getSharedObjects() { public Map<Class<?>, Object> getSharedObjects() {
return Collections.unmodifiableMap(this.sharedObjects); return Collections.unmodifiableMap(this.sharedObjects);
} }
@ -409,7 +409,7 @@ public abstract class AbstractConfiguredSecurityBuilder<O, B extends SecurityBui
* @author Rob Winch * @author Rob Winch
* @since 3.2 * @since 3.2
*/ */
private static enum BuildState { private enum BuildState {
/** /**
* This is the state before the {@link Builder#build()} is invoked * This is the state before the {@link Builder#build()} is invoked
*/ */

View File

@ -110,7 +110,7 @@ public abstract class SecurityConfigurerAdapter<O, B extends SecurityBuilder<O>>
*/ */
private static final class CompositeObjectPostProcessor implements private static final class CompositeObjectPostProcessor implements
ObjectPostProcessor<Object> { ObjectPostProcessor<Object> {
private List<ObjectPostProcessor<? extends Object>> postProcessors = new ArrayList<>(); private List<ObjectPostProcessor<?>> postProcessors = new ArrayList<>();
@SuppressWarnings({ "rawtypes", "unchecked" }) @SuppressWarnings({ "rawtypes", "unchecked" })
public Object postProcess(Object object) { public Object postProcess(Object object) {
@ -131,7 +131,7 @@ public abstract class SecurityConfigurerAdapter<O, B extends SecurityBuilder<O>>
* @return true if the {@link ObjectPostProcessor} was added, else false * @return true if the {@link ObjectPostProcessor} was added, else false
*/ */
private boolean addObjectPostProcessor( private boolean addObjectPostProcessor(
ObjectPostProcessor<? extends Object> objectPostProcessor) { ObjectPostProcessor<?> objectPostProcessor) {
boolean result = this.postProcessors.add(objectPostProcessor); boolean result = this.postProcessors.add(objectPostProcessor);
postProcessors.sort(AnnotationAwareOrderComparator.INSTANCE); postProcessors.sort(AnnotationAwareOrderComparator.INSTANCE);
return result; return result;

View File

@ -193,7 +193,7 @@ public class AuthenticationConfiguration {
private static final Log logger = LogFactory private static final Log logger = LogFactory
.getLog(EnableGlobalAuthenticationAutowiredConfigurer.class); .getLog(EnableGlobalAuthenticationAutowiredConfigurer.class);
public EnableGlobalAuthenticationAutowiredConfigurer(ApplicationContext context) { EnableGlobalAuthenticationAutowiredConfigurer(ApplicationContext context) {
this.context = context; this.context = context;
} }

View File

@ -42,7 +42,7 @@ class InitializeAuthenticationProviderBeanManagerConfigurer
/** /**
* @param context the ApplicationContext to look up beans. * @param context the ApplicationContext to look up beans.
*/ */
public InitializeAuthenticationProviderBeanManagerConfigurer( InitializeAuthenticationProviderBeanManagerConfigurer(
ApplicationContext context) { ApplicationContext context) {
this.context = context; this.context = context;
} }
@ -83,4 +83,4 @@ class InitializeAuthenticationProviderBeanManagerConfigurer
.getBean(userDetailsBeanNames[0], type); .getBean(userDetailsBeanNames[0], type);
} }
} }
} }

View File

@ -43,7 +43,7 @@ class InitializeUserDetailsBeanManagerConfigurer
/** /**
* @param context * @param context
*/ */
public InitializeUserDetailsBeanManagerConfigurer(ApplicationContext context) { InitializeUserDetailsBeanManagerConfigurer(ApplicationContext context) {
this.context = context; this.context = context;
} }

View File

@ -44,7 +44,7 @@ final class AutowireBeanFactoryObjectPostProcessor
private final List<DisposableBean> disposableBeans = new ArrayList<>(); private final List<DisposableBean> disposableBeans = new ArrayList<>();
private final List<SmartInitializingSingleton> smartSingletons = new ArrayList<>(); private final List<SmartInitializingSingleton> smartSingletons = new ArrayList<>();
public AutowireBeanFactoryObjectPostProcessor( AutowireBeanFactoryObjectPostProcessor(
AutowireCapableBeanFactory autowireBeanFactory) { AutowireCapableBeanFactory autowireBeanFactory) {
Assert.notNull(autowireBeanFactory, "autowireBeanFactory cannot be null"); Assert.notNull(autowireBeanFactory, "autowireBeanFactory cannot be null");
this.autowireBeanFactory = autowireBeanFactory; this.autowireBeanFactory = autowireBeanFactory;

View File

@ -241,7 +241,7 @@ public class GlobalMethodSecurityConfiguration
* @return the {@link AccessDecisionManager} to use * @return the {@link AccessDecisionManager} to use
*/ */
protected AccessDecisionManager accessDecisionManager() { protected AccessDecisionManager accessDecisionManager() {
List<AccessDecisionVoter<? extends Object>> decisionVoters = new ArrayList<>(); List<AccessDecisionVoter<?>> decisionVoters = new ArrayList<>();
ExpressionBasedPreInvocationAdvice expressionAdvice = new ExpressionBasedPreInvocationAdvice(); ExpressionBasedPreInvocationAdvice expressionAdvice = new ExpressionBasedPreInvocationAdvice();
expressionAdvice.setExpressionHandler(getExpressionHandler()); expressionAdvice.setExpressionHandler(getExpressionHandler());
if (prePostEnabled()) { if (prePostEnabled()) {

View File

@ -36,7 +36,7 @@ import org.springframework.util.ClassUtils;
*/ */
final class GlobalMethodSecuritySelector implements ImportSelector { final class GlobalMethodSecuritySelector implements ImportSelector {
public final String[] selectImports(AnnotationMetadata importingClassMetadata) { public String[] selectImports(AnnotationMetadata importingClassMetadata) {
Class<EnableGlobalMethodSecurity> annoType = EnableGlobalMethodSecurity.class; Class<EnableGlobalMethodSecurity> annoType = EnableGlobalMethodSecurity.class;
Map<String, Object> annotationAttributes = importingClassMetadata Map<String, Object> annotationAttributes = importingClassMetadata
.getAnnotationAttributes(annoType.getName(), false); .getAnnotationAttributes(annoType.getName(), false);

View File

@ -137,11 +137,11 @@ public final class HttpSecurity extends
@SuppressWarnings("unchecked") @SuppressWarnings("unchecked")
public HttpSecurity(ObjectPostProcessor<Object> objectPostProcessor, public HttpSecurity(ObjectPostProcessor<Object> objectPostProcessor,
AuthenticationManagerBuilder authenticationBuilder, AuthenticationManagerBuilder authenticationBuilder,
Map<Class<? extends Object>, Object> sharedObjects) { Map<Class<?>, Object> sharedObjects) {
super(objectPostProcessor); super(objectPostProcessor);
Assert.notNull(authenticationBuilder, "authenticationBuilder cannot be null"); Assert.notNull(authenticationBuilder, "authenticationBuilder cannot be null");
setSharedObject(AuthenticationManagerBuilder.class, authenticationBuilder); setSharedObject(AuthenticationManagerBuilder.class, authenticationBuilder);
for (Map.Entry<Class<? extends Object>, Object> entry : sharedObjects for (Map.Entry<Class<?>, Object> entry : sharedObjects
.entrySet()) { .entrySet()) {
setSharedObject((Class<Object>) entry.getKey(), entry.getValue()); setSharedObject((Class<Object>) entry.getKey(), entry.getValue());
} }

View File

@ -40,7 +40,7 @@ final class AutowiredWebSecurityConfigurersIgnoreParents {
private final ConfigurableListableBeanFactory beanFactory; private final ConfigurableListableBeanFactory beanFactory;
public AutowiredWebSecurityConfigurersIgnoreParents( AutowiredWebSecurityConfigurersIgnoreParents(
ConfigurableListableBeanFactory beanFactory) { ConfigurableListableBeanFactory beanFactory) {
Assert.notNull(beanFactory, "beanFactory cannot be null"); Assert.notNull(beanFactory, "beanFactory cannot be null");
this.beanFactory = beanFactory; this.beanFactory = beanFactory;

View File

@ -201,7 +201,7 @@ public abstract class WebSecurityConfigurerAdapter implements
AuthenticationManager authenticationManager = authenticationManager(); AuthenticationManager authenticationManager = authenticationManager();
authenticationBuilder.parentAuthenticationManager(authenticationManager); authenticationBuilder.parentAuthenticationManager(authenticationManager);
authenticationBuilder.authenticationEventPublisher(eventPublisher); authenticationBuilder.authenticationEventPublisher(eventPublisher);
Map<Class<? extends Object>, Object> sharedObjects = createSharedObjects(); Map<Class<?>, Object> sharedObjects = createSharedObjects();
http = new HttpSecurity(objectPostProcessor, authenticationBuilder, http = new HttpSecurity(objectPostProcessor, authenticationBuilder,
sharedObjects); sharedObjects);
@ -412,8 +412,8 @@ public abstract class WebSecurityConfigurerAdapter implements
* *
* @return the shared Objects * @return the shared Objects
*/ */
private Map<Class<? extends Object>, Object> createSharedObjects() { private Map<Class<?>, Object> createSharedObjects() {
Map<Class<? extends Object>, Object> sharedObjects = new HashMap<>(); Map<Class<?>, Object> sharedObjects = new HashMap<>();
sharedObjects.putAll(localConfigureAuthenticationBldr.getSharedObjects()); sharedObjects.putAll(localConfigureAuthenticationBldr.getSharedObjects());
sharedObjects.put(UserDetailsService.class, userDetailsService()); sharedObjects.put(UserDetailsService.class, userDetailsService());
sharedObjects.put(ApplicationContext.class, context); sharedObjects.put(ApplicationContext.class, context);

View File

@ -108,7 +108,7 @@ abstract class AbstractInterceptUrlConfigurer<C extends AbstractInterceptUrlConf
* @return the {@link AccessDecisionVoter} instances used to create the default * @return the {@link AccessDecisionVoter} instances used to create the default
* {@link AccessDecisionManager} * {@link AccessDecisionManager}
*/ */
abstract List<AccessDecisionVoter<? extends Object>> getDecisionVoters(H http); abstract List<AccessDecisionVoter<?>> getDecisionVoters(H http);
abstract class AbstractInterceptUrlRegistry<R extends AbstractInterceptUrlRegistry<R, T>, T> abstract class AbstractInterceptUrlRegistry<R extends AbstractInterceptUrlRegistry<R, T>, T>
extends AbstractConfigAttributeRequestMatcherRegistry<T> { extends AbstractConfigAttributeRequestMatcherRegistry<T> {
@ -195,4 +195,4 @@ abstract class AbstractInterceptUrlConfigurer<C extends AbstractInterceptUrlConf
securityInterceptor.afterPropertiesSet(); securityInterceptor.afterPropertiesSet();
return securityInterceptor; return securityInterceptor;
} }
} }

View File

@ -183,8 +183,8 @@ public final class ExpressionUrlAuthorizationConfigurer<H extends HttpSecurityBu
@Override @Override
@SuppressWarnings("rawtypes") @SuppressWarnings("rawtypes")
final List<AccessDecisionVoter<? extends Object>> getDecisionVoters(H http) { List<AccessDecisionVoter<?>> getDecisionVoters(H http) {
List<AccessDecisionVoter<? extends Object>> decisionVoters = new ArrayList<>(); List<AccessDecisionVoter<?>> decisionVoters = new ArrayList<>();
WebExpressionVoter expressionVoter = new WebExpressionVoter(); WebExpressionVoter expressionVoter = new WebExpressionVoter();
expressionVoter.setExpressionHandler(getExpressionHandler(http)); expressionVoter.setExpressionHandler(getExpressionHandler(http));
decisionVoters.add(expressionVoter); decisionVoters.add(expressionVoter);
@ -192,7 +192,7 @@ public final class ExpressionUrlAuthorizationConfigurer<H extends HttpSecurityBu
} }
@Override @Override
final ExpressionBasedFilterInvocationSecurityMetadataSource createMetadataSource( ExpressionBasedFilterInvocationSecurityMetadataSource createMetadataSource(
H http) { H http) {
LinkedHashMap<RequestMatcher, Collection<ConfigAttribute>> requestMap = REGISTRY LinkedHashMap<RequestMatcher, Collection<ConfigAttribute>> requestMap = REGISTRY
.createRequestMap(); .createRequestMap();

View File

@ -172,8 +172,8 @@ public final class UrlAuthorizationConfigurer<H extends HttpSecurityBuilder<H>>
*/ */
@Override @Override
@SuppressWarnings("rawtypes") @SuppressWarnings("rawtypes")
final List<AccessDecisionVoter<? extends Object>> getDecisionVoters(H http) { List<AccessDecisionVoter<?>> getDecisionVoters(H http) {
List<AccessDecisionVoter<? extends Object>> decisionVoters = new ArrayList<>(); List<AccessDecisionVoter<?>> decisionVoters = new ArrayList<>();
decisionVoters.add(new RoleVoter()); decisionVoters.add(new RoleVoter());
decisionVoters.add(new AuthenticatedVoter()); decisionVoters.add(new AuthenticatedVoter());
return decisionVoters; return decisionVoters;

View File

@ -159,7 +159,7 @@ public abstract class AbstractSecurityWebSocketMessageBrokerConfigurer extends
MessageExpressionVoter<Object> voter = new MessageExpressionVoter<>(); MessageExpressionVoter<Object> voter = new MessageExpressionVoter<>();
voter.setExpressionHandler(getMessageExpressionHandler()); voter.setExpressionHandler(getMessageExpressionHandler());
List<AccessDecisionVoter<? extends Object>> voters = new ArrayList<>(); List<AccessDecisionVoter<?>> voters = new ArrayList<>();
voters.add(voter); voters.add(voter);
AffirmativeBased manager = new AffirmativeBased(voters); AffirmativeBased manager = new AffirmativeBased(voters);

View File

@ -133,7 +133,7 @@ public class RsaKeyConversionServicePostProcessor implements BeanFactoryPostProc
private static class ConverterPropertyEditorAdapter<T> extends PropertyEditorSupport { private static class ConverterPropertyEditorAdapter<T> extends PropertyEditorSupport {
private final Converter<String, T> converter; private final Converter<String, T> converter;
public ConverterPropertyEditorAdapter(Converter<String, T> converter) { ConverterPropertyEditorAdapter(Converter<String, T> converter) {
this.converter = converter; this.converter = converter;
} }

View File

@ -138,7 +138,7 @@ final class AuthenticationConfigBuilder {
private String openIDLoginPage; private String openIDLoginPage;
public AuthenticationConfigBuilder(Element element, boolean forceAutoConfig, AuthenticationConfigBuilder(Element element, boolean forceAutoConfig,
ParserContext pc, SessionCreationPolicy sessionPolicy, ParserContext pc, SessionCreationPolicy sessionPolicy,
BeanReference requestCache, BeanReference authenticationManager, BeanReference requestCache, BeanReference authenticationManager,
BeanReference sessionStrategy, BeanReference portMapper, BeanReference sessionStrategy, BeanReference portMapper,

View File

@ -152,7 +152,7 @@ class HttpConfigurationBuilder {
private BeanDefinition invalidSession; private BeanDefinition invalidSession;
private boolean addAllAuth; private boolean addAllAuth;
public HttpConfigurationBuilder(Element element, boolean addAllAuth, HttpConfigurationBuilder(Element element, boolean addAllAuth,
ParserContext pc, BeanReference portMapper, BeanReference portResolver, ParserContext pc, BeanReference portMapper, BeanReference portResolver,
BeanReference authenticationManager) { BeanReference authenticationManager) {
this.httpElt = element; this.httpElt = element;

View File

@ -415,12 +415,12 @@ class OrderDecorator implements Ordered {
final BeanMetadataElement bean; final BeanMetadataElement bean;
final int order; final int order;
public OrderDecorator(BeanMetadataElement bean, SecurityFilters filterOrder) { OrderDecorator(BeanMetadataElement bean, SecurityFilters filterOrder) {
this.bean = bean; this.bean = bean;
this.order = filterOrder.getOrder(); this.order = filterOrder.getOrder();
} }
public OrderDecorator(BeanMetadataElement bean, int order) { OrderDecorator(BeanMetadataElement bean, int order) {
this.bean = bean; this.bean = bean;
this.order = order; this.order = order;
} }

View File

@ -48,7 +48,7 @@ class LogoutBeanDefinitionParser implements BeanDefinitionParser {
private ManagedList<BeanMetadataElement> logoutHandlers = new ManagedList<>(); private ManagedList<BeanMetadataElement> logoutHandlers = new ManagedList<>();
private boolean csrfEnabled; private boolean csrfEnabled;
public LogoutBeanDefinitionParser(String loginPageUrl, String rememberMeServices, LogoutBeanDefinitionParser(String loginPageUrl, String rememberMeServices,
BeanMetadataElement csrfLogoutHandler) { BeanMetadataElement csrfLogoutHandler) {
this.defaultLogoutUrl = loginPageUrl + "?logout"; this.defaultLogoutUrl = loginPageUrl + "?logout";
this.rememberMeServices = rememberMeServices; this.rememberMeServices = rememberMeServices;

View File

@ -58,11 +58,11 @@ enum SecurityFilters {
private static final int INTERVAL = 100; private static final int INTERVAL = 100;
private final int order; private final int order;
private SecurityFilters() { SecurityFilters() {
order = ordinal() * INTERVAL; order = ordinal() * INTERVAL;
} }
private SecurityFilters(int order) { SecurityFilters(int order) {
this.order = order; this.order = order;
} }

View File

@ -68,7 +68,7 @@ final class ProtectPointcutPostProcessor implements BeanPostProcessor {
private final PointcutParser parser; private final PointcutParser parser;
private final Set<String> processedBeans = new HashSet<>(); private final Set<String> processedBeans = new HashSet<>();
public ProtectPointcutPostProcessor( ProtectPointcutPostProcessor(
MapBasedMethodSecurityMetadataSource mapBasedMethodSecurityMetadataSource) { MapBasedMethodSecurityMetadataSource mapBasedMethodSecurityMetadataSource) {
Assert.notNull(mapBasedMethodSecurityMetadataSource, Assert.notNull(mapBasedMethodSecurityMetadataSource,
"MapBasedMethodSecurityMetadataSource to populate is required"); "MapBasedMethodSecurityMetadataSource to populate is required");

View File

@ -72,11 +72,11 @@ public enum SecurityWebFiltersOrder {
private final int order; private final int order;
private SecurityWebFiltersOrder() { SecurityWebFiltersOrder() {
this.order = ordinal() * INTERVAL; this.order = ordinal() * INTERVAL;
} }
private SecurityWebFiltersOrder(int order) { SecurityWebFiltersOrder(int order) {
this.order = order; this.order = order;
} }

View File

@ -3658,7 +3658,7 @@ public class ServerHttpSecurity {
private final WebFilter webFilter; private final WebFilter webFilter;
private final int order; private final int order;
public OrderedWebFilter(WebFilter webFilter, int order) { OrderedWebFilter(WebFilter webFilter, int order) {
this.webFilter = webFilter; this.webFilter = webFilter;
this.order = order; this.order = order;
} }

View File

@ -243,8 +243,7 @@ public final class WebSocketMessageBrokerSecurityBeanDefinitionParser implements
private final boolean sameOriginDisabled; private final boolean sameOriginDisabled;
public MessageSecurityPostProcessor(String inboundSecurityInterceptorId, MessageSecurityPostProcessor(String inboundSecurityInterceptorId, boolean sameOriginDisabled) {
boolean sameOriginDisabled) {
this.inboundSecurityInterceptorId = inboundSecurityInterceptorId; this.inboundSecurityInterceptorId = inboundSecurityInterceptorId;
this.sameOriginDisabled = sameOriginDisabled; this.sameOriginDisabled = sameOriginDisabled;
} }

View File

@ -41,7 +41,7 @@ public class SecurityConfigurerAdapterTests {
static class OrderedObjectPostProcessor implements ObjectPostProcessor<String>, Ordered { static class OrderedObjectPostProcessor implements ObjectPostProcessor<String>, Ordered {
private final int order; private final int order;
public OrderedObjectPostProcessor(int order) { OrderedObjectPostProcessor(int order) {
this.order = order; this.order = order;
} }

View File

@ -847,7 +847,7 @@ public class ExpressionUrlAuthorizationConfigurerTests {
static class CustomExpressionRoot extends WebSecurityExpressionRoot { static class CustomExpressionRoot extends WebSecurityExpressionRoot {
public CustomExpressionRoot(Authentication a, FilterInvocation fi) { CustomExpressionRoot(Authentication a, FilterInvocation fi) {
super(a, fi); super(a, fi);
} }

View File

@ -73,7 +73,7 @@ public class NamespaceHttpExpressionHandlerTests {
@EnableWebMvc @EnableWebMvc
@EnableWebSecurity @EnableWebSecurity
private static class ExpressionHandlerConfig extends WebSecurityConfigurerAdapter { private static class ExpressionHandlerConfig extends WebSecurityConfigurerAdapter {
public ExpressionHandlerConfig() {} ExpressionHandlerConfig() {}
@Override @Override
protected void configure(AuthenticationManagerBuilder auth) throws Exception { protected void configure(AuthenticationManagerBuilder auth) throws Exception {

View File

@ -129,7 +129,7 @@ public class SecurityContextConfigurerTests {
@Configuration @Configuration
@EnableWebSecurity @EnableWebSecurity
static class SecurityContextRepositoryDefaultsSecurityContextRepositoryConfig extends WebSecurityConfigurerAdapter { static class SecurityContextRepositoryDefaultsSecurityContextRepositoryConfig extends WebSecurityConfigurerAdapter {
public SecurityContextRepositoryDefaultsSecurityContextRepositoryConfig() { SecurityContextRepositoryDefaultsSecurityContextRepositoryConfig() {
super(true); super(true);
} }

View File

@ -2133,7 +2133,7 @@ public class OAuth2ResourceServerConfigurerTests {
private class MockWebServerPropertySource extends PropertySource { private class MockWebServerPropertySource extends PropertySource {
public MockWebServerPropertySource() { MockWebServerPropertySource() {
super("mockwebserver"); super("mockwebserver");
} }
@ -2178,7 +2178,7 @@ public class OAuth2ResourceServerConfigurerTests {
private String token; private String token;
public BearerTokenRequestPostProcessor(String token) { BearerTokenRequestPostProcessor(String token) {
this.token = token; this.token = token;
} }

View File

@ -631,7 +631,7 @@ public class CsrfConfigTests {
static class CsrfReturnedResultMatcher implements ResultMatcher { static class CsrfReturnedResultMatcher implements ResultMatcher {
ExceptionalFunction<MvcResult, String> token; ExceptionalFunction<MvcResult, String> token;
public CsrfReturnedResultMatcher(ExceptionalFunction<MvcResult, String> token) { CsrfReturnedResultMatcher(ExceptionalFunction<MvcResult, String> token) {
this.token = token; this.token = token;
} }

View File

@ -83,7 +83,7 @@ public class HttpConfigTests {
private static class EncodeUrlDenyingHttpServletResponseWrapper private static class EncodeUrlDenyingHttpServletResponseWrapper
extends HttpServletResponseWrapper { extends HttpServletResponseWrapper {
public EncodeUrlDenyingHttpServletResponseWrapper(HttpServletResponse response) { EncodeUrlDenyingHttpServletResponseWrapper(HttpServletResponse response) {
super(response); super(response);
} }

View File

@ -907,7 +907,7 @@ public class MiscHttpConfigTests {
static class EncodeUrlDenyingHttpServletResponseWrapper static class EncodeUrlDenyingHttpServletResponseWrapper
extends HttpServletResponseWrapper { extends HttpServletResponseWrapper {
public EncodeUrlDenyingHttpServletResponseWrapper(HttpServletResponse response) { EncodeUrlDenyingHttpServletResponseWrapper(HttpServletResponse response) {
super(response); super(response);
} }

View File

@ -610,7 +610,7 @@ public class SessionManagementConfigTests {
private static class EncodeUrlDenyingHttpServletResponseWrapper private static class EncodeUrlDenyingHttpServletResponseWrapper
extends HttpServletResponseWrapper { extends HttpServletResponseWrapper {
public EncodeUrlDenyingHttpServletResponseWrapper(HttpServletResponse response) { EncodeUrlDenyingHttpServletResponseWrapper(HttpServletResponse response) {
super(response); super(response);
} }

View File

@ -51,7 +51,7 @@ final class HtmlUnitWebTestClient {
private final WebTestClient webTestClient; private final WebTestClient webTestClient;
public HtmlUnitWebTestClient(WebClient webClient, WebTestClient webTestClient) { HtmlUnitWebTestClient(WebClient webClient, WebTestClient webTestClient) {
Assert.notNull(webClient, "WebClient must not be null"); Assert.notNull(webClient, "WebClient must not be null");
Assert.notNull(webTestClient, "WebTestClient must not be null"); Assert.notNull(webTestClient, "WebTestClient must not be null");
this.webClient = webClient; this.webClient = webClient;

View File

@ -42,7 +42,7 @@ final class MockWebResponseBuilder {
private final FluxExchangeResult<String> exchangeResult; private final FluxExchangeResult<String> exchangeResult;
public MockWebResponseBuilder(long startTime, WebRequest webRequest, FluxExchangeResult<String> exchangeResult) { MockWebResponseBuilder(long startTime, WebRequest webRequest, FluxExchangeResult<String> exchangeResult) {
Assert.notNull(webRequest, "WebRequest must not be null"); Assert.notNull(webRequest, "WebRequest must not be null");
Assert.notNull(exchangeResult, "FluxExchangeResult must not be null"); Assert.notNull(exchangeResult, "FluxExchangeResult must not be null");
this.startTime = startTime; this.startTime = startTime;

View File

@ -55,5 +55,5 @@ public @interface Secured {
* *
* @return String[] The secure method attributes * @return String[] The secure method attributes
*/ */
public String[] value(); String[] value();
} }

View File

@ -48,11 +48,11 @@ class MethodSecurityEvaluationContext extends StandardEvaluationContext {
* for each instance. Use the constructor which takes the resolver, as an argument * for each instance. Use the constructor which takes the resolver, as an argument
* thus allowing for caching. * thus allowing for caching.
*/ */
public MethodSecurityEvaluationContext(Authentication user, MethodInvocation mi) { MethodSecurityEvaluationContext(Authentication user, MethodInvocation mi) {
this(user, mi, new DefaultSecurityParameterNameDiscoverer()); this(user, mi, new DefaultSecurityParameterNameDiscoverer());
} }
public MethodSecurityEvaluationContext(Authentication user, MethodInvocation mi, MethodSecurityEvaluationContext(Authentication user, MethodInvocation mi,
ParameterNameDiscoverer parameterNameDiscoverer) { ParameterNameDiscoverer parameterNameDiscoverer) {
this.mi = mi; this.mi = mi;
this.parameterNameDiscoverer = parameterNameDiscoverer; this.parameterNameDiscoverer = parameterNameDiscoverer;

View File

@ -40,7 +40,7 @@ public interface RoleHierarchy {
* @param authorities - List of the directly assigned authorities. * @param authorities - List of the directly assigned authorities.
* @return List of all reachable authorities given the assigned authorities. * @return List of all reachable authorities given the assigned authorities.
*/ */
public Collection<? extends GrantedAuthority> getReachableGrantedAuthorities( Collection<? extends GrantedAuthority> getReachableGrantedAuthorities(
Collection<? extends GrantedAuthority> authorities); Collection<? extends GrantedAuthority> authorities);
} }

View File

@ -116,7 +116,7 @@ public final class DelegatingMethodSecurityMetadataSource extends
private final Method method; private final Method method;
private final Class<?> targetClass; private final Class<?> targetClass;
public DefaultCacheKey(Method method, Class<?> targetClass) { DefaultCacheKey(Method method, Class<?> targetClass) {
this.method = method; this.method = method;
this.targetClass = targetClass; this.targetClass = targetClass;
} }

View File

@ -287,7 +287,7 @@ public class MapBasedMethodSecurityMetadataSource extends
private final Method method; private final Method method;
private final Class<?> registeredJavaType; private final Class<?> registeredJavaType;
public RegisteredMethod(Method method, Class<?> registeredJavaType) { RegisteredMethod(Method method, Class<?> registeredJavaType) {
Assert.notNull(method, "Method required"); Assert.notNull(method, "Method required");
Assert.notNull(registeredJavaType, "Registered Java Type required"); Assert.notNull(registeredJavaType, "Registered Java Type required");
this.method = method; this.method = method;

View File

@ -29,5 +29,5 @@ import org.springframework.security.access.SecurityMetadataSource;
* @author Ben Alex * @author Ben Alex
*/ */
public interface MethodSecurityMetadataSource extends SecurityMetadataSource { public interface MethodSecurityMetadataSource extends SecurityMetadataSource {
public Collection<ConfigAttribute> getAttributes(Method method, Class<?> targetClass); Collection<ConfigAttribute> getAttributes(Method method, Class<?> targetClass);
} }

View File

@ -38,5 +38,5 @@ public @interface PostAuthorize {
* @return the Spring-EL expression to be evaluated after invoking the protected * @return the Spring-EL expression to be evaluated after invoking the protected
* method * method
*/ */
public String value(); String value();
} }

View File

@ -38,5 +38,5 @@ public @interface PostFilter {
* @return the Spring-EL expression to be evaluated after invoking the protected * @return the Spring-EL expression to be evaluated after invoking the protected
* method * method
*/ */
public String value(); String value();
} }

View File

@ -50,12 +50,12 @@ public @interface PreFilter {
* @return the Spring-EL expression to be evaluated before invoking the protected * @return the Spring-EL expression to be evaluated before invoking the protected
* method * method
*/ */
public String value(); String value();
/** /**
* @return the name of the parameter which should be filtered (must be a non-null * @return the name of the parameter which should be filtered (must be a non-null
* collection instance) If the method contains a single collection argument, then this * collection instance) If the method contains a single collection argument, then this
* attribute can be omitted. * attribute can be omitted.
*/ */
public String filterTarget() default ""; String filterTarget() default "";
} }

View File

@ -45,14 +45,14 @@ public abstract class AbstractAccessDecisionManager implements AccessDecisionMan
// ================================================================================================ // ================================================================================================
protected final Log logger = LogFactory.getLog(getClass()); protected final Log logger = LogFactory.getLog(getClass());
private List<AccessDecisionVoter<? extends Object>> decisionVoters; private List<AccessDecisionVoter<?>> decisionVoters;
protected MessageSourceAccessor messages = SpringSecurityMessageSource.getAccessor(); protected MessageSourceAccessor messages = SpringSecurityMessageSource.getAccessor();
private boolean allowIfAllAbstainDecisions = false; private boolean allowIfAllAbstainDecisions = false;
protected AbstractAccessDecisionManager( protected AbstractAccessDecisionManager(
List<AccessDecisionVoter<? extends Object>> decisionVoters) { List<AccessDecisionVoter<?>> decisionVoters) {
Assert.notEmpty(decisionVoters, "A list of AccessDecisionVoters is required"); Assert.notEmpty(decisionVoters, "A list of AccessDecisionVoters is required");
this.decisionVoters = decisionVoters; this.decisionVoters = decisionVoters;
} }
@ -72,7 +72,7 @@ public abstract class AbstractAccessDecisionManager implements AccessDecisionMan
} }
} }
public List<AccessDecisionVoter<? extends Object>> getDecisionVoters() { public List<AccessDecisionVoter<?>> getDecisionVoters() {
return this.decisionVoters; return this.decisionVoters;
} }

View File

@ -30,7 +30,7 @@ import org.springframework.security.core.Authentication;
*/ */
public class AffirmativeBased extends AbstractAccessDecisionManager { public class AffirmativeBased extends AbstractAccessDecisionManager {
public AffirmativeBased(List<AccessDecisionVoter<? extends Object>> decisionVoters) { public AffirmativeBased(List<AccessDecisionVoter<?>> decisionVoters) {
super(decisionVoters); super(decisionVoters);
} }

View File

@ -38,7 +38,7 @@ public class ConsensusBased extends AbstractAccessDecisionManager {
private boolean allowIfEqualGrantedDeniedDecisions = true; private boolean allowIfEqualGrantedDeniedDecisions = true;
public ConsensusBased(List<AccessDecisionVoter<? extends Object>> decisionVoters) { public ConsensusBased(List<AccessDecisionVoter<?>> decisionVoters) {
super(decisionVoters); super(decisionVoters);
} }

View File

@ -32,7 +32,7 @@ import org.springframework.security.core.Authentication;
*/ */
public class UnanimousBased extends AbstractAccessDecisionManager { public class UnanimousBased extends AbstractAccessDecisionManager {
public UnanimousBased(List<AccessDecisionVoter<? extends Object>> decisionVoters) { public UnanimousBased(List<AccessDecisionVoter<?>> decisionVoters) {
super(decisionVoters); super(decisionVoters);
} }

View File

@ -402,7 +402,7 @@ public abstract class AbstractJaasAuthenticationProvider
private class InternalCallbackHandler implements CallbackHandler { private class InternalCallbackHandler implements CallbackHandler {
private final Authentication authentication; private final Authentication authentication;
public InternalCallbackHandler(Authentication authentication) { InternalCallbackHandler(Authentication authentication) {
this.authentication = authentication; this.authentication = authentication;
} }

View File

@ -61,24 +61,24 @@ public final class DelegatingSecurityContextScheduledExecutorService extends
this(delegate, null); this(delegate, null);
} }
public final ScheduledFuture<?> schedule(Runnable command, long delay, TimeUnit unit) { public ScheduledFuture<?> schedule(Runnable command, long delay, TimeUnit unit) {
command = wrap(command); command = wrap(command);
return getDelegate().schedule(command, delay, unit); return getDelegate().schedule(command, delay, unit);
} }
public final <V> ScheduledFuture<V> schedule(Callable<V> callable, long delay, public <V> ScheduledFuture<V> schedule(Callable<V> callable, long delay,
TimeUnit unit) { TimeUnit unit) {
callable = wrap(callable); callable = wrap(callable);
return getDelegate().schedule(callable, delay, unit); return getDelegate().schedule(callable, delay, unit);
} }
public final ScheduledFuture<?> scheduleAtFixedRate(Runnable command, public ScheduledFuture<?> scheduleAtFixedRate(Runnable command,
long initialDelay, long period, TimeUnit unit) { long initialDelay, long period, TimeUnit unit) {
command = wrap(command); command = wrap(command);
return getDelegate().scheduleAtFixedRate(command, initialDelay, period, unit); return getDelegate().scheduleAtFixedRate(command, initialDelay, period, unit);
} }
public final ScheduledFuture<?> scheduleWithFixedDelay(Runnable command, public ScheduledFuture<?> scheduleWithFixedDelay(Runnable command,
long initialDelay, long delay, TimeUnit unit) { long initialDelay, long delay, TimeUnit unit) {
command = wrap(command); command = wrap(command);
return getDelegate().scheduleWithFixedDelay(command, initialDelay, delay, unit); return getDelegate().scheduleWithFixedDelay(command, initialDelay, delay, unit);
@ -87,4 +87,4 @@ public final class DelegatingSecurityContextScheduledExecutorService extends
private ScheduledExecutorService getDelegate() { private ScheduledExecutorService getDelegate() {
return (ScheduledExecutorService) getDelegateExecutor(); return (ScheduledExecutorService) getDelegateExecutor();
} }
} }

View File

@ -92,9 +92,9 @@ class ComparableVersion implements Comparable<ComparableVersion> {
private ListItem items; private ListItem items;
private interface Item { private interface Item {
final int INTEGER_ITEM = 0; int INTEGER_ITEM = 0;
final int STRING_ITEM = 1; int STRING_ITEM = 1;
final int LIST_ITEM = 2; int LIST_ITEM = 2;
int compareTo(Item item); int compareTo(Item item);
@ -117,7 +117,7 @@ class ComparableVersion implements Comparable<ComparableVersion> {
this.value = BigInteger_ZERO; this.value = BigInteger_ZERO;
} }
public IntegerItem(String str) { IntegerItem(String str) {
this.value = new BigInteger(str); this.value = new BigInteger(str);
} }
@ -184,7 +184,7 @@ class ComparableVersion implements Comparable<ComparableVersion> {
private String value; private String value;
public StringItem(String value, boolean followedByDigit) { StringItem(String value, boolean followedByDigit) {
if (followedByDigit && value.length() == 1) { if (followedByDigit && value.length() == 1) {
// a1 = alpha-1, b1 = beta-1, m1 = milestone-1 // a1 = alpha-1, b1 = beta-1, m1 = milestone-1
switch (value.charAt(0)) { switch (value.charAt(0)) {
@ -341,7 +341,7 @@ class ComparableVersion implements Comparable<ComparableVersion> {
} }
} }
public ComparableVersion(String version) { ComparableVersion(String version) {
parseVersion(version); parseVersion(version);
} }

View File

@ -37,6 +37,6 @@ public interface Attributes2GrantedAuthoritiesMapper {
* @param attributes the attributes to be mapped * @param attributes the attributes to be mapped
* @return the collection of authorities created from the attributes * @return the collection of authorities created from the attributes
*/ */
public Collection<? extends GrantedAuthority> getGrantedAuthorities( Collection<? extends GrantedAuthority> getGrantedAuthorities(
Collection<String> attributes); Collection<String> attributes);
} }

View File

@ -83,7 +83,7 @@ public class KeyBasedPersistenceTokenService implements TokenService, Initializi
long creationTime = new Date().getTime(); long creationTime = new Date().getTime();
String serverSecret = computeServerSecretApplicableAt(creationTime); String serverSecret = computeServerSecretApplicableAt(creationTime);
String pseudoRandomNumber = generatePseudoRandomNumber(); String pseudoRandomNumber = generatePseudoRandomNumber();
String content = Long.toString(creationTime) + ":" + pseudoRandomNumber + ":" String content = creationTime + ":" + pseudoRandomNumber + ":"
+ extendedInformation; + extendedInformation;
// Compute key // Compute key
@ -126,7 +126,7 @@ public class KeyBasedPersistenceTokenService implements TokenService, Initializi
String sha1Hex = tokens[tokens.length - 1]; String sha1Hex = tokens[tokens.length - 1];
// Verification // Verification
String content = Long.toString(creationTime) + ":" + pseudoRandomNumber + ":" String content = creationTime + ":" + pseudoRandomNumber + ":"
+ extendedInfo.toString(); + extendedInfo.toString();
String expectedSha512Hex = Sha512DigestUtils.shaHex(content + ":" + serverSecret); String expectedSha512Hex = Sha512DigestUtils.shaHex(content + ":" + serverSecret);
Assert.isTrue(expectedSha512Hex.equals(sha1Hex), "Key verification failure"); Assert.isTrue(expectedSha512Hex.equals(sha1Hex), "Key verification failure");

View File

@ -53,7 +53,7 @@ class AnonymousAuthenticationTokenMixin {
* @param authorities the authorities granted to the principal * @param authorities the authorities granted to the principal
*/ */
@JsonCreator @JsonCreator
public AnonymousAuthenticationTokenMixin(@JsonProperty("keyHash") Integer keyHash, @JsonProperty("principal") Object principal, AnonymousAuthenticationTokenMixin(@JsonProperty("keyHash") Integer keyHash, @JsonProperty("principal") Object principal,
@JsonProperty("authorities") Collection<? extends GrantedAuthority> authorities) { @JsonProperty("authorities") Collection<? extends GrantedAuthority> authorities) {
} }
} }

View File

@ -59,7 +59,7 @@ class RememberMeAuthenticationTokenMixin {
* @param authorities the authorities granted to the principal * @param authorities the authorities granted to the principal
*/ */
@JsonCreator @JsonCreator
public RememberMeAuthenticationTokenMixin(@JsonProperty("keyHash") Integer keyHash, RememberMeAuthenticationTokenMixin(@JsonProperty("keyHash") Integer keyHash,
@JsonProperty("principal") Object principal, @JsonProperty("principal") Object principal,
@JsonProperty("authorities") Collection<? extends GrantedAuthority> authorities) { @JsonProperty("authorities") Collection<? extends GrantedAuthority> authorities) {
} }

View File

@ -152,7 +152,7 @@ public final class SecurityJackson2Modules {
*/ */
static class WhitelistTypeResolverBuilder extends ObjectMapper.DefaultTypeResolverBuilder { static class WhitelistTypeResolverBuilder extends ObjectMapper.DefaultTypeResolverBuilder {
public WhitelistTypeResolverBuilder(ObjectMapper.DefaultTyping defaultTyping) { WhitelistTypeResolverBuilder(ObjectMapper.DefaultTyping defaultTyping) {
super(defaultTyping); super(defaultTyping);
} }

View File

@ -33,7 +33,7 @@ class MutableUser implements MutableUserDetails {
private String password; private String password;
private final UserDetails delegate; private final UserDetails delegate;
public MutableUser(UserDetails user) { MutableUser(UserDetails user) {
this.delegate = user; this.delegate = user;
this.password = user.getPassword(); this.password = user.getPassword();
} }

View File

@ -92,7 +92,7 @@ public class SecurityConfigTests {
private class MockConfigAttribute implements ConfigAttribute { private class MockConfigAttribute implements ConfigAttribute {
private String attribute; private String attribute;
public MockConfigAttribute(String configuration) { MockConfigAttribute(String configuration) {
this.attribute = configuration; this.attribute = configuration;
} }

View File

@ -35,31 +35,31 @@ public interface BusinessService extends Serializable {
@Secured({ "ROLE_ADMIN" }) @Secured({ "ROLE_ADMIN" })
@RolesAllowed({ "ROLE_ADMIN" }) @RolesAllowed({ "ROLE_ADMIN" })
@PreAuthorize("hasRole('ROLE_ADMIN')") @PreAuthorize("hasRole('ROLE_ADMIN')")
public void someAdminMethod(); void someAdminMethod();
@Secured({ "ROLE_USER", "ROLE_ADMIN" }) @Secured({ "ROLE_USER", "ROLE_ADMIN" })
@RolesAllowed({ "ROLE_USER", "ROLE_ADMIN" }) @RolesAllowed({ "ROLE_USER", "ROLE_ADMIN" })
public void someUserAndAdminMethod(); void someUserAndAdminMethod();
@Secured({ "ROLE_USER" }) @Secured({ "ROLE_USER" })
@RolesAllowed({ "ROLE_USER" }) @RolesAllowed({ "ROLE_USER" })
public void someUserMethod1(); void someUserMethod1();
@Secured({ "ROLE_USER" }) @Secured({ "ROLE_USER" })
@RolesAllowed({ "ROLE_USER" }) @RolesAllowed({ "ROLE_USER" })
public void someUserMethod2(); void someUserMethod2();
@RolesAllowed({ "USER" }) @RolesAllowed({ "USER" })
public void rolesAllowedUser(); void rolesAllowedUser();
public int someOther(String s); int someOther(String s);
public int someOther(int input); int someOther(int input);
public List<?> methodReturningAList(List<?> someList); List<?> methodReturningAList(List<?> someList);
public Object[] methodReturningAnArray(Object[] someArray); Object[] methodReturningAnArray(Object[] someArray);
public List<?> methodReturningAList(String userName, String extraParam); List<?> methodReturningAList(String userName, String extraParam);
} }

View File

@ -218,7 +218,7 @@ public class SecuredAnnotationSecurityMetadataSourceTests {
// Inner classes // Inner classes
class Department extends Entity { class Department extends Entity {
public Department(String name) { Department(String name) {
super(name); super(name);
} }
} }
@ -285,15 +285,15 @@ public class SecuredAnnotationSecurityMetadataSourceTests {
public @interface AnnotatedAnnotation { public @interface AnnotatedAnnotation {
} }
public static interface ReturnVoid { public interface ReturnVoid {
public void doSomething(List<?> param); void doSomething(List<?> param);
} }
@AnnotatedAnnotation @AnnotatedAnnotation
public static interface ReturnVoid2 { public interface ReturnVoid2 {
public void doSomething(List<?> param); void doSomething(List<?> param);
} }
@AnnotatedAnnotation @AnnotatedAnnotation

View File

@ -58,7 +58,7 @@ public class MethodSecurityEvaluationContextTests {
private static class NotNullVariableMethodSecurityEvaluationContext private static class NotNullVariableMethodSecurityEvaluationContext
extends MethodSecurityEvaluationContext { extends MethodSecurityEvaluationContext {
public NotNullVariableMethodSecurityEvaluationContext(Authentication auth, MethodInvocation mi, NotNullVariableMethodSecurityEvaluationContext(Authentication auth, MethodInvocation mi,
ParameterNameDiscoverer parameterNameDiscoverer) { ParameterNameDiscoverer parameterNameDiscoverer) {
super(auth, mi, parameterNameDiscoverer); super(auth, mi, parameterNameDiscoverer);
} }

View File

@ -203,19 +203,19 @@ public class PrePostAnnotationSecurityMetadataSourceTests {
// ~ Inner Classes // ~ Inner Classes
// ================================================================================================== // ==================================================================================================
public static interface ReturnVoid { public interface ReturnVoid {
public void doSomething(List<?> param); void doSomething(List<?> param);
} }
public static interface ReturnAList { public interface ReturnAList {
public List<?> doSomething(List<?> param); List<?> doSomething(List<?> param);
} }
@PreAuthorize("interfaceAuthzExpression") @PreAuthorize("interfaceAuthzExpression")
public static interface ReturnAnotherList { public interface ReturnAnotherList {
@PreAuthorize("interfaceMethodAuthzExpression") @PreAuthorize("interfaceMethodAuthzExpression")
@PreFilter(filterTarget = "param", value = "interfacePreFilterExpression") @PreFilter(filterTarget = "param", value = "interfacePreFilterExpression")
public List<?> doSomething(List<?> param); List<?> doSomething(List<?> param);
} }
@PreAuthorize("someExpression") @PreAuthorize("someExpression")
@ -275,8 +275,8 @@ public class PrePostAnnotationSecurityMetadataSourceTests {
} }
@CustomAnnotation @CustomAnnotation
public static interface ReturnVoid2 { public interface ReturnVoid2 {
public void doSomething(List<?> param); void doSomething(List<?> param);
} }
@CustomAnnotation @CustomAnnotation

View File

@ -179,8 +179,7 @@ public class AfterInvocationProviderManagerTests {
private Object forceReturnObject; private Object forceReturnObject;
public MockAfterInvocationProvider(Object forceReturnObject, Class secureObject, MockAfterInvocationProvider(Object forceReturnObject, Class secureObject, ConfigAttribute configAttribute) {
ConfigAttribute configAttribute) {
this.forceReturnObject = forceReturnObject; this.forceReturnObject = forceReturnObject;
this.secureObject = secureObject; this.secureObject = secureObject;
this.configAttribute = configAttribute; this.configAttribute = configAttribute;

View File

@ -156,8 +156,7 @@ public class AbstractAuthenticationTokenTests {
private Object credentials; private Object credentials;
private Object principal; private Object principal;
public MockAuthenticationImpl(Object principal, Object credentials, MockAuthenticationImpl(Object principal, Object credentials, List<GrantedAuthority> authorities) {
List<GrantedAuthority> authorities) {
super(authorities); super(authorities);
this.principal = principal; this.principal = principal;
this.credentials = credentials; this.credentials = credentials;

View File

@ -139,7 +139,7 @@ public class DefaultAuthenticationEventPublisherTests {
private static final class MockAuthenticationException extends private static final class MockAuthenticationException extends
AuthenticationException { AuthenticationException {
public MockAuthenticationException(String msg) { MockAuthenticationException(String msg) {
super(msg); super(msg);
} }
} }

View File

@ -290,7 +290,7 @@ public class JaasAuthenticationProviderTests {
private static class MockLoginContext extends LoginContext { private static class MockLoginContext extends LoginContext {
boolean loggedOut = false; boolean loggedOut = false;
public MockLoginContext(String loginModule) throws LoginException { MockLoginContext(String loginModule) throws LoginException {
super(loginModule); super(loginModule);
} }

View File

@ -119,7 +119,7 @@ public class RemoteAuthenticationProviderTests {
private class MockRemoteAuthenticationManager implements RemoteAuthenticationManager { private class MockRemoteAuthenticationManager implements RemoteAuthenticationManager {
private boolean grantAccess; private boolean grantAccess;
public MockRemoteAuthenticationManager(boolean grantAccess) { MockRemoteAuthenticationManager(boolean grantAccess) {
this.grantAccess = grantAccess; this.grantAccess = grantAccess;
} }

View File

@ -62,8 +62,8 @@ public class DelegatingSecurityContextSupportTests extends
private static class ConcreteDelegatingSecurityContextSupport extends private static class ConcreteDelegatingSecurityContextSupport extends
AbstractDelegatingSecurityContextSupport { AbstractDelegatingSecurityContextSupport {
public ConcreteDelegatingSecurityContextSupport(SecurityContext securityContext) { ConcreteDelegatingSecurityContextSupport(SecurityContext securityContext) {
super(securityContext); super(securityContext);
} }
} }
} }

View File

@ -78,13 +78,13 @@ public class AnnotationParameterNameDiscovererTests {
@Test @Test
public void getParameterNamesConstructor() throws Exception { public void getParameterNamesConstructor() throws Exception {
assertThat(discoverer.getParameterNames(Impl.class.getConstructor(String.class))) assertThat(discoverer.getParameterNames(Impl.class.getDeclaredConstructor(String.class)))
.isEqualTo(new String[] { "id" }); .isEqualTo(new String[] { "id" });
} }
@Test @Test
public void getParameterNamesConstructorNoAnnotation() throws Exception { public void getParameterNamesConstructorNoAnnotation() throws Exception {
assertThat(discoverer.getParameterNames(Impl.class.getConstructor(Long.class))) assertThat(discoverer.getParameterNames(Impl.class.getDeclaredConstructor(Long.class)))
.isNull(); .isNull();
} }
@ -148,10 +148,10 @@ public class AnnotationParameterNameDiscovererTests {
} }
static class Impl { static class Impl {
public Impl(Long dataSourceId) { Impl(Long dataSourceId) {
} }
public Impl(@P("id") String dataSourceId) { Impl(@P("id") String dataSourceId) {
} }
String findMessageByTo(@P("to") String to) { String findMessageByTo(@P("to") String to) {

View File

@ -13,7 +13,6 @@
// OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. // OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
package org.springframework.security.crypto.bcrypt; package org.springframework.security.crypto.bcrypt;
import java.io.UnsupportedEncodingException;
import java.nio.charset.StandardCharsets; import java.nio.charset.StandardCharsets;
import java.security.MessageDigest; import java.security.MessageDigest;
import java.util.Arrays; import java.util.Arrays;
@ -486,7 +485,7 @@ public class BCrypt {
* @param lr an array containing the two 32-bit half blocks * @param lr an array containing the two 32-bit half blocks
* @param off the position in the array of the blocks * @param off the position in the array of the blocks
*/ */
private final void encipher(int lr[], int off) { private void encipher(int lr[], int off) {
int i, n, l = lr[off], r = lr[off + 1]; int i, n, l = lr[off], r = lr[off + 1];
l ^= P[0]; l ^= P[0];
@ -733,11 +732,7 @@ public class BCrypt {
public static String hashpw(String password, String salt) { public static String hashpw(String password, String salt) {
byte passwordb[]; byte passwordb[];
try { passwordb = password.getBytes(StandardCharsets.UTF_8);
passwordb = password.getBytes("UTF-8");
} catch (UnsupportedEncodingException uee) {
throw new AssertionError("UTF-8 is not supported");
}
return hashpw(passwordb, salt); return hashpw(passwordb, salt);
} }

View File

@ -19,6 +19,7 @@ import java.nio.ByteBuffer;
import java.nio.CharBuffer; import java.nio.CharBuffer;
import java.nio.charset.CharacterCodingException; import java.nio.charset.CharacterCodingException;
import java.nio.charset.Charset; import java.nio.charset.Charset;
import java.nio.charset.StandardCharsets;
/** /**
* UTF-8 Charset encoder/decoder. * UTF-8 Charset encoder/decoder.
@ -28,7 +29,7 @@ import java.nio.charset.Charset;
* @author Luke Taylor * @author Luke Taylor
*/ */
public final class Utf8 { public final class Utf8 {
private static final Charset CHARSET = Charset.forName("UTF-8"); private static final Charset CHARSET = StandardCharsets.UTF_8;
/** /**
* Get the bytes of the String in UTF-8 encoded form. * Get the bytes of the String in UTF-8 encoded form.

View File

@ -65,7 +65,7 @@ public final class AesBytesEncryptor implements BytesEncryptor {
private BytesKeyGenerator ivGenerator; private BytesKeyGenerator ivGenerator;
private String name; private String name;
private CipherAlgorithm(String name, BytesKeyGenerator ivGenerator) { CipherAlgorithm(String name, BytesKeyGenerator ivGenerator) {
this.name = name; this.name = name;
this.ivGenerator = ivGenerator; this.ivGenerator = ivGenerator;
} }

View File

@ -28,7 +28,7 @@ final class HexEncodingTextEncryptor implements TextEncryptor {
private final BytesEncryptor encryptor; private final BytesEncryptor encryptor;
public HexEncodingTextEncryptor(BytesEncryptor encryptor) { HexEncodingTextEncryptor(BytesEncryptor encryptor) {
this.encryptor = encryptor; this.encryptor = encryptor;
} }

View File

@ -26,7 +26,7 @@ final class HexEncodingStringKeyGenerator implements StringKeyGenerator {
private final BytesKeyGenerator keyGenerator; private final BytesKeyGenerator keyGenerator;
public HexEncodingStringKeyGenerator(BytesKeyGenerator keyGenerator) { HexEncodingStringKeyGenerator(BytesKeyGenerator keyGenerator) {
this.keyGenerator = keyGenerator; this.keyGenerator = keyGenerator;
} }

View File

@ -34,14 +34,14 @@ final class SecureRandomBytesKeyGenerator implements BytesKeyGenerator {
/** /**
* Creates a secure random key generator using the defaults. * Creates a secure random key generator using the defaults.
*/ */
public SecureRandomBytesKeyGenerator() { SecureRandomBytesKeyGenerator() {
this(DEFAULT_KEY_LENGTH); this(DEFAULT_KEY_LENGTH);
} }
/** /**
* Creates a secure random key generator with a custom key length. * Creates a secure random key generator with a custom key length.
*/ */
public SecureRandomBytesKeyGenerator(int keyLength) { SecureRandomBytesKeyGenerator(int keyLength) {
this.random = new SecureRandom(); this.random = new SecureRandom();
this.keyLength = keyLength; this.keyLength = keyLength;
} }

View File

@ -26,7 +26,7 @@ final class SharedKeyGenerator implements BytesKeyGenerator {
private byte[] sharedKey; private byte[] sharedKey;
public SharedKeyGenerator(byte[] sharedKey) { SharedKeyGenerator(byte[] sharedKey) {
this.sharedKey = sharedKey; this.sharedKey = sharedKey;
} }
@ -38,4 +38,4 @@ final class SharedKeyGenerator implements BytesKeyGenerator {
return sharedKey; return sharedKey;
} }
} }

View File

@ -38,7 +38,7 @@ final class Digester {
* @param algorithm the digest algorithm; for example, "SHA-1" or "SHA-256". * @param algorithm the digest algorithm; for example, "SHA-1" or "SHA-256".
* @param iterations the number of times to apply the digest algorithm to the input * @param iterations the number of times to apply the digest algorithm to the input
*/ */
public Digester(String algorithm, int iterations) { Digester(String algorithm, int iterations) {
// eagerly validate the algorithm // eagerly validate the algorithm
createDigest(algorithm); createDigest(algorithm);
this.algorithm = algorithm; this.algorithm = algorithm;
@ -53,7 +53,7 @@ final class Digester {
return value; return value;
} }
final void setIterations(int iterations) { void setIterations(int iterations) {
if (iterations <= 0) { if (iterations <= 0) {
throw new IllegalArgumentException("Iterations value must be greater than zero"); throw new IllegalArgumentException("Iterations value must be greater than zero");
} }

View File

@ -126,7 +126,7 @@ public class BouncyCastleAesBytesEncryptorEquivalencyTest {
private final int keyLength; private final int keyLength;
public PredictableRandomBytesKeyGenerator(int keyLength) { PredictableRandomBytesKeyGenerator(int keyLength) {
this.random = new Random(1); this.random = new Random(1);
this.keyLength = keyLength; this.keyLength = keyLength;
} }

View File

@ -20,6 +20,7 @@
<!-- Coding --> <!-- Coding -->
<module name="EmptyStatementCheck" /> <module name="EmptyStatementCheck" />
<module name="RedundantModifier" />
<!-- Imports --> <!-- Imports -->
<module name="UnusedImportsCheck"> <module name="UnusedImportsCheck">

View File

@ -127,7 +127,7 @@ public class FilterChainPerformanceTests {
HttpSessionSecurityContextRepository.SPRING_SECURITY_CONTEXT_KEY, HttpSessionSecurityContextRepository.SPRING_SECURITY_CONTEXT_KEY,
SecurityContextHolder.getContext()); SecurityContextHolder.getContext());
SecurityContextHolder.clearContext(); SecurityContextHolder.clearContext();
sw.start(Integer.toString(nAuthorities) + " authorities"); sw.start(nAuthorities + " authorities");
runWithStack(minimalStack); runWithStack(minimalStack);
System.out.println(sw.shortSummary()); System.out.println(sw.shortSummary());
sw.stop(); sw.stop();

View File

@ -17,6 +17,6 @@ package org.springframework.security.integration;
public interface UserRepository { public interface UserRepository {
public void doSomething(); void doSomething();
} }

View File

@ -20,6 +20,6 @@ import org.springframework.security.access.prepost.PreAuthorize;
public interface TestService { public interface TestService {
@PreAuthorize("someMethod.py") @PreAuthorize("someMethod.py")
public void someMethod(); void someMethod();
} }

View File

@ -162,7 +162,7 @@ public class DefaultSpringSecurityContextSourceTests {
static class EnvExposingDefaultSpringSecurityContextSource extends static class EnvExposingDefaultSpringSecurityContextSource extends
DefaultSpringSecurityContextSource { DefaultSpringSecurityContextSource {
public EnvExposingDefaultSpringSecurityContextSource(String providerUrl) { EnvExposingDefaultSpringSecurityContextSource(String providerUrl) {
super(providerUrl); super(providerUrl);
} }

View File

@ -55,7 +55,7 @@ public enum PasswordPolicyErrorStatus {
private final String errorCode; private final String errorCode;
private final String defaultMessage; private final String defaultMessage;
private PasswordPolicyErrorStatus(String errorCode, String defaultMessage) { PasswordPolicyErrorStatus(String errorCode, String defaultMessage) {
this.errorCode = errorCode; this.errorCode = errorCode;
this.defaultMessage = defaultMessage; this.defaultMessage = defaultMessage;
} }

View File

@ -493,7 +493,7 @@ public class LdapUserDetailsManager implements UserDetailsManager {
private final ByteArrayOutputStream value = new ByteArrayOutputStream(); private final ByteArrayOutputStream value = new ByteArrayOutputStream();
public PasswordModifyRequest(String userIdentity, String oldPassword, String newPassword) { PasswordModifyRequest(String userIdentity, String oldPassword, String newPassword) {
ByteArrayOutputStream elements = new ByteArrayOutputStream(); ByteArrayOutputStream elements = new ByteArrayOutputStream();
if (userIdentity != null) { if (userIdentity != null) {

View File

@ -468,7 +468,7 @@ public class ActiveDirectoryLdapAuthenticationProviderTests {
static class MockNamingEnumeration implements NamingEnumeration<SearchResult> { static class MockNamingEnumeration implements NamingEnumeration<SearchResult> {
private SearchResult sr; private SearchResult sr;
public MockNamingEnumeration(SearchResult sr) { MockNamingEnumeration(SearchResult sr) {
this.sr = sr; this.sr = sr;
} }

View File

@ -44,7 +44,7 @@ class MessageExpressionConfigAttribute implements ConfigAttribute, EvaluationCon
* @param authorizeExpression the {@link Expression} to use. Cannot be null * @param authorizeExpression the {@link Expression} to use. Cannot be null
* @param matcher the {@link MessageMatcher} used to match the messages. * @param matcher the {@link MessageMatcher} used to match the messages.
*/ */
public MessageExpressionConfigAttribute(Expression authorizeExpression, MessageMatcher<?> matcher) { MessageExpressionConfigAttribute(Expression authorizeExpression, MessageMatcher<?> matcher) {
Assert.notNull(authorizeExpression, "authorizeExpression cannot be null"); Assert.notNull(authorizeExpression, "authorizeExpression cannot be null");
Assert.notNull(matcher, "matcher cannot be null"); Assert.notNull(matcher, "matcher cannot be null");
this.authorizeExpression = authorizeExpression; this.authorizeExpression = authorizeExpression;

View File

@ -38,7 +38,7 @@ abstract class AbstractMessageMatcherComposite<T> implements MessageMatcher<T> {
* *
* @param messageMatchers the {@link MessageMatcher} instances to try * @param messageMatchers the {@link MessageMatcher} instances to try
*/ */
public AbstractMessageMatcherComposite(List<MessageMatcher<T>> messageMatchers) { AbstractMessageMatcherComposite(List<MessageMatcher<T>> messageMatchers) {
notEmpty(messageMatchers, "messageMatchers must contain a value"); notEmpty(messageMatchers, "messageMatchers must contain a value");
if (messageMatchers.contains(null)) { if (messageMatchers.contains(null)) {
throw new IllegalArgumentException( throw new IllegalArgumentException(
@ -54,7 +54,7 @@ abstract class AbstractMessageMatcherComposite<T> implements MessageMatcher<T> {
* @param messageMatchers the {@link MessageMatcher} instances to try * @param messageMatchers the {@link MessageMatcher} instances to try
*/ */
@SafeVarargs @SafeVarargs
public AbstractMessageMatcherComposite(MessageMatcher<T>... messageMatchers) { AbstractMessageMatcherComposite(MessageMatcher<T>... messageMatchers) {
this(asList(messageMatchers)); this(asList(messageMatchers));
} }

View File

@ -37,7 +37,7 @@ public interface MessageMatcher<T> {
*/ */
MessageMatcher<Object> ANY_MESSAGE = new MessageMatcher<Object>() { MessageMatcher<Object> ANY_MESSAGE = new MessageMatcher<Object>() {
@Override @Override
public boolean matches(Message<? extends Object> message) { public boolean matches(Message<?> message) {
return true; return true;
} }

View File

@ -120,7 +120,7 @@ public final class SimpDestinationMessageMatcher implements MessageMatcher<Objec
this.pattern = pattern; this.pattern = pattern;
} }
public boolean matches(Message<? extends Object> message) { public boolean matches(Message<?> message) {
if (!messageTypeMatcher.matches(message)) { if (!messageTypeMatcher.matches(message)) {
return false; return false;
} }
@ -131,7 +131,7 @@ public final class SimpDestinationMessageMatcher implements MessageMatcher<Objec
} }
public Map<String, String> extractPathVariables(Message<? extends Object> message){ public Map<String, String> extractPathVariables(Message<?> message){
final String destination = SimpMessageHeaderAccessor.getDestination(message final String destination = SimpMessageHeaderAccessor.getDestination(message
.getHeaders()); .getHeaders());
return destination != null ? matcher.extractUriTemplateVariables(pattern, destination) return destination != null ? matcher.extractUriTemplateVariables(pattern, destination)

View File

@ -45,7 +45,7 @@ public class SimpMessageTypeMatcher implements MessageMatcher<Object> {
} }
@Override @Override
public boolean matches(Message<? extends Object> message) { public boolean matches(Message<?> message) {
MessageHeaders headers = message.getHeaders(); MessageHeaders headers = message.getHeaders();
SimpMessageType messageType = SimpMessageHeaderAccessor.getMessageType(headers); SimpMessageType messageType = SimpMessageHeaderAccessor.getMessageType(headers);

View File

@ -258,10 +258,10 @@ public class AuthenticationPrincipalArgumentResolverTests {
public final String property = "property"; public final String property = "property";
} }
static class CopyUserPrincipal { public static class CopyUserPrincipal {
public final String property; public final String property;
CopyUserPrincipal(String property) { public CopyUserPrincipal(String property) {
this.property = property; this.property = property;
} }

Some files were not shown because too many files have changed in this diff Show More