Add constructors to facilitate constructor-based injection for required/shared bean properties.
This commit is contained in:
@@ -50,6 +50,13 @@ public abstract class AbstractAccessDecisionManager implements AccessDecisionMan
|
||||
|
||||
private boolean allowIfAllAbstainDecisions = false;
|
||||
|
||||
protected AbstractAccessDecisionManager() {
|
||||
}
|
||||
|
||||
protected AbstractAccessDecisionManager(List<AccessDecisionVoter> decisionVoters) {
|
||||
this.decisionVoters = decisionVoters;
|
||||
}
|
||||
|
||||
//~ Methods ========================================================================================================
|
||||
|
||||
public void afterPropertiesSet() throws Exception {
|
||||
@@ -76,6 +83,10 @@ public abstract class AbstractAccessDecisionManager implements AccessDecisionMan
|
||||
this.allowIfAllAbstainDecisions = allowIfAllAbstainDecisions;
|
||||
}
|
||||
|
||||
/**
|
||||
* @deprecated Use constructor
|
||||
*/
|
||||
@Deprecated
|
||||
public void setDecisionVoters(List<AccessDecisionVoter> newList) {
|
||||
Assert.notEmpty(newList);
|
||||
|
||||
|
||||
@@ -15,7 +15,7 @@
|
||||
|
||||
package org.springframework.security.access.vote;
|
||||
|
||||
import java.util.Collection;
|
||||
import java.util.*;
|
||||
|
||||
import org.springframework.security.access.AccessDecisionVoter;
|
||||
import org.springframework.security.access.AccessDeniedException;
|
||||
@@ -28,6 +28,18 @@ import org.springframework.security.core.Authentication;
|
||||
* <code>AccessDecisionVoter</code> returns an affirmative response.
|
||||
*/
|
||||
public class AffirmativeBased extends AbstractAccessDecisionManager {
|
||||
|
||||
/**
|
||||
* @deprecated Use constructor which takes voter list
|
||||
*/
|
||||
@Deprecated
|
||||
public AffirmativeBased() {
|
||||
}
|
||||
|
||||
public AffirmativeBased(List<AccessDecisionVoter> decisionVoters) {
|
||||
super(decisionVoters);
|
||||
}
|
||||
|
||||
//~ Methods ========================================================================================================
|
||||
|
||||
/**
|
||||
|
||||
@@ -15,7 +15,7 @@
|
||||
|
||||
package org.springframework.security.access.vote;
|
||||
|
||||
import java.util.Collection;
|
||||
import java.util.*;
|
||||
|
||||
import org.springframework.security.access.AccessDecisionVoter;
|
||||
import org.springframework.security.access.AccessDeniedException;
|
||||
@@ -34,6 +34,17 @@ public class ConsensusBased extends AbstractAccessDecisionManager {
|
||||
|
||||
private boolean allowIfEqualGrantedDeniedDecisions = true;
|
||||
|
||||
/**
|
||||
* @deprecated Use constructor which takes voter list
|
||||
*/
|
||||
@Deprecated
|
||||
public ConsensusBased() {
|
||||
}
|
||||
|
||||
public ConsensusBased(List<AccessDecisionVoter> decisionVoters) {
|
||||
super(decisionVoters);
|
||||
}
|
||||
|
||||
//~ Methods ========================================================================================================
|
||||
|
||||
/**
|
||||
|
||||
@@ -30,6 +30,18 @@ import org.springframework.security.core.Authentication;
|
||||
* voters to abstain or grant access.
|
||||
*/
|
||||
public class UnanimousBased extends AbstractAccessDecisionManager {
|
||||
|
||||
/**
|
||||
* @deprecated Use constructor which takes voter list
|
||||
*/
|
||||
@Deprecated
|
||||
public UnanimousBased() {
|
||||
}
|
||||
|
||||
public UnanimousBased(List<AccessDecisionVoter> decisionVoters) {
|
||||
super(decisionVoters);
|
||||
}
|
||||
|
||||
//~ Methods ========================================================================================================
|
||||
|
||||
/**
|
||||
|
||||
@@ -40,11 +40,22 @@ public class AnonymousAuthenticationProvider implements AuthenticationProvider,
|
||||
protected MessageSourceAccessor messages = SpringSecurityMessageSource.getAccessor();
|
||||
private String key;
|
||||
|
||||
/**
|
||||
*
|
||||
* @deprecated Use constructor injection
|
||||
*/
|
||||
@Deprecated
|
||||
public AnonymousAuthenticationProvider() {
|
||||
}
|
||||
|
||||
public AnonymousAuthenticationProvider(String key) {
|
||||
this.key = key;
|
||||
}
|
||||
|
||||
//~ Methods ========================================================================================================
|
||||
|
||||
public void afterPropertiesSet() throws Exception {
|
||||
Assert.hasLength(key, "A Key is required");
|
||||
Assert.notNull(this.messages, "A message source must be set");
|
||||
}
|
||||
|
||||
public Authentication authenticate(Authentication authentication)
|
||||
@@ -65,11 +76,17 @@ public class AnonymousAuthenticationProvider implements AuthenticationProvider,
|
||||
return key;
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @deprecated Use constructor injection
|
||||
*/
|
||||
@Deprecated
|
||||
public void setKey(String key) {
|
||||
this.key = key;
|
||||
}
|
||||
|
||||
public void setMessageSource(MessageSource messageSource) {
|
||||
Assert.notNull(messageSource, "messageSource cannot be null");
|
||||
this.messages = new MessageSourceAccessor(messageSource);
|
||||
}
|
||||
|
||||
|
||||
@@ -88,6 +88,22 @@ public class ProviderManager implements AuthenticationManager, MessageSourceAwar
|
||||
private boolean eraseCredentialsAfterAuthentication = true;
|
||||
private boolean clearExtraInformation = false;
|
||||
|
||||
/**
|
||||
* @deprecated Use constructor which takes provider list
|
||||
*/
|
||||
@Deprecated
|
||||
public ProviderManager() {
|
||||
}
|
||||
|
||||
public ProviderManager(List<AuthenticationProvider> providers) {
|
||||
this(providers, null);
|
||||
}
|
||||
|
||||
public ProviderManager(List<AuthenticationProvider> providers, AuthenticationManager parent) {
|
||||
this.providers = providers;
|
||||
this.parent = parent;
|
||||
}
|
||||
|
||||
//~ Methods ========================================================================================================
|
||||
|
||||
public void afterPropertiesSet() throws Exception {
|
||||
@@ -212,6 +228,10 @@ public class ProviderManager implements AuthenticationManager, MessageSourceAwar
|
||||
this.messages = new MessageSourceAccessor(messageSource);
|
||||
}
|
||||
|
||||
/**
|
||||
* @deprecated Use constructor injection
|
||||
*/
|
||||
@Deprecated
|
||||
public void setParent(AuthenticationManager parent) {
|
||||
this.parent = parent;
|
||||
}
|
||||
@@ -244,7 +264,9 @@ public class ProviderManager implements AuthenticationManager, MessageSourceAwar
|
||||
*
|
||||
* @throws IllegalArgumentException if the list is empty or null, or any of the elements in the list is not an
|
||||
* AuthenticationProvider instance.
|
||||
* @deprecated Use constructor injection
|
||||
*/
|
||||
@Deprecated
|
||||
@SuppressWarnings("unchecked")
|
||||
public void setProviders(List providers) {
|
||||
Assert.notNull(providers, "Providers list cannot be null");
|
||||
|
||||
@@ -37,6 +37,17 @@ public class RememberMeAuthenticationProvider implements AuthenticationProvider,
|
||||
protected MessageSourceAccessor messages = SpringSecurityMessageSource.getAccessor();
|
||||
private String key;
|
||||
|
||||
/**
|
||||
* @deprecated Use constructor injection
|
||||
*/
|
||||
@Deprecated
|
||||
public RememberMeAuthenticationProvider() {
|
||||
}
|
||||
|
||||
public RememberMeAuthenticationProvider(String key) {
|
||||
this.key = key;
|
||||
}
|
||||
|
||||
//~ Methods ========================================================================================================
|
||||
|
||||
public void afterPropertiesSet() throws Exception {
|
||||
@@ -61,6 +72,11 @@ public class RememberMeAuthenticationProvider implements AuthenticationProvider,
|
||||
return key;
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @deprecated Use constructor injection
|
||||
*/
|
||||
@Deprecated
|
||||
public void setKey(String key) {
|
||||
this.key = key;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user