Skip to content

Commit 30c5788

Browse files
author
Rob Winch
committed
SEC-1897: Remove raw types from AbstractAccessDecisionManager
1 parent 1cca72e commit 30c5788

File tree

14 files changed

+28
-34
lines changed

14 files changed

+28
-34
lines changed

aspects/src/test/java/org/springframework/security/access/intercept/aspectj/aspect/AnnotationSecurityAspectTests.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ public final void setUp() throws Exception {
5656
adm = new AffirmativeBased();
5757
AccessDecisionVoter[] voters = new AccessDecisionVoter[]
5858
{new RoleVoter(), new PreInvocationAuthorizationAdviceVoter(new ExpressionBasedPreInvocationAdvice())};
59-
adm.setDecisionVoters(Arrays.asList(voters));
59+
adm.setDecisionVoters(Arrays.<AccessDecisionVoter<? extends Object>>asList(voters));
6060
interceptor.setAccessDecisionManager(adm);
6161
interceptor.setAuthenticationManager(authman);
6262
interceptor.setSecurityMetadataSource(new SecuredAnnotationSecurityMetadataSource());

config/src/main/java/org/springframework/security/config/annotation/method/configuration/GlobalMethodSecurityConfiguration.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -173,7 +173,7 @@ protected RunAsManager runAsManager() {
173173
*/
174174
@SuppressWarnings("rawtypes")
175175
protected AccessDecisionManager accessDecisionManager() {
176-
List<AccessDecisionVoter> decisionVoters = new ArrayList<AccessDecisionVoter>();
176+
List<AccessDecisionVoter<? extends Object>> decisionVoters = new ArrayList<AccessDecisionVoter<? extends Object>>();
177177
ExpressionBasedPreInvocationAdvice expressionAdvice = new ExpressionBasedPreInvocationAdvice();
178178
expressionAdvice.setExpressionHandler(getExpressionHandler());
179179
if(prePostEnabled()) {

config/src/main/java/org/springframework/security/config/annotation/web/configurers/AbstractInterceptUrlConfigurer.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -103,7 +103,7 @@ public void configure(H http) throws Exception {
103103
* default {@link AccessDecisionManager}
104104
*/
105105
@SuppressWarnings("rawtypes")
106-
abstract List<AccessDecisionVoter> getDecisionVoters(H http);
106+
abstract List<AccessDecisionVoter<? extends Object>> getDecisionVoters(H http);
107107

108108
abstract class AbstractInterceptUrlRegistry<R extends AbstractInterceptUrlRegistry<R,T>,T> extends AbstractConfigAttributeRequestMatcherRegistry<T> {
109109

config/src/main/java/org/springframework/security/config/annotation/web/configurers/ExpressionUrlAuthorizationConfigurer.java

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -141,8 +141,8 @@ private void interceptUrl(Iterable<? extends RequestMatcher> requestMatchers, Co
141141

142142
@Override
143143
@SuppressWarnings("rawtypes")
144-
final List<AccessDecisionVoter> getDecisionVoters(H http) {
145-
List<AccessDecisionVoter> decisionVoters = new ArrayList<AccessDecisionVoter>();
144+
final List<AccessDecisionVoter<? extends Object>> getDecisionVoters(H http) {
145+
List<AccessDecisionVoter<? extends Object>> decisionVoters = new ArrayList<AccessDecisionVoter<? extends Object>>();
146146
WebExpressionVoter expressionVoter = new WebExpressionVoter();
147147
expressionVoter.setExpressionHandler(getExpressionHandler(http));
148148
decisionVoters.add(expressionVoter);
@@ -213,8 +213,6 @@ private AuthorizedUrl(List<RequestMatcher> requestMatchers) {
213213
/**
214214
* Negates the following expression.
215215
*
216-
* @param role the role to require (i.e. USER, ADMIN, etc). Note, it should not start with "ROLE_" as
217-
* this is automatically inserted.
218216
* @return the {@link ExpressionUrlAuthorizationConfigurer} for further customization
219217
*/
220218
public AuthorizedUrl not() {

config/src/main/java/org/springframework/security/config/annotation/web/configurers/UrlAuthorizationConfigurer.java

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -81,14 +81,12 @@
8181
*
8282
* <ul>
8383
* <li>
84-
* {@link org.springframework.security.config.annotation.web.builders.HttpSecurity#getAuthenticationManager()}
84+
* AuthenticationManager
8585
* </li>
8686
* </ul>
8787
*
8888
* @param <H>
8989
* the type of {@link HttpSecurityBuilder} that is being configured
90-
* @param <C>
91-
* the type of object that is being chained
9290
*
9391
* @author Rob Winch
9492
* @since 3.2
@@ -144,15 +142,14 @@ public H and() {
144142

145143
/**
146144
* Creates the default {@link AccessDecisionVoter} instances used if an
147-
* {@link AccessDecisionManager} was not specified using
148-
* {@link #accessDecisionManager(AccessDecisionManager)}.
145+
* {@link AccessDecisionManager} was not specified.
149146
*
150147
* @param http the builder to use
151148
*/
152149
@Override
153150
@SuppressWarnings("rawtypes")
154-
final List<AccessDecisionVoter> getDecisionVoters(H http) {
155-
List<AccessDecisionVoter> decisionVoters = new ArrayList<AccessDecisionVoter>();
151+
final List<AccessDecisionVoter<? extends Object>> getDecisionVoters(H http) {
152+
List<AccessDecisionVoter<? extends Object>> decisionVoters = new ArrayList<AccessDecisionVoter<? extends Object>>();
156153
decisionVoters.add(new RoleVoter());
157154
decisionVoters.add(new AuthenticatedVoter());
158155
return decisionVoters;
@@ -236,7 +233,6 @@ public final class AuthorizedUrl {
236233
/**
237234
* Creates a new instance
238235
* @param requestMatchers the {@link RequestMatcher} instances to map to some {@link ConfigAttribute} instances.
239-
* @see UrlAuthorizationConfigurer#chainRequestMatchers(List)
240236
*/
241237
private AuthorizedUrl(List<RequestMatcher> requestMatchers) {
242238
Assert.notEmpty(requestMatchers, "requestMatchers must contain at least one value");

config/src/main/java/org/springframework/security/config/annotation/web/socket/AbstractSecurityWebSocketMessageBrokerConfigurer.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,7 @@ public final void configureClientInboundChannel(ChannelRegistration registration
8181
@Bean
8282
public ChannelSecurityInterceptor inboundChannelSecurity() {
8383
ChannelSecurityInterceptor channelSecurityInterceptor = new ChannelSecurityInterceptor(inboundMessageSecurityMetadataSource());
84-
List<AccessDecisionVoter> voters = new ArrayList<AccessDecisionVoter>();
84+
List<AccessDecisionVoter<? extends Object>> voters = new ArrayList<AccessDecisionVoter<? extends Object>>();
8585
voters.add(new MessageExpressionVoter());
8686
AffirmativeBased manager = new AffirmativeBased(voters);
8787
channelSecurityInterceptor.setAccessDecisionManager(manager);

config/src/test/groovy/org/springframework/security/config/annotation/web/configurers/ExpressionUrlAuthorizationConfigurerConfigs.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ static class AllPropertiesWorkConfig extends WebSecurityConfigurerAdapter {
5555
protected void configure(HttpSecurity http) throws Exception {
5656
SecurityExpressionHandler<FilterInvocation> handler = new DefaultWebSecurityExpressionHandler();
5757
WebExpressionVoter expressionVoter = new WebExpressionVoter();
58-
AffirmativeBased adm = new AffirmativeBased(Arrays.<AccessDecisionVoter>asList(expressionVoter));
58+
AffirmativeBased adm = new AffirmativeBased(Arrays.<AccessDecisionVoter<? extends Object>>asList(expressionVoter));
5959
http
6060
.authorizeRequests()
6161
.expressionHandler(handler)

core/src/main/java/org/springframework/security/access/vote/AbstractAccessDecisionManager.java

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ public abstract class AbstractAccessDecisionManager implements AccessDecisionMan
4444
//~ Instance fields ================================================================================================
4545
protected final Log logger = LogFactory.getLog(getClass());
4646

47-
private List<AccessDecisionVoter> decisionVoters;
47+
private List<AccessDecisionVoter<? extends Object>> decisionVoters;
4848

4949
protected MessageSourceAccessor messages = SpringSecurityMessageSource.getAccessor();
5050

@@ -53,7 +53,7 @@ public abstract class AbstractAccessDecisionManager implements AccessDecisionMan
5353
protected AbstractAccessDecisionManager() {
5454
}
5555

56-
protected AbstractAccessDecisionManager(List<AccessDecisionVoter> decisionVoters) {
56+
protected AbstractAccessDecisionManager(List<AccessDecisionVoter<? extends Object>> decisionVoters) {
5757
Assert.notEmpty(decisionVoters, "A list of AccessDecisionVoters is required");
5858
this.decisionVoters = decisionVoters;
5959
}
@@ -72,7 +72,7 @@ protected final void checkAllowIfAllAbstainDecisions() {
7272
}
7373
}
7474

75-
public List<AccessDecisionVoter> getDecisionVoters() {
75+
public List<AccessDecisionVoter<? extends Object>> getDecisionVoters() {
7676
return this.decisionVoters;
7777
}
7878

@@ -88,10 +88,10 @@ public void setAllowIfAllAbstainDecisions(boolean allowIfAllAbstainDecisions) {
8888
* @deprecated Use constructor
8989
*/
9090
@Deprecated
91-
public void setDecisionVoters(List<AccessDecisionVoter> newList) {
91+
public void setDecisionVoters(List<AccessDecisionVoter<? extends Object>> newList) {
9292
Assert.notEmpty(newList);
9393

94-
Iterator<AccessDecisionVoter> iter = newList.iterator();
94+
Iterator<AccessDecisionVoter<? extends Object>> iter = newList.iterator();
9595

9696
while (iter.hasNext()) {
9797
Object currentObject = iter.next();

core/src/main/java/org/springframework/security/access/vote/AffirmativeBased.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ public class AffirmativeBased extends AbstractAccessDecisionManager {
3636
public AffirmativeBased() {
3737
}
3838

39-
public AffirmativeBased(List<AccessDecisionVoter> decisionVoters) {
39+
public AffirmativeBased(List<AccessDecisionVoter<? extends Object>> decisionVoters) {
4040
super(decisionVoters);
4141
}
4242

core/src/main/java/org/springframework/security/access/vote/ConsensusBased.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ public class ConsensusBased extends AbstractAccessDecisionManager {
4141
public ConsensusBased() {
4242
}
4343

44-
public ConsensusBased(List<AccessDecisionVoter> decisionVoters) {
44+
public ConsensusBased(List<AccessDecisionVoter<? extends Object>> decisionVoters) {
4545
super(decisionVoters);
4646
}
4747

0 commit comments

Comments
 (0)