INT-3702: Compatibility with Spring Security 4.0
JIRA: https://jira.spring.io/browse/INT-3702
This commit is contained in:
committed by
Gary Russell
parent
b81b5ed74a
commit
aa43109009
@@ -126,7 +126,7 @@ subprojects { subproject ->
|
||||
springDataMongoVersion = '1.7.0.RELEASE'
|
||||
springDataRedisVersion = '1.5.0.RELEASE'
|
||||
springGemfireVersion = '1.6.0.RELEASE'
|
||||
springSecurityVersion = '3.2.5.RELEASE'
|
||||
springSecurityVersion = project.hasProperty('springSecurityVersion') ? project.springSecurityVersion : '3.2.7.RELEASE'
|
||||
springSocialTwitterVersion = '1.1.0.RELEASE'
|
||||
springRetryVersion = '1.1.2.RELEASE'
|
||||
springVersion = project.hasProperty('springVersion') ? project.springVersion : '4.2.0.BUILD-SNAPSHOT'
|
||||
|
||||
@@ -17,18 +17,18 @@
|
||||
package org.springframework.integration.security.channel;
|
||||
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
import java.util.regex.Pattern;
|
||||
|
||||
import org.junit.After;
|
||||
import org.junit.Test;
|
||||
|
||||
import org.springframework.aop.framework.ProxyFactory;
|
||||
import org.springframework.messaging.MessageChannel;
|
||||
import org.springframework.integration.channel.QueueChannel;
|
||||
import org.springframework.messaging.support.GenericMessage;
|
||||
import org.springframework.integration.security.MockAuthenticationManager;
|
||||
import org.springframework.integration.security.SecurityTestUtils;
|
||||
import org.springframework.security.access.AccessDecisionVoter;
|
||||
import org.springframework.messaging.MessageChannel;
|
||||
import org.springframework.messaging.support.GenericMessage;
|
||||
import org.springframework.security.access.AccessDeniedException;
|
||||
import org.springframework.security.access.vote.AffirmativeBased;
|
||||
import org.springframework.security.access.vote.RoleVoter;
|
||||
@@ -78,12 +78,13 @@ public class ChannelSecurityInterceptorTests {
|
||||
return (MessageChannel) proxyFactory.getProxy();
|
||||
}
|
||||
|
||||
@SuppressWarnings("rawtypes")
|
||||
private static ChannelSecurityInterceptor createInterceptor(String role) throws Exception {
|
||||
ChannelSecurityMetadataSource securityMetadataSource = new ChannelSecurityMetadataSource();
|
||||
securityMetadataSource.addPatternMapping(Pattern.compile("secured.*"), new DefaultChannelAccessPolicy(role, null));
|
||||
ChannelSecurityInterceptor interceptor = new ChannelSecurityInterceptor(securityMetadataSource);
|
||||
@SuppressWarnings("rawtypes")
|
||||
AffirmativeBased accessDecisionManager = new AffirmativeBased(Collections.<AccessDecisionVoter>singletonList(new RoleVoter()));
|
||||
AffirmativeBased accessDecisionManager = AffirmativeBased.class.getConstructor(List.class)
|
||||
.newInstance(Collections.singletonList(new RoleVoter()));;
|
||||
accessDecisionManager.afterPropertiesSet();
|
||||
interceptor.setAccessDecisionManager(accessDecisionManager);
|
||||
interceptor.setAuthenticationManager(new MockAuthenticationManager(true));
|
||||
|
||||
@@ -10,15 +10,13 @@
|
||||
http://www.springframework.org/schema/context
|
||||
http://www.springframework.org/schema/context/spring-context.xsd">
|
||||
|
||||
<context:annotation-config/>
|
||||
<context:annotation-config/>
|
||||
|
||||
<beans:bean id="accessDecisionManager" class="org.springframework.security.access.vote.AffirmativeBased">
|
||||
<beans:constructor-arg>
|
||||
<beans:bean class="org.springframework.security.access.vote.RoleVoter"/>
|
||||
</beans:constructor-arg>
|
||||
<beans:property name="allowIfAllAbstainDecisions" value="true"/>
|
||||
<beans:property name="decisionVoters">
|
||||
<beans:list>
|
||||
<beans:bean class="org.springframework.security.access.vote.RoleVoter"/>
|
||||
</beans:list>
|
||||
</beans:property>
|
||||
</beans:bean>
|
||||
|
||||
<security:authentication-manager alias="authenticationManager">
|
||||
@@ -30,4 +28,4 @@
|
||||
<security:user name="bob" password="bobspassword" authorities="ROLE_USER"/>
|
||||
</security:user-service>
|
||||
|
||||
</beans:beans>
|
||||
</beans:beans>
|
||||
|
||||
Reference in New Issue
Block a user