mirror of
https://github.com/spring-projects/spring-security.git
synced 2025-06-26 22:02:41 +00:00
Adding assertions on constructor arg values.
This commit is contained in:
parent
f92589f051
commit
56e86dd36f
@ -54,6 +54,7 @@ public abstract class AbstractAccessDecisionManager implements AccessDecisionMan
|
||||
}
|
||||
|
||||
protected AbstractAccessDecisionManager(List<AccessDecisionVoter> decisionVoters) {
|
||||
Assert.notEmpty(decisionVoters, "A list of AccessDecisionVoters is required");
|
||||
this.decisionVoters = decisionVoters;
|
||||
}
|
||||
|
||||
|
@ -100,13 +100,19 @@ public class ProviderManager implements AuthenticationManager, MessageSourceAwar
|
||||
}
|
||||
|
||||
public ProviderManager(List<AuthenticationProvider> providers, AuthenticationManager parent) {
|
||||
Assert.notNull(providers, "providers list cannot be null");
|
||||
this.providers = providers;
|
||||
this.parent = parent;
|
||||
checkState();
|
||||
}
|
||||
|
||||
//~ Methods ========================================================================================================
|
||||
|
||||
public void afterPropertiesSet() throws Exception {
|
||||
checkState();
|
||||
}
|
||||
|
||||
private void checkState() {
|
||||
if (parent == null && providers.isEmpty()) {
|
||||
throw new IllegalArgumentException("A parent AuthenticationManager or a list " +
|
||||
"of AuthenticationProviders is required");
|
||||
|
@ -91,6 +91,8 @@ public class ExceptionTranslationFilter extends GenericFilterBean {
|
||||
}
|
||||
|
||||
public ExceptionTranslationFilter(AuthenticationEntryPoint authenticationEntryPoint, RequestCache requestCache) {
|
||||
Assert.notNull(authenticationEntryPoint, "authenticationEntryPoint cannot be null");
|
||||
Assert.notNull(requestCache, "requestCache cannot be null");
|
||||
this.authenticationEntryPoint = authenticationEntryPoint;
|
||||
this.requestCache = requestCache;
|
||||
}
|
||||
|
@ -60,13 +60,15 @@ public abstract class AbstractRememberMeServices implements RememberMeServices,
|
||||
private GrantedAuthoritiesMapper authoritiesMapper = new NullAuthoritiesMapper();
|
||||
|
||||
/**
|
||||
* @deprecated Use cosntructor injection
|
||||
* @deprecated Use constructor injection
|
||||
*/
|
||||
@Deprecated
|
||||
protected AbstractRememberMeServices() {
|
||||
}
|
||||
|
||||
protected AbstractRememberMeServices(String key, UserDetailsService userDetailsService) {
|
||||
Assert.hasLength(key, "key cannot be empty or null");
|
||||
Assert.notNull(userDetailsService, "UserDetailsService cannot be null");
|
||||
this.key = key;
|
||||
this.userDetailsService = userDetailsService;
|
||||
}
|
||||
|
@ -9,6 +9,7 @@ import javax.servlet.ServletResponse;
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
|
||||
import org.springframework.util.Assert;
|
||||
import org.springframework.web.filter.GenericFilterBean;
|
||||
|
||||
/**
|
||||
@ -31,6 +32,7 @@ public class RequestCacheAwareFilter extends GenericFilterBean {
|
||||
}
|
||||
|
||||
public RequestCacheAwareFilter(RequestCache requestCache) {
|
||||
Assert.notNull(requestCache, "requestCache cannot be null");
|
||||
this.requestCache = requestCache;
|
||||
}
|
||||
|
||||
|
@ -52,6 +52,8 @@ public class SessionManagementFilter extends GenericFilterBean {
|
||||
}
|
||||
|
||||
public SessionManagementFilter(SecurityContextRepository securityContextRepository, SessionAuthenticationStrategy sessionStrategy) {
|
||||
Assert.notNull(securityContextRepository, "SecurityContextRepository cannot be null");
|
||||
Assert.notNull(sessionStrategy, "SessionAuthenticationStrategy cannot be null");
|
||||
this.securityContextRepository = securityContextRepository;
|
||||
this.sessionStrategy = sessionStrategy;
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user