Skip to content

Commit b76851f

Browse files
committed
Upgraded Spring Security to 3.1.0
1 parent e261a65 commit b76851f

File tree

7 files changed

+40
-34
lines changed

7 files changed

+40
-34
lines changed

parent/pom.xml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -554,7 +554,7 @@
554554
<dependency>
555555
<groupId>org.springframework.security</groupId>
556556
<artifactId>spring-security-core</artifactId>
557-
<version>3.0.7.RELEASE</version>
557+
<version>3.1.0.RELEASE</version>
558558
<exclusions>
559559
<exclusion>
560560
<groupId>org.springframework</groupId>
@@ -565,7 +565,7 @@
565565
<dependency>
566566
<groupId>org.springframework.security</groupId>
567567
<artifactId>spring-security-core</artifactId>
568-
<version>3.0.7.RELEASE</version>
568+
<version>3.1.0.RELEASE</version>
569569
<classifier>tests</classifier>
570570
<exclusions>
571571
<exclusion>
@@ -577,7 +577,7 @@
577577
<dependency>
578578
<groupId>org.springframework.security</groupId>
579579
<artifactId>spring-security-config</artifactId>
580-
<version>3.0.7.RELEASE</version>
580+
<version>3.1.0.RELEASE</version>
581581
</dependency>
582582
<!-- X.509 dependencies -->
583583
<dependency>

security/src/main/java/org/springframework/ws/soap/security/x509/X509AuthenticationToken.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
/*
2-
* Copyright 2005-2010 the original author or authors.
2+
* Copyright 2005-2012 the original author or authors.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
66
* You may obtain a copy of the License at
77
*
8-
* http://www.apache.org/licenses/LICENSE-2.0
8+
* http://www.apache.org/licenses/LICENSE-2.0
99
*
1010
* Unless required by applicable law or agreed to in writing, software
1111
* distributed under the License is distributed on an "AS IS" BASIS,
@@ -58,7 +58,7 @@ public X509AuthenticationToken(X509Certificate credentials) {
5858
* @param credentials the certificate
5959
* @param authorities the authorities
6060
*/
61-
public X509AuthenticationToken(Object principal, X509Certificate credentials, Collection<GrantedAuthority> authorities) {
61+
public X509AuthenticationToken(Object principal, X509Certificate credentials, Collection<? extends GrantedAuthority> authorities) {
6262
super(authorities);
6363
this.principal = principal;
6464
this.credentials = credentials;

security/src/test/java/org/springframework/ws/soap/security/wss4j/Wss4jMessageInterceptorSpringSecurityCallbackHandlerTestCase.java

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2005-2011 the original author or authors.
2+
* Copyright 2005-2012 the original author or authors.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -22,7 +22,6 @@
2222
import org.springframework.security.authentication.TestingAuthenticationToken;
2323
import org.springframework.security.authentication.UsernamePasswordAuthenticationToken;
2424
import org.springframework.security.core.Authentication;
25-
import org.springframework.security.core.GrantedAuthority;
2625
import org.springframework.security.core.context.SecurityContextHolder;
2726
import org.springframework.security.core.userdetails.memory.InMemoryDaoImpl;
2827
import org.springframework.ws.context.DefaultMessageContext;
@@ -119,7 +118,7 @@ protected EndpointInterceptor prepareInterceptor(String actions, boolean validat
119118
else {
120119
SpringPlainTextPasswordValidationCallbackHandler callbackHandler =
121120
new SpringPlainTextPasswordValidationCallbackHandler();
122-
Authentication authResult = new TestingAuthenticationToken("Bert", "Ernie", new GrantedAuthority[0]);
121+
Authentication authResult = new TestingAuthenticationToken("Bert", "Ernie");
123122
expect(authenticationManager.authenticate(new UsernamePasswordAuthenticationToken("Bert", "Ernie"))).andReturn(authResult);
124123
callbackHandler.setAuthenticationManager(authenticationManager);
125124
callbackHandler.afterPropertiesSet();

security/src/test/java/org/springframework/ws/soap/security/wss4j/callback/SpringDigestPasswordValidationCallbackHandlerTest.java

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
/*
2-
* Copyright 2005-2010 the original author or authors.
2+
* Copyright 2005-2012 the original author or authors.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
66
* You may obtain a copy of the License at
77
*
8-
* http://www.apache.org/licenses/LICENSE-2.0
8+
* http://www.apache.org/licenses/LICENSE-2.0
99
*
1010
* Unless required by applicable law or agreed to in writing, software
1111
* distributed under the License is distributed on an "AS IS" BASIS,
@@ -17,10 +17,11 @@
1717
package org.springframework.ws.soap.security.wss4j.callback;
1818

1919
import java.util.Collection;
20+
import java.util.Collections;
2021

2122
import org.springframework.security.core.Authentication;
2223
import org.springframework.security.core.GrantedAuthority;
23-
import org.springframework.security.core.authority.GrantedAuthorityImpl;
24+
import org.springframework.security.core.authority.SimpleGrantedAuthority;
2425
import org.springframework.security.core.context.SecurityContext;
2526
import org.springframework.security.core.context.SecurityContextHolder;
2627
import org.springframework.security.core.userdetails.User;
@@ -39,7 +40,7 @@ public class SpringDigestPasswordValidationCallbackHandlerTest {
3940

4041
private SpringDigestPasswordValidationCallbackHandler callbackHandler;
4142

42-
private GrantedAuthorityImpl grantedAuthority;
43+
private SimpleGrantedAuthority grantedAuthority;
4344

4445
private UsernameTokenPrincipalCallback callback;
4546

@@ -49,8 +50,8 @@ public class SpringDigestPasswordValidationCallbackHandlerTest {
4950
public void setUp() throws Exception {
5051
callbackHandler = new SpringDigestPasswordValidationCallbackHandler();
5152

52-
grantedAuthority = new GrantedAuthorityImpl("ROLE_1");
53-
user = new User("Ernie", "Bert", true, true, true, true, new GrantedAuthority[]{grantedAuthority});
53+
grantedAuthority = new SimpleGrantedAuthority("ROLE_1");
54+
user = new User("Ernie", "Bert", true, true, true, true, Collections.singleton(grantedAuthority));
5455

5556
WSUsernameTokenPrincipal principal = new WSUsernameTokenPrincipal("Ernie", true);
5657
callback = new UsernameTokenPrincipalCallback(principal);
@@ -70,7 +71,7 @@ public void testHandleUsernameTokenPrincipal() throws Exception {
7071
Assert.assertNotNull("SecurityContext must not be null", context);
7172
Authentication authentication = context.getAuthentication();
7273
Assert.assertNotNull("Authentication must not be null", authentication);
73-
Collection<GrantedAuthority> authorities = authentication.getAuthorities();
74+
Collection<? extends GrantedAuthority> authorities = authentication.getAuthorities();
7475
Assert.assertTrue("GrantedAuthority[] must not be null or empty",
7576
(authorities != null && authorities.size() > 0));
7677
Assert.assertEquals("Unexpected authority", grantedAuthority, authorities.iterator().next());

security/src/test/java/org/springframework/ws/soap/security/xwss/callback/SpringCertificateValidationCallbackHandlerTest.java

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
/*
2-
* Copyright 2005-2010 the original author or authors.
2+
* Copyright 2005-2012 the original author or authors.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
66
* You may obtain a copy of the License at
77
*
8-
* http://www.apache.org/licenses/LICENSE-2.0
8+
* http://www.apache.org/licenses/LICENSE-2.0
99
*
1010
* Unless required by applicable law or agreed to in writing, software
1111
* distributed under the License is distributed on an "AS IS" BASIS,
@@ -19,15 +19,16 @@
1919
import java.io.InputStream;
2020
import java.security.KeyStore;
2121
import java.security.cert.X509Certificate;
22+
import java.util.Collections;
2223

2324
import org.springframework.core.io.ClassPathResource;
2425
import org.springframework.security.authentication.AuthenticationManager;
2526
import org.springframework.security.authentication.BadCredentialsException;
27+
import org.springframework.security.authentication.TestingAuthenticationToken;
2628
import org.springframework.security.core.GrantedAuthority;
2729
import org.springframework.security.core.context.SecurityContextHolder;
28-
import org.springframework.security.authentication.TestingAuthenticationToken;
29-
import org.springframework.ws.soap.security.x509.X509AuthenticationToken;
3030
import org.springframework.ws.soap.security.callback.CleanupCallback;
31+
import org.springframework.ws.soap.security.x509.X509AuthenticationToken;
3132

3233
import com.sun.xml.wss.impl.callback.CertificateValidationCallback;
3334
import org.junit.After;
@@ -75,7 +76,7 @@ public void tearDown() throws Exception {
7576
@Test
7677
public void testValidateCertificateValid() throws Exception {
7778
expect(authenticationManager.authenticate(isA(X509AuthenticationToken.class)))
78-
.andReturn(new TestingAuthenticationToken(certificate, null, new GrantedAuthority[0]));
79+
.andReturn(new TestingAuthenticationToken(certificate, null, Collections.<GrantedAuthority>emptyList()));
7980

8081
replay(authenticationManager);
8182

@@ -105,7 +106,7 @@ public void testValidateCertificateInvalid() throws Exception {
105106
@Test
106107
public void testCleanUp() throws Exception {
107108
TestingAuthenticationToken authentication =
108-
new TestingAuthenticationToken(new Object(), new Object(), new GrantedAuthority[0]);
109+
new TestingAuthenticationToken(new Object(), new Object(), Collections.<GrantedAuthority>emptyList());
109110
SecurityContextHolder.getContext().setAuthentication(authentication);
110111

111112
CleanupCallback cleanupCallback = new CleanupCallback();

security/src/test/java/org/springframework/ws/soap/security/xwss/callback/SpringDigestPasswordValidationCallbackHandlerTest.java

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2005-2011 the original author or authors.
2+
* Copyright 2005-2012 the original author or authors.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -16,6 +16,8 @@
1616

1717
package org.springframework.ws.soap.security.xwss.callback;
1818

19+
import java.util.Collections;
20+
1921
import org.springframework.security.authentication.DisabledException;
2022
import org.springframework.security.authentication.TestingAuthenticationToken;
2123
import org.springframework.security.core.GrantedAuthority;
@@ -81,7 +83,7 @@ public void testAuthenticateUserDigestUserNotFound() throws Exception {
8183

8284
@Test
8385
public void testAuthenticateUserDigestValid() throws Exception {
84-
User user = new User(username, password, true, true, true, true, new GrantedAuthority[0]);
86+
User user = new User(username, password, true, true, true, true, Collections.<GrantedAuthority>emptyList());
8587
expect(userDetailsService.loadUserByUsername(username)).andReturn(user);
8688

8789
replay(userDetailsService);
@@ -96,7 +98,7 @@ public void testAuthenticateUserDigestValid() throws Exception {
9698

9799
@Test
98100
public void testAuthenticateUserDigestValidInvalid() throws Exception {
99-
User user = new User(username, "Big bird", true, true, true, true, new GrantedAuthority[0]);
101+
User user = new User(username, "Big bird", true, true, true, true, Collections.<GrantedAuthority>emptyList());
100102
expect(userDetailsService.loadUserByUsername(username)).andReturn(user);
101103

102104
replay(userDetailsService);
@@ -111,7 +113,7 @@ public void testAuthenticateUserDigestValidInvalid() throws Exception {
111113

112114
@Test
113115
public void testAuthenticateUserDigestDisabled() throws Exception {
114-
User user = new User(username, "Ernie", false, true, true, true, new GrantedAuthority[0]);
116+
User user = new User(username, "Ernie", false, true, true, true, Collections.<GrantedAuthority>emptyList());
115117
expect(userDetailsService.loadUserByUsername(username)).andReturn(user);
116118

117119
replay(userDetailsService);
@@ -128,7 +130,7 @@ public void testAuthenticateUserDigestDisabled() throws Exception {
128130
@Test
129131
public void testCleanUp() throws Exception {
130132
TestingAuthenticationToken authentication =
131-
new TestingAuthenticationToken(new Object(), new Object(), new GrantedAuthority[0]);
133+
new TestingAuthenticationToken(new Object(), new Object(), Collections.<GrantedAuthority>emptyList());
132134
SecurityContextHolder.getContext().setAuthentication(authentication);
133135

134136
CleanupCallback cleanupCallback = new CleanupCallback();

security/src/test/java/org/springframework/ws/soap/security/xwss/callback/SpringPlainTextPasswordValidationCallbackHandlerTest.java

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
/*
2-
* Copyright 2005-2010 the original author or authors.
2+
* Copyright 2005-2012 the original author or authors.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
66
* You may obtain a copy of the License at
77
*
8-
* http://www.apache.org/licenses/LICENSE-2.0
8+
* http://www.apache.org/licenses/LICENSE-2.0
99
*
1010
* Unless required by applicable law or agreed to in writing, software
1111
* distributed under the License is distributed on an "AS IS" BASIS,
@@ -16,13 +16,15 @@
1616

1717
package org.springframework.ws.soap.security.xwss.callback;
1818

19-
import org.springframework.security.core.Authentication;
19+
import java.util.Collections;
20+
2021
import org.springframework.security.authentication.AuthenticationManager;
2122
import org.springframework.security.authentication.BadCredentialsException;
22-
import org.springframework.security.core.GrantedAuthority;
23-
import org.springframework.security.core.context.SecurityContextHolder;
2423
import org.springframework.security.authentication.TestingAuthenticationToken;
2524
import org.springframework.security.authentication.UsernamePasswordAuthenticationToken;
25+
import org.springframework.security.core.Authentication;
26+
import org.springframework.security.core.GrantedAuthority;
27+
import org.springframework.security.core.context.SecurityContextHolder;
2628
import org.springframework.ws.soap.security.callback.CleanupCallback;
2729

2830
import com.sun.xml.wss.impl.callback.PasswordValidationCallback;
@@ -64,7 +66,8 @@ public void tearDown() throws Exception {
6466

6567
@Test
6668
public void testAuthenticateUserPlainTextValid() throws Exception {
67-
Authentication authResult = new TestingAuthenticationToken(username, password, new GrantedAuthority[0]);
69+
Authentication authResult = new TestingAuthenticationToken(username, password, Collections
70+
.<GrantedAuthority>emptyList());
6871
expect(authenticationManager.authenticate(new UsernamePasswordAuthenticationToken(username, password))).andReturn(authResult);
6972

7073
replay(authenticationManager);
@@ -94,7 +97,7 @@ public void testAuthenticateUserPlainTextInvalid() throws Exception {
9497
@Test
9598
public void testCleanUp() throws Exception {
9699
TestingAuthenticationToken authentication =
97-
new TestingAuthenticationToken(new Object(), new Object(), new GrantedAuthority[0]);
100+
new TestingAuthenticationToken(new Object(), new Object(), Collections.<GrantedAuthority>emptyList());
98101
SecurityContextHolder.getContext().setAuthentication(authentication);
99102

100103
CleanupCallback cleanupCallback = new CleanupCallback();

0 commit comments

Comments
 (0)