diff --git a/acl/src/main/java/org/springframework/security/acls/domain/AclImpl.java b/acl/src/main/java/org/springframework/security/acls/domain/AclImpl.java
index cb597b5ccc..b6f915c0ab 100644
--- a/acl/src/main/java/org/springframework/security/acls/domain/AclImpl.java
+++ b/acl/src/main/java/org/springframework/security/acls/domain/AclImpl.java
@@ -73,16 +73,6 @@ public class AclImpl implements Acl, MutableAcl, AuditableAcl, OwnershipAcl {
this.permissionGrantingStrategy = new DefaultPermissionGrantingStrategy(auditLogger);
}
- /**
- * @deprecated Use the version which takes a {@code PermissionGrantingStrategy} argument instead.
- */
- @Deprecated
- public AclImpl(ObjectIdentity objectIdentity, Serializable id, AclAuthorizationStrategy aclAuthorizationStrategy,
- AuditLogger auditLogger, Acl parentAcl, List loadedSids, boolean entriesInheriting, Sid owner) {
- this(objectIdentity, id, aclAuthorizationStrategy, new DefaultPermissionGrantingStrategy(auditLogger),
- parentAcl, loadedSids, entriesInheriting, owner);
- }
-
/**
* Full constructor, which should be used by persistence tools that do not
* provide field-level access features.
diff --git a/acl/src/main/java/org/springframework/security/acls/domain/EhCacheBasedAclCache.java b/acl/src/main/java/org/springframework/security/acls/domain/EhCacheBasedAclCache.java
index d4362bdc14..64ed55f3a4 100644
--- a/acl/src/main/java/org/springframework/security/acls/domain/EhCacheBasedAclCache.java
+++ b/acl/src/main/java/org/springframework/security/acls/domain/EhCacheBasedAclCache.java
@@ -46,15 +46,6 @@ public class EhCacheBasedAclCache implements AclCache {
//~ Constructors ===================================================================================================
- /**
- * @deprecated use the second constructor which injects the strategy objects. See SEC-1498.
- */
- @Deprecated
- public EhCacheBasedAclCache(Ehcache cache) {
- Assert.notNull(cache, "Cache required");
- this.cache = cache;
- }
-
public EhCacheBasedAclCache(Ehcache cache, PermissionGrantingStrategy permissionGrantingStrategy,
AclAuthorizationStrategy aclAuthorizationStrategy) {
Assert.notNull(cache, "Cache required");
diff --git a/acl/src/main/java/org/springframework/security/acls/jdbc/BasicLookupStrategy.java b/acl/src/main/java/org/springframework/security/acls/jdbc/BasicLookupStrategy.java
index b4abee260b..aaf742cb41 100644
--- a/acl/src/main/java/org/springframework/security/acls/jdbc/BasicLookupStrategy.java
+++ b/acl/src/main/java/org/springframework/security/acls/jdbc/BasicLookupStrategy.java
@@ -131,15 +131,20 @@ public class BasicLookupStrategy implements LookupStrategy {
* @param dataSource to access the database
* @param aclCache the cache where fully-loaded elements can be stored
* @param aclAuthorizationStrategy authorization strategy (required)
- *
- * @deprecated Use the version which takes a {@code PermissionGrantingStrategy} argument instead.
*/
- @Deprecated
public BasicLookupStrategy(DataSource dataSource, AclCache aclCache,
AclAuthorizationStrategy aclAuthorizationStrategy, AuditLogger auditLogger) {
this(dataSource, aclCache, aclAuthorizationStrategy, new DefaultPermissionGrantingStrategy(auditLogger));
}
+ /**
+ * Creates a new instance
+ *
+ * @param dataSource to access the database
+ * @param aclCache the cache where fully-loaded elements can be stored
+ * @param aclAuthorizationStrategy authorization strategy (required)
+ * @param grantingStrategy the PermissionGrantingStrategy
+ */
public BasicLookupStrategy(DataSource dataSource, AclCache aclCache,
AclAuthorizationStrategy aclAuthorizationStrategy, PermissionGrantingStrategy grantingStrategy) {
Assert.notNull(dataSource, "DataSource required");
diff --git a/acl/src/test/java/org/springframework/security/acls/domain/AclImplTests.java b/acl/src/test/java/org/springframework/security/acls/domain/AclImplTests.java
index f2f19bdbea..a3fa1f0976 100644
--- a/acl/src/test/java/org/springframework/security/acls/domain/AclImplTests.java
+++ b/acl/src/test/java/org/springframework/security/acls/domain/AclImplTests.java
@@ -77,7 +77,7 @@ public class AclImplTests {
@Test(expected=IllegalArgumentException.class)
public void constructorsRejectNullAclAuthzStrategy() throws Exception {
try {
- new AclImpl(objectIdentity, 1, null, mockAuditLogger, null, null, true, new PrincipalSid("joe"));
+ new AclImpl(objectIdentity, 1, null, new DefaultPermissionGrantingStrategy(mockAuditLogger), null, null, true, new PrincipalSid("joe"));
fail("It should have thrown IllegalArgumentException");
}
catch (IllegalArgumentException expected) {
diff --git a/acl/src/test/java/org/springframework/security/acls/domain/AclImplementationSecurityCheckTests.java b/acl/src/test/java/org/springframework/security/acls/domain/AclImplementationSecurityCheckTests.java
index 4d64caebfc..4b7b540ac0 100644
--- a/acl/src/test/java/org/springframework/security/acls/domain/AclImplementationSecurityCheckTests.java
+++ b/acl/src/test/java/org/springframework/security/acls/domain/AclImplementationSecurityCheckTests.java
@@ -223,7 +223,6 @@ public class AclImplementationSecurityCheckTests {
}
}
- @SuppressWarnings("deprecation")
@Test
public void testSecurityCheckPrincipalOwner() throws Exception {
Authentication auth = new TestingAuthenticationToken("user", "password", "ROLE_ONE");
@@ -235,7 +234,7 @@ public class AclImplementationSecurityCheckTests {
new SimpleGrantedAuthority("ROLE_OWNERSHIP"), new SimpleGrantedAuthority("ROLE_AUDITING"),
new SimpleGrantedAuthority("ROLE_GENERAL"));
- Acl acl = new AclImpl(identity, 1, aclAuthorizationStrategy, new ConsoleAuditLogger(), null, null,
+ Acl acl = new AclImpl(identity, 1, aclAuthorizationStrategy, new DefaultPermissionGrantingStrategy(new ConsoleAuditLogger()), null, null,
false, new PrincipalSid(auth));
try {
aclAuthorizationStrategy.securityCheck(acl, AclAuthorizationStrategy.CHANGE_GENERAL);
diff --git a/acl/src/test/java/org/springframework/security/acls/jdbc/BasicLookupStrategyTests.java b/acl/src/test/java/org/springframework/security/acls/jdbc/BasicLookupStrategyTests.java
index e74ddb206c..ba7696ec43 100644
--- a/acl/src/test/java/org/springframework/security/acls/jdbc/BasicLookupStrategyTests.java
+++ b/acl/src/test/java/org/springframework/security/acls/jdbc/BasicLookupStrategyTests.java
@@ -84,7 +84,7 @@ public class BasicLookupStrategyTests {
@Before
public void initializeBeans() {
- EhCacheBasedAclCache cache = new EhCacheBasedAclCache(getCache());
+ EhCacheBasedAclCache cache = new EhCacheBasedAclCache(getCache(), new DefaultPermissionGrantingStrategy(new ConsoleAuditLogger()), new AclAuthorizationStrategyImpl(new SimpleGrantedAuthority("ROLE_USER")));
AclAuthorizationStrategy authorizationStrategy = new AclAuthorizationStrategyImpl(new SimpleGrantedAuthority("ROLE_ADMINISTRATOR"));
strategy = new BasicLookupStrategy(dataSource, cache, authorizationStrategy,
new DefaultPermissionGrantingStrategy(new ConsoleAuditLogger()));
diff --git a/acl/src/test/java/org/springframework/security/acls/jdbc/EhCacheBasedAclCacheTests.java b/acl/src/test/java/org/springframework/security/acls/jdbc/EhCacheBasedAclCacheTests.java
index f22cff583a..4fe908b61a 100644
--- a/acl/src/test/java/org/springframework/security/acls/jdbc/EhCacheBasedAclCacheTests.java
+++ b/acl/src/test/java/org/springframework/security/acls/jdbc/EhCacheBasedAclCacheTests.java
@@ -29,16 +29,12 @@ import org.mockito.ArgumentCaptor;
import org.mockito.Captor;
import org.mockito.Mock;
import org.mockito.runners.MockitoJUnitRunner;
-import org.springframework.security.acls.domain.AclAuthorizationStrategy;
-import org.springframework.security.acls.domain.AclAuthorizationStrategyImpl;
-import org.springframework.security.acls.domain.AclImpl;
-import org.springframework.security.acls.domain.ConsoleAuditLogger;
-import org.springframework.security.acls.domain.EhCacheBasedAclCache;
-import org.springframework.security.acls.domain.ObjectIdentityImpl;
+import org.springframework.security.acls.domain.*;
import org.springframework.security.acls.model.MutableAcl;
import org.springframework.security.acls.model.ObjectIdentity;
import org.springframework.security.authentication.TestingAuthenticationToken;
import org.springframework.security.core.Authentication;
+import org.springframework.security.core.authority.AuthorityUtils;
import org.springframework.security.core.authority.SimpleGrantedAuthority;
import org.springframework.security.core.context.SecurityContextHolder;
import org.springframework.security.util.FieldUtils;
@@ -65,7 +61,7 @@ public class EhCacheBasedAclCacheTests {
@Before
public void setup() {
- myCache = new EhCacheBasedAclCache(cache);
+ myCache = new EhCacheBasedAclCache(cache, new DefaultPermissionGrantingStrategy(new ConsoleAuditLogger()), new AclAuthorizationStrategyImpl(new SimpleGrantedAuthority("ROLE_USER")));
ObjectIdentity identity = new ObjectIdentityImpl(TARGET_CLASS, Long.valueOf(100));
AclAuthorizationStrategy aclAuthorizationStrategy = new AclAuthorizationStrategyImpl(
@@ -82,7 +78,7 @@ public class EhCacheBasedAclCacheTests {
@Test(expected=IllegalArgumentException.class)
public void constructorRejectsNullParameters() throws Exception {
- new EhCacheBasedAclCache(null);
+ new EhCacheBasedAclCache(null, new DefaultPermissionGrantingStrategy(new ConsoleAuditLogger()), new AclAuthorizationStrategyImpl(new SimpleGrantedAuthority("ROLE_USER")));
}
@Test
diff --git a/acl/src/test/resources/jdbcMutableAclServiceTests-context.xml b/acl/src/test/resources/jdbcMutableAclServiceTests-context.xml
index 9a79d18f8b..e8e0d8b49b 100644
--- a/acl/src/test/resources/jdbcMutableAclServiceTests-context.xml
+++ b/acl/src/test/resources/jdbcMutableAclServiceTests-context.xml
@@ -22,6 +22,25 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/aspects/src/test/java/org/springframework/security/access/intercept/aspectj/aspect/AnnotationSecurityAspectTests.java b/aspects/src/test/java/org/springframework/security/access/intercept/aspectj/aspect/AnnotationSecurityAspectTests.java
index bfee144194..552e1c48dc 100644
--- a/aspects/src/test/java/org/springframework/security/access/intercept/aspectj/aspect/AnnotationSecurityAspectTests.java
+++ b/aspects/src/test/java/org/springframework/security/access/intercept/aspectj/aspect/AnnotationSecurityAspectTests.java
@@ -53,10 +53,9 @@ public class AnnotationSecurityAspectTests {
public final void setUp() throws Exception {
MockitoAnnotations.initMocks(this);
interceptor = new AspectJMethodSecurityInterceptor();
- adm = new AffirmativeBased();
AccessDecisionVoter[] voters = new AccessDecisionVoter[]
{new RoleVoter(), new PreInvocationAuthorizationAdviceVoter(new ExpressionBasedPreInvocationAdvice())};
- adm.setDecisionVoters(Arrays.>asList(voters));
+ adm = new AffirmativeBased(Arrays.>asList(voters));
interceptor.setAccessDecisionManager(adm);
interceptor.setAuthenticationManager(authman);
interceptor.setSecurityMetadataSource(new SecuredAnnotationSecurityMetadataSource());
diff --git a/cas/src/main/java/org/springframework/security/cas/authentication/CasAuthenticationProvider.java b/cas/src/main/java/org/springframework/security/cas/authentication/CasAuthenticationProvider.java
index b35199c582..b166fc582e 100644
--- a/cas/src/main/java/org/springframework/security/cas/authentication/CasAuthenticationProvider.java
+++ b/cas/src/main/java/org/springframework/security/cas/authentication/CasAuthenticationProvider.java
@@ -185,15 +185,15 @@ public class CasAuthenticationProvider implements AuthenticationProvider, Initia
return this.authenticationUserDetailsService.loadUserDetails(token);
}
- @Deprecated
@SuppressWarnings("unchecked")
/**
- * @deprecated as of 3.0. Use the {@link org.springframework.security.cas.authentication.CasAuthenticationProvider#setAuthenticationUserDetailsService(org.springframework.security.core.userdetails.AuthenticationUserDetailsService)} instead.
+ * Sets the UserDetailsService to use. This is a convenience method to invoke
*/
public void setUserDetailsService(final UserDetailsService userDetailsService) {
this.authenticationUserDetailsService = new UserDetailsByNameServiceWrapper(userDetailsService);
}
+
public void setAuthenticationUserDetailsService(final AuthenticationUserDetailsService authenticationUserDetailsService) {
this.authenticationUserDetailsService = authenticationUserDetailsService;
}
diff --git a/cas/src/main/java/org/springframework/security/cas/web/CasAuthenticationEntryPoint.java b/cas/src/main/java/org/springframework/security/cas/web/CasAuthenticationEntryPoint.java
index a06b73dfad..1e56f9346d 100644
--- a/cas/src/main/java/org/springframework/security/cas/web/CasAuthenticationEntryPoint.java
+++ b/cas/src/main/java/org/springframework/security/cas/web/CasAuthenticationEntryPoint.java
@@ -55,9 +55,7 @@ public class CasAuthenticationEntryPoint implements AuthenticationEntryPoint, In
* disable the session encoding is provided for backwards compatibility.
*
* By default, encoding is enabled.
- * @deprecated since 3.0.0 because CAS is currently on 3.3.5.
*/
- @Deprecated
private boolean encodeServiceUrlWithSessionId = true;
//~ Methods ========================================================================================================
@@ -135,9 +133,7 @@ public class CasAuthenticationEntryPoint implements AuthenticationEntryPoint, In
* Sets whether to encode the service url with the session id or not.
*
* @param encodeServiceUrlWithSessionId whether to encode the service url with the session id or not.
- * @deprecated since 3.0.0 because CAS is currently on 3.3.5.
*/
- @Deprecated
public final void setEncodeServiceUrlWithSessionId(final boolean encodeServiceUrlWithSessionId) {
this.encodeServiceUrlWithSessionId = encodeServiceUrlWithSessionId;
}
@@ -146,9 +142,7 @@ public class CasAuthenticationEntryPoint implements AuthenticationEntryPoint, In
* Sets whether to encode the service url with the session id or not.
* @return whether to encode the service url with the session id or not.
*
- * @deprecated since 3.0.0 because CAS is currently on 3.3.5.
*/
- @Deprecated
protected boolean getEncodeServiceUrlWithSessionId() {
return this.encodeServiceUrlWithSessionId;
}
diff --git a/cas/src/main/java/org/springframework/security/cas/web/CasAuthenticationFilter.java b/cas/src/main/java/org/springframework/security/cas/web/CasAuthenticationFilter.java
index ed2e53126d..a954e8f252 100644
--- a/cas/src/main/java/org/springframework/security/cas/web/CasAuthenticationFilter.java
+++ b/cas/src/main/java/org/springframework/security/cas/web/CasAuthenticationFilter.java
@@ -38,6 +38,8 @@ import org.springframework.security.core.context.SecurityContextHolder;
import org.springframework.security.web.authentication.AbstractAuthenticationProcessingFilter;
import org.springframework.security.web.authentication.AuthenticationFailureHandler;
import org.springframework.security.web.authentication.SimpleUrlAuthenticationFailureHandler;
+import org.springframework.security.web.util.matcher.AntPathRequestMatcher;
+import org.springframework.security.web.util.matcher.RequestMatcher;
import org.springframework.util.Assert;
/**
@@ -170,7 +172,7 @@ public class CasAuthenticationFilter extends AbstractAuthenticationProcessingFil
/**
* The last portion of the receptor url, i.e. /proxy/receptor
*/
- private String proxyReceptorUrl;
+ private RequestMatcher proxyReceptorMatcher;
/**
* The backing storage to store ProxyGrantingTicket requests.
@@ -254,7 +256,6 @@ public class CasAuthenticationFilter extends AbstractAuthenticationProcessingFil
/**
* Overridden to provide proxying capabilities.
*/
- @Override
protected boolean requiresAuthentication(final HttpServletRequest request, final HttpServletResponse response) {
final boolean serviceTicketRequest = serviceTicketRequest(request, response);
final boolean result = serviceTicketRequest || proxyReceptorRequest(request) || (proxyTicketRequest(serviceTicketRequest, request));
@@ -286,7 +287,7 @@ public class CasAuthenticationFilter extends AbstractAuthenticationProcessingFil
}
public final void setProxyReceptorUrl(final String proxyReceptorUrl) {
- this.proxyReceptorUrl = proxyReceptorUrl;
+ this.proxyReceptorMatcher = new AntPathRequestMatcher("/**" + proxyReceptorUrl);
}
public final void setProxyGrantingTicketStorage(
@@ -343,8 +344,7 @@ public class CasAuthenticationFilter extends AbstractAuthenticationProcessingFil
* @return
*/
private boolean proxyReceptorRequest(final HttpServletRequest request) {
- final String requestUri = request.getRequestURI();
- final boolean result = proxyReceptorConfigured() && requestUri.endsWith(this.proxyReceptorUrl);
+ final boolean result = proxyReceptorConfigured() && proxyReceptorMatcher.matches(request);
if(logger.isDebugEnabled()) {
logger.debug("proxyReceptorRequest = "+result);
}
@@ -357,7 +357,7 @@ public class CasAuthenticationFilter extends AbstractAuthenticationProcessingFil
* @return
*/
private boolean proxyReceptorConfigured() {
- final boolean result = this.proxyGrantingTicketStorage != null && !CommonUtils.isEmpty(this.proxyReceptorUrl);
+ final boolean result = this.proxyGrantingTicketStorage != null && proxyReceptorMatcher != null;
if(logger.isDebugEnabled()) {
logger.debug("proxyReceptorConfigured = "+result);
}
diff --git a/cas/src/main/java/org/springframework/security/cas/web/authentication/ServiceAuthenticationDetailsSource.java b/cas/src/main/java/org/springframework/security/cas/web/authentication/ServiceAuthenticationDetailsSource.java
index d144a34b49..813dab91fb 100644
--- a/cas/src/main/java/org/springframework/security/cas/web/authentication/ServiceAuthenticationDetailsSource.java
+++ b/cas/src/main/java/org/springframework/security/cas/web/authentication/ServiceAuthenticationDetailsSource.java
@@ -20,10 +20,6 @@ import java.util.regex.Pattern;
import javax.servlet.http.HttpServletRequest;
-import org.springframework.beans.BeansException;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.context.ApplicationContext;
-import org.springframework.context.ApplicationContextAware;
import org.springframework.security.authentication.AuthenticationDetailsSource;
import org.springframework.security.cas.ServiceProperties;
import org.springframework.util.Assert;
@@ -39,7 +35,7 @@ import org.springframework.util.Assert;
* @author Rob Winch
*/
public class ServiceAuthenticationDetailsSource implements AuthenticationDetailsSource, ApplicationContextAware {
+ ServiceAuthenticationDetails> {
//~ Instance fields ================================================================================================
private final Pattern artifactPattern;
@@ -48,15 +44,6 @@ public class ServiceAuthenticationDetailsSource implements AuthenticationDetails
//~ Constructors ===================================================================================================
- /**
- * Creates an implementation that uses the default CAS artifactParameterName.
- * @deprecated Use ServiceAuthenticationDetailsSource(ServiceProperties)
- */
- @Deprecated
- public ServiceAuthenticationDetailsSource() {
- this(ServiceProperties.DEFAULT_CAS_ARTIFACT_PARAMETER);
- }
-
/**
* Creates an implementation that uses the specified ServiceProperites and the default CAS artifactParameterName.
*
@@ -66,19 +53,6 @@ public class ServiceAuthenticationDetailsSource implements AuthenticationDetails
this(serviceProperties,ServiceProperties.DEFAULT_CAS_ARTIFACT_PARAMETER);
}
- /**
- * Creates an implementation that uses the specified artifactParameterName
- *
- * @param artifactParameterName
- * the artifactParameterName that is removed from the current
- * URL. The result becomes the service url. Cannot be null and
- * cannot be an empty String.
- * @deprecated Use ServiceAuthenticationDetailsSource(ServiceProperties,String)
- */
- public ServiceAuthenticationDetailsSource(final String artifactParameterName) {
- this.artifactPattern = DefaultServiceAuthenticationDetails.createArtifactPattern(artifactParameterName);
- }
-
/**
* Creates an implementation that uses the specified artifactParameterName
*
@@ -107,10 +81,4 @@ public class ServiceAuthenticationDetailsSource implements AuthenticationDetails
throw new RuntimeException(e);
}
}
-
- public void setApplicationContext(ApplicationContext applicationContext) throws BeansException {
- if(serviceProperties == null) {
- serviceProperties = applicationContext.getBean(ServiceProperties.class);
- }
- }
}
\ No newline at end of file
diff --git a/cas/src/test/java/org/springframework/security/cas/web/CasAuthenticationFilterTests.java b/cas/src/test/java/org/springframework/security/cas/web/CasAuthenticationFilterTests.java
index f5967b33c9..60c29e9827 100644
--- a/cas/src/test/java/org/springframework/security/cas/web/CasAuthenticationFilterTests.java
+++ b/cas/src/test/java/org/springframework/security/cas/web/CasAuthenticationFilterTests.java
@@ -63,7 +63,6 @@ public class CasAuthenticationFilterTests {
@Test
public void testGettersSetters() {
CasAuthenticationFilter filter = new CasAuthenticationFilter();
- assertEquals("/j_spring_cas_security_check", filter.getFilterProcessesUrl());
filter.setProxyGrantingTicketStorage(mock(ProxyGrantingTicketStorage.class));
filter.setProxyReceptorUrl("/someurl");
filter.setServiceProperties(new ServiceProperties());
@@ -71,7 +70,8 @@ public class CasAuthenticationFilterTests {
@Test
public void testNormalOperation() throws Exception {
- MockHttpServletRequest request = new MockHttpServletRequest("GET", "/j_spring_cas_security_check");
+ MockHttpServletRequest request = new MockHttpServletRequest();
+ request.setServletPath("/j_spring_cas_security_check");
request.addParameter("ticket", "ST-0-ER94xMJmn6pha35CQRoZ");
CasAuthenticationFilter filter = new CasAuthenticationFilter();
@@ -101,11 +101,13 @@ public class CasAuthenticationFilterTests {
@Test
public void testRequiresAuthenticationFilterProcessUrl() {
+ String url = "/login/cas";
CasAuthenticationFilter filter = new CasAuthenticationFilter();
+ filter.setFilterProcessesUrl(url);
MockHttpServletRequest request = new MockHttpServletRequest();
MockHttpServletResponse response = new MockHttpServletResponse();
- request.setRequestURI(filter.getFilterProcessesUrl());
+ request.setServletPath(url);
assertTrue(filter.requiresAuthentication(request, response));
}
@@ -115,13 +117,13 @@ public class CasAuthenticationFilterTests {
MockHttpServletRequest request = new MockHttpServletRequest();
MockHttpServletResponse response = new MockHttpServletResponse();
- request.setRequestURI("/pgtCallback");
+ request.setServletPath("/pgtCallback");
assertFalse(filter.requiresAuthentication(request, response));
- filter.setProxyReceptorUrl(request.getRequestURI());
+ filter.setProxyReceptorUrl(request.getServletPath());
assertFalse(filter.requiresAuthentication(request, response));
filter.setProxyGrantingTicketStorage(mock(ProxyGrantingTicketStorage.class));
assertTrue(filter.requiresAuthentication(request, response));
- request.setRequestURI("/other");
+ request.setServletPath("/other");
assertFalse(filter.requiresAuthentication(request, response));
}
@@ -130,15 +132,17 @@ public class CasAuthenticationFilterTests {
ServiceProperties properties = new ServiceProperties();
properties.setAuthenticateAllArtifacts(true);
+ String url = "/login/cas";
CasAuthenticationFilter filter = new CasAuthenticationFilter();
+ filter.setFilterProcessesUrl(url);
filter.setServiceProperties(properties);
MockHttpServletRequest request = new MockHttpServletRequest();
MockHttpServletResponse response = new MockHttpServletResponse();
- request.setRequestURI(filter.getFilterProcessesUrl());
+ request.setServletPath(url);
assertTrue(filter.requiresAuthentication(request, response));
- request.setRequestURI("/other");
+ request.setServletPath("/other");
assertFalse(filter.requiresAuthentication(request, response));
request.setParameter(properties.getArtifactParameter(), "value");
assertTrue(filter.requiresAuthentication(request, response));
@@ -156,9 +160,9 @@ public class CasAuthenticationFilterTests {
MockHttpServletRequest request = new MockHttpServletRequest();
MockHttpServletResponse response = new MockHttpServletResponse();
- request.setRequestURI("/pgtCallback");
+ request.setServletPath("/pgtCallback");
filter.setProxyGrantingTicketStorage(mock(ProxyGrantingTicketStorage.class));
- filter.setProxyReceptorUrl(request.getRequestURI());
+ filter.setProxyReceptorUrl(request.getServletPath());
assertNull(filter.attemptAuthentication(request, response));
}
@@ -172,7 +176,7 @@ public class CasAuthenticationFilterTests {
serviceProperties.setAuthenticateAllArtifacts(true);
MockHttpServletRequest request = new MockHttpServletRequest();
request.setParameter("ticket", "ST-1-123");
- request.setRequestURI("/authenticate");
+ request.setServletPath("/authenticate");
MockHttpServletResponse response = new MockHttpServletResponse();
FilterChain chain = mock(FilterChain.class);
@@ -189,7 +193,7 @@ public class CasAuthenticationFilterTests {
verifyZeroInteractions(successHandler);
// validate for when the filterProcessUrl matches
- filter.setFilterProcessesUrl(request.getRequestURI());
+ filter.setFilterProcessesUrl(request.getServletPath());
SecurityContextHolder.clearContext();
filter.doFilter(request,response,chain);
verifyNoMoreInteractions(chain);
@@ -204,9 +208,9 @@ public class CasAuthenticationFilterTests {
MockHttpServletResponse response = new MockHttpServletResponse();
FilterChain chain = mock(FilterChain.class);
- request.setRequestURI("/pgtCallback");
+ request.setServletPath("/pgtCallback");
filter.setProxyGrantingTicketStorage(mock(ProxyGrantingTicketStorage.class));
- filter.setProxyReceptorUrl(request.getRequestURI());
+ filter.setProxyReceptorUrl(request.getServletPath());
filter.doFilter(request,response,chain);
verifyZeroInteractions(chain);
diff --git a/cas/src/test/java/org/springframework/security/cas/web/authentication/DefaultServiceAuthenticationDetailsTests.java b/cas/src/test/java/org/springframework/security/cas/web/authentication/DefaultServiceAuthenticationDetailsTests.java
index f8d5d648e3..2243c50956 100644
--- a/cas/src/test/java/org/springframework/security/cas/web/authentication/DefaultServiceAuthenticationDetailsTests.java
+++ b/cas/src/test/java/org/springframework/security/cas/web/authentication/DefaultServiceAuthenticationDetailsTests.java
@@ -115,14 +115,6 @@ public class DefaultServiceAuthenticationDetailsTests {
assertEquals("https://example.com/cas-sample/secure/",details.getServiceUrl());
}
- @Test
- public void getServiceUrlDoesNotUseHostHeaderPassivity() {
- casServiceUrl = "https://example.com/j_spring_security_cas";
- request.setServerName("evil.com");
- ServiceAuthenticationDetails details = loadServiceAuthenticationDetails("defaultserviceauthenticationdetails-passivity.xml");
- assertEquals("https://example.com/cas-sample/secure/", details.getServiceUrl());
- }
-
@Test
public void getServiceUrlDoesNotUseHostHeaderExplicit() {
casServiceUrl = "https://example.com/j_spring_security_cas";
diff --git a/config/src/main/java/org/springframework/security/config/Elements.java b/config/src/main/java/org/springframework/security/config/Elements.java
index 7cd1216c16..99ee4fd199 100644
--- a/config/src/main/java/org/springframework/security/config/Elements.java
+++ b/config/src/main/java/org/springframework/security/config/Elements.java
@@ -49,8 +49,6 @@ public abstract class Elements {
public static final String JEE = "jee";
public static final String FILTER_SECURITY_METADATA_SOURCE = "filter-security-metadata-source";
public static final String METHOD_SECURITY_METADATA_SOURCE = "method-security-metadata-source";
- @Deprecated
- public static final String FILTER_INVOCATION_DEFINITION_SOURCE = "filter-invocation-definition-source";
public static final String LDAP_PASSWORD_COMPARE = "password-compare";
public static final String DEBUG = "debug";
public static final String HTTP_FIREWALL = "http-firewall";
diff --git a/config/src/main/java/org/springframework/security/config/SecurityNamespaceHandler.java b/config/src/main/java/org/springframework/security/config/SecurityNamespaceHandler.java
index e3e24ceecf..a409339c79 100644
--- a/config/src/main/java/org/springframework/security/config/SecurityNamespaceHandler.java
+++ b/config/src/main/java/org/springframework/security/config/SecurityNamespaceHandler.java
@@ -173,7 +173,6 @@ public final class SecurityNamespaceHandler implements NamespaceHandler {
parsers.put(Elements.DEBUG, new DebugBeanDefinitionParser());
parsers.put(Elements.HTTP, new HttpSecurityBeanDefinitionParser());
parsers.put(Elements.HTTP_FIREWALL, new HttpFirewallBeanDefinitionParser());
- parsers.put(Elements.FILTER_INVOCATION_DEFINITION_SOURCE, new FilterInvocationSecurityMetadataSourceParser());
parsers.put(Elements.FILTER_SECURITY_METADATA_SOURCE, new FilterInvocationSecurityMetadataSourceParser());
parsers.put(Elements.FILTER_CHAIN, new FilterChainBeanDefinitionParser());
filterChainMapBDD = new FilterChainMapBeanDefinitionDecorator();
diff --git a/config/src/main/java/org/springframework/security/config/authentication/AuthenticationManagerBeanDefinitionParser.java b/config/src/main/java/org/springframework/security/config/authentication/AuthenticationManagerBeanDefinitionParser.java
index e576cf4c27..2ed8017cc0 100644
--- a/config/src/main/java/org/springframework/security/config/authentication/AuthenticationManagerBeanDefinitionParser.java
+++ b/config/src/main/java/org/springframework/security/config/authentication/AuthenticationManagerBeanDefinitionParser.java
@@ -52,7 +52,6 @@ public class AuthenticationManagerBeanDefinitionParser implements BeanDefinition
String alias = element.getAttribute(ATT_ALIAS);
- checkForDeprecatedSessionControllerRef(element, pc);
List providers = new ManagedList();
NamespaceHandlerResolver resolver = pc.getReaderContext().getNamespaceHandlerResolver();
@@ -113,16 +112,6 @@ public class AuthenticationManagerBeanDefinitionParser implements BeanDefinition
return null;
}
- private void checkForDeprecatedSessionControllerRef(Element element, ParserContext pc) {
- final String ATT_SESSION_CONTROLLER_REF = "session-controller-ref";
-
- if (StringUtils.hasText(element.getAttribute(ATT_SESSION_CONTROLLER_REF))) {
- pc.getReaderContext().warning(ATT_SESSION_CONTROLLER_REF + " is not supported in Spring Security " +
- " 3.0 and will be ignored. Use the attribute on the element instead.",
- pc.extractSource(element));
- }
- }
-
/**
* Provider which doesn't provide any service. Only used to prevent a configuration exception if the provider list
* is empty (usually because a child ProviderManager from the <http> namespace, such as OpenID, is expected
diff --git a/config/src/main/java/org/springframework/security/config/http/AuthenticationConfigBuilder.java b/config/src/main/java/org/springframework/security/config/http/AuthenticationConfigBuilder.java
index bbd74b6669..ff1d665836 100644
--- a/config/src/main/java/org/springframework/security/config/http/AuthenticationConfigBuilder.java
+++ b/config/src/main/java/org/springframework/security/config/http/AuthenticationConfigBuilder.java
@@ -84,7 +84,6 @@ final class AuthenticationConfigBuilder {
private static final String ATT_AUTO_CONFIG = "auto-config";
- private static final String ATT_ACCESS_DENIED_PAGE = "access-denied-page";
private static final String ATT_ACCESS_DENIED_ERROR_PAGE = "error-page";
private static final String ATT_ENTRY_POINT_REF = "entry-point-ref";
@@ -587,20 +586,9 @@ final class AuthenticationConfigBuilder {
}
private BeanMetadataElement createAccessDeniedHandler(Element element, ParserContext pc) {
- String accessDeniedPage = element.getAttribute(ATT_ACCESS_DENIED_PAGE);
- WebConfigUtils.validateHttpRedirect(accessDeniedPage, pc, pc.extractSource(element));
Element accessDeniedElt = DomUtils.getChildElementByTagName(element, Elements.ACCESS_DENIED_HANDLER);
BeanDefinitionBuilder accessDeniedHandler = BeanDefinitionBuilder.rootBeanDefinition(AccessDeniedHandlerImpl.class);
- if (StringUtils.hasText(accessDeniedPage)) {
- if (accessDeniedElt != null) {
- pc.getReaderContext().error("The attribute " + ATT_ACCESS_DENIED_PAGE +
- " cannot be used with <" + Elements.ACCESS_DENIED_HANDLER + ">", pc.extractSource(accessDeniedElt));
- }
-
- accessDeniedHandler.addPropertyValue("errorPage", accessDeniedPage);
- }
-
if (accessDeniedElt != null) {
String errorPage = accessDeniedElt.getAttribute("error-page");
String ref = accessDeniedElt.getAttribute("ref");
diff --git a/config/src/main/java/org/springframework/security/config/http/FilterChainMapBeanDefinitionDecorator.java b/config/src/main/java/org/springframework/security/config/http/FilterChainMapBeanDefinitionDecorator.java
index 7d8696509f..e186660285 100644
--- a/config/src/main/java/org/springframework/security/config/http/FilterChainMapBeanDefinitionDecorator.java
+++ b/config/src/main/java/org/springframework/security/config/http/FilterChainMapBeanDefinitionDecorator.java
@@ -5,14 +5,17 @@ import java.util.LinkedHashMap;
import java.util.List;
import java.util.Map;
+import org.springframework.beans.BeanMetadataElement;
import org.springframework.beans.factory.config.BeanDefinition;
import org.springframework.beans.factory.config.BeanDefinitionHolder;
import org.springframework.beans.factory.config.RuntimeBeanReference;
+import org.springframework.beans.factory.support.BeanDefinitionBuilder;
import org.springframework.beans.factory.support.ManagedList;
import org.springframework.beans.factory.support.ManagedMap;
import org.springframework.beans.factory.xml.BeanDefinitionDecorator;
import org.springframework.beans.factory.xml.ParserContext;
import org.springframework.security.config.Elements;
+import org.springframework.security.web.DefaultSecurityFilterChain;
import org.springframework.util.StringUtils;
import org.springframework.util.xml.DomUtils;
import org.w3c.dom.Element;
@@ -29,7 +32,7 @@ public class FilterChainMapBeanDefinitionDecorator implements BeanDefinitionDeco
public BeanDefinitionHolder decorate(Node node, BeanDefinitionHolder holder, ParserContext parserContext) {
BeanDefinition filterChainProxy = holder.getBeanDefinition();
- Map filterChainMap = new LinkedHashMap();
+ ManagedList securityFilterChains = new ManagedList();
Element elt = (Element)node;
MatcherType matcherType = MatcherType.fromElement(elt);
@@ -53,7 +56,7 @@ public class FilterChainMapBeanDefinitionDecorator implements BeanDefinitionDeco
BeanDefinition matcher = matcherType.createMatcher(path, null);
if (filters.equals(HttpSecurityBeanDefinitionParser.OPT_FILTERS_NONE)) {
- filterChainMap.put(matcher, Collections.EMPTY_LIST);
+ securityFilterChains.add(createSecurityFilterChain(matcher, new ManagedList(0)));
} else {
String[] filterBeanNames = StringUtils.tokenizeToStringArray(filters, ",");
ManagedList filterChain = new ManagedList(filterBeanNames.length);
@@ -62,15 +65,19 @@ public class FilterChainMapBeanDefinitionDecorator implements BeanDefinitionDeco
filterChain.add(new RuntimeBeanReference(name));
}
- filterChainMap.put(matcher, filterChain);
+ securityFilterChains.add(createSecurityFilterChain(matcher, filterChain));
}
}
- ManagedMap map = new ManagedMap(filterChainMap.size());
- map.putAll(filterChainMap);
-
- filterChainProxy.getPropertyValues().addPropertyValue("filterChainMap", map);
+ filterChainProxy.getConstructorArgumentValues().addGenericArgumentValue(securityFilterChains);
return holder;
}
+
+ private BeanDefinition createSecurityFilterChain(BeanDefinition matcher, ManagedList> filters) {
+ BeanDefinitionBuilder sfc = BeanDefinitionBuilder.rootBeanDefinition(DefaultSecurityFilterChain.class);
+ sfc.addConstructorArgValue(matcher);
+ sfc.addConstructorArgValue(filters);
+ return sfc.getBeanDefinition();
+ }
}
diff --git a/config/src/main/java/org/springframework/security/config/http/FilterInvocationSecurityMetadataSourceParser.java b/config/src/main/java/org/springframework/security/config/http/FilterInvocationSecurityMetadataSourceParser.java
index 3dc5c27f3d..d81ab4a41b 100644
--- a/config/src/main/java/org/springframework/security/config/http/FilterInvocationSecurityMetadataSourceParser.java
+++ b/config/src/main/java/org/springframework/security/config/http/FilterInvocationSecurityMetadataSourceParser.java
@@ -128,14 +128,15 @@ public class FilterInvocationSecurityMetadataSourceParser implements BeanDefinit
BeanDefinition matcher = matcherType.createMatcher(path, method);
BeanDefinitionBuilder attributeBuilder = BeanDefinitionBuilder.rootBeanDefinition(SecurityConfig.class);
- attributeBuilder.addConstructorArgValue(access);
if (useExpressions) {
logger.info("Creating access control expression attribute '" + access + "' for " + path);
// The single expression will be parsed later by the ExpressionFilterInvocationSecurityMetadataSource
- attributeBuilder.setFactoryMethod("createSingleAttributeList");
+ attributeBuilder.addConstructorArgValue(new String[] { access });
+ attributeBuilder.setFactoryMethod("createList");
} else {
+ attributeBuilder.addConstructorArgValue(access);
attributeBuilder.setFactoryMethod("createListFromCommaDelimitedString");
}
diff --git a/config/src/main/java/org/springframework/security/config/http/FormLoginBeanDefinitionParser.java b/config/src/main/java/org/springframework/security/config/http/FormLoginBeanDefinitionParser.java
index 216f79a207..42f9e3e9a4 100644
--- a/config/src/main/java/org/springframework/security/config/http/FormLoginBeanDefinitionParser.java
+++ b/config/src/main/java/org/springframework/security/config/http/FormLoginBeanDefinitionParser.java
@@ -151,7 +151,7 @@ public class FormLoginBeanDefinitionParser {
this.loginProcessingUrl = loginUrl;
- BeanDefinitionBuilder matcherBuilder = BeanDefinitionBuilder.rootBeanDefinition("org.springframework.security.web.authentication.logout.LogoutFilter$FilterProcessUrlRequestMatcher");
+ BeanDefinitionBuilder matcherBuilder = BeanDefinitionBuilder.rootBeanDefinition("org.springframework.security.web.util.matcher.AntPathRequestMatcher");
matcherBuilder.addConstructorArgValue(loginUrl);
filterBuilder.addPropertyValue("requiresAuthenticationRequestMatcher", matcherBuilder.getBeanDefinition());
diff --git a/config/src/main/java/org/springframework/security/config/http/LogoutBeanDefinitionParser.java b/config/src/main/java/org/springframework/security/config/http/LogoutBeanDefinitionParser.java
index eb11751686..aa1c8c1a66 100644
--- a/config/src/main/java/org/springframework/security/config/http/LogoutBeanDefinitionParser.java
+++ b/config/src/main/java/org/springframework/security/config/http/LogoutBeanDefinitionParser.java
@@ -119,16 +119,13 @@ class LogoutBeanDefinitionParser implements BeanDefinitionParser {
}
private BeanDefinition getLogoutRequestMatcher(String logoutUrl) {
+ BeanDefinitionBuilder matcherBuilder = BeanDefinitionBuilder.rootBeanDefinition("org.springframework.security.web.util.matcher.AntPathRequestMatcher");
+ matcherBuilder.addConstructorArgValue(logoutUrl);
if(this.csrfEnabled) {
- BeanDefinitionBuilder matcherBuilder = BeanDefinitionBuilder.rootBeanDefinition("org.springframework.security.web.util.matcher.AntPathRequestMatcher");
- matcherBuilder.addConstructorArgValue(logoutUrl);
matcherBuilder.addConstructorArgValue("POST");
- return matcherBuilder.getBeanDefinition();
- } else {
- BeanDefinitionBuilder matcherBuilder = BeanDefinitionBuilder.rootBeanDefinition("org.springframework.security.web.authentication.AbstractAuthenticationProcessingFilter$FilterProcessUrlRequestMatcher");
- matcherBuilder.addConstructorArgValue(logoutUrl);
- return matcherBuilder.getBeanDefinition();
}
+
+ return matcherBuilder.getBeanDefinition();
}
ManagedList getLogoutHandlers() {
diff --git a/config/src/main/java/org/springframework/security/config/http/MatcherType.java b/config/src/main/java/org/springframework/security/config/http/MatcherType.java
index a115dc602a..e20162bf69 100644
--- a/config/src/main/java/org/springframework/security/config/http/MatcherType.java
+++ b/config/src/main/java/org/springframework/security/config/http/MatcherType.java
@@ -1,7 +1,5 @@
package org.springframework.security.config.http;
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
import org.springframework.beans.factory.config.BeanDefinition;
import org.springframework.beans.factory.support.BeanDefinitionBuilder;
import org.springframework.beans.factory.support.RootBeanDefinition;
@@ -23,10 +21,7 @@ public enum MatcherType {
regex (RegexRequestMatcher.class),
ciRegex (RegexRequestMatcher.class);
- private static final Log logger = LogFactory.getLog(MatcherType.class);
-
private static final String ATT_MATCHER_TYPE = "request-matcher";
- private static final String ATT_PATH_TYPE = "path-type";
private final Class extends RequestMatcher> type;
@@ -56,11 +51,6 @@ public enum MatcherType {
return valueOf(elt.getAttribute(ATT_MATCHER_TYPE));
}
- if (StringUtils.hasText(elt.getAttribute(ATT_PATH_TYPE))) {
- logger.warn("'" + ATT_PATH_TYPE + "' is deprecated. Please use '" + ATT_MATCHER_TYPE +"' instead.");
- return valueOf(elt.getAttribute(ATT_PATH_TYPE));
- }
-
return ant;
}
}
diff --git a/config/src/main/java/org/springframework/security/config/message/MessageSecurityBeanDefinitionParser.java b/config/src/main/java/org/springframework/security/config/message/MessageSecurityBeanDefinitionParser.java
index 6ab0a2c23a..cd946b815b 100644
--- a/config/src/main/java/org/springframework/security/config/message/MessageSecurityBeanDefinitionParser.java
+++ b/config/src/main/java/org/springframework/security/config/message/MessageSecurityBeanDefinitionParser.java
@@ -137,7 +137,7 @@ public final class MessageSecurityBeanDefinitionParser implements BeanDefinition
static class MessageSecurityPostProcessor implements BeanDefinitionRegistryPostProcessor {
private static final String CLIENT_INBOUND_CHANNEL_BEAN_ID = "clientInboundChannel";
-
+
private static final String INTERCEPTORS_PROP = "interceptors";
private static final String CUSTOM_ARG_RESOLVERS_PROP = "customArgumentResolvers";
@@ -148,7 +148,6 @@ public final class MessageSecurityBeanDefinitionParser implements BeanDefinition
this.inboundSecurityInterceptorId = inboundSecurityInterceptorId;
}
- @Override
public void postProcessBeanDefinitionRegistry(BeanDefinitionRegistry registry) throws BeansException {
String[] beanNames = registry.getBeanDefinitionNames();
for(String beanName : beanNames) {
@@ -181,7 +180,6 @@ public final class MessageSecurityBeanDefinitionParser implements BeanDefinition
inboundChannel.getPropertyValues().add(INTERCEPTORS_PROP, interceptors);
}
- @Override
public void postProcessBeanFactory(ConfigurableListableBeanFactory beanFactory) throws BeansException {
}
diff --git a/config/src/main/resources/org/springframework/security/config/spring-security-4.0.rnc b/config/src/main/resources/org/springframework/security/config/spring-security-4.0.rnc
index 22a3ccb25e..572d8e8266 100644
--- a/config/src/main/resources/org/springframework/security/config/spring-security-4.0.rnc
+++ b/config/src/main/resources/org/springframework/security/config/spring-security-4.0.rnc
@@ -12,11 +12,8 @@ base64 =
## Whether a string should be base64 encoded
attribute base64 {xsd:boolean}
request-matcher =
- ## Supersedes the 'path-type' attribute. Defines the strategy use for matching incoming requests. Currently the options are 'ant' (for ant path patterns), 'regex' for regular expressions and 'ciRegex' for case-insensitive regular expressions.
+ ## Defines the strategy use for matching incoming requests. Currently the options are 'ant' (for ant path patterns), 'regex' for regular expressions and 'ciRegex' for case-insensitive regular expressions.
attribute request-matcher {"ant" | "regex" | "ciRegex"}
-path-type =
- ## Deprecated. Use request-matcher instead.
- attribute path-type {"ant" | "regex"}
port =
## Specifies an IP port number. Used to configure an embedded LDAP server, for example.
attribute port { xsd:positiveInteger }
@@ -323,9 +320,6 @@ http.attlist &=
attribute security-context-repository-ref {xsd:token}?
http.attlist &=
request-matcher?
-http.attlist &=
- ## Deprecated. Use request-matcher instead.
- path-type?
http.attlist &=
## Provides versions of HttpServletRequest security methods such as isUserInRole() and getPrincipal() which are implemented by accessing the Spring SecurityContext. Defaults to "true".
attribute servlet-api-provision {xsd:boolean}?
@@ -344,9 +338,6 @@ http.attlist &=
http.attlist &=
## Corresponds to the observeOncePerRequest property of FilterSecurityInterceptor. Defaults to "true"
attribute once-per-request {xsd:boolean}?
-http.attlist &=
- ## Deprecated in favour of the access-denied-handler element.
- attribute access-denied-page {xsd:token}?
http.attlist &=
## Prevents the jsessionid parameter from being added to rendered URLs.
attribute disable-url-rewriting {xsd:boolean}?
@@ -476,9 +467,6 @@ openid-attribute.attlist &=
filter-chain-map =
## Used to explicitly configure a FilterChainProxy instance with a FilterChainMap
element filter-chain-map {filter-chain-map.attlist, filter-chain+}
-filter-chain-map.attlist &=
- ## Deprecated. Use request-matcher instead.
- path-type?
filter-chain-map.attlist &=
request-matcher?
@@ -508,16 +496,9 @@ fsmds.attlist &=
fsmds.attlist &=
## Compare after forcing to lowercase
attribute lowercase-comparisons {xsd:boolean}?
-fsmds.attlist &=
- ## Deprecate. Use request-matcher instead.
- path-type?
fsmds.attlist &=
request-matcher?
-filter-invocation-definition-source =
- ## Deprecated synonym for filter-security-metadata-source
- element filter-invocation-definition-source {fsmds.attlist, intercept-url+}
-
http-basic =
## Adds support for basic authentication
element http-basic {http-basic.attlist, empty}
diff --git a/config/src/main/resources/org/springframework/security/config/spring-security-4.0.xsd b/config/src/main/resources/org/springframework/security/config/spring-security-4.0.xsd
index 1e7b23d94a..1c9fd007f5 100644
--- a/config/src/main/resources/org/springframework/security/config/spring-security-4.0.xsd
+++ b/config/src/main/resources/org/springframework/security/config/spring-security-4.0.xsd
@@ -34,9 +34,9 @@
- Supersedes the 'path-type' attribute. Defines the strategy use for matching incoming
- requests. Currently the options are 'ant' (for ant path patterns), 'regex' for regular
- expressions and 'ciRegex' for case-insensitive regular expressions.
+ Defines the strategy use for matching incoming requests. Currently the options are 'ant'
+ (for ant path patterns), 'regex' for regular expressions and 'ciRegex' for
+ case-insensitive regular expressions.
@@ -48,20 +48,6 @@
-
-
-
- Deprecated. Use request-matcher instead.
-
-
-
-
-
-
-
-
-
-
@@ -1160,9 +1146,9 @@
- Supersedes the 'path-type' attribute. Defines the strategy use for matching incoming
- requests. Currently the options are 'ant' (for ant path patterns), 'regex' for regular
- expressions and 'ciRegex' for case-insensitive regular expressions.
+ Defines the strategy use for matching incoming requests. Currently the options are 'ant'
+ (for ant path patterns), 'regex' for regular expressions and 'ciRegex' for
+ case-insensitive regular expressions.
@@ -1173,18 +1159,6 @@
-
-
- Deprecated. Use request-matcher instead.
-
-
-
-
-
-
-
-
- Provides versions of HttpServletRequest security methods such as isUserInRole() and
@@ -1228,12 +1202,6 @@
-
-
- Deprecated in favour of the access-denied-handler element.
-
-
- Prevents the jsessionid parameter from being added to rendered URLs.
@@ -1534,23 +1502,11 @@
-
-
- Deprecated. Use request-matcher instead.
-
-
-
-
-
-
-
-
-
- Supersedes the 'path-type' attribute. Defines the strategy use for matching incoming
- requests. Currently the options are 'ant' (for ant path patterns), 'regex' for regular
- expressions and 'ciRegex' for case-insensitive regular expressions.
+ Defines the strategy use for matching incoming requests. Currently the options are 'ant'
+ (for ant path patterns), 'regex' for regular expressions and 'ciRegex' for
+ case-insensitive regular expressions.
@@ -1657,23 +1613,11 @@
-
-
- Deprecated. Use request-matcher instead.
-
-
-
-
-
-
-
-
-
- Supersedes the 'path-type' attribute. Defines the strategy use for matching incoming
- requests. Currently the options are 'ant' (for ant path patterns), 'regex' for regular
- expressions and 'ciRegex' for case-insensitive regular expressions.
+ Defines the strategy use for matching incoming requests. Currently the options are 'ant'
+ (for ant path patterns), 'regex' for regular expressions and 'ciRegex' for
+ case-insensitive regular expressions.
@@ -1685,26 +1629,6 @@
-
-
- Deprecated synonym for filter-security-metadata-source
-
-
-
-
-
-
- Specifies the access attributes and/or filter list for a particular set of URLs.
-
-
-
-
-
-
-
-
-
-
diff --git a/config/src/test/groovy/org/springframework/security/config/annotation/web/builders/NamespaceHttpTests.groovy b/config/src/test/groovy/org/springframework/security/config/annotation/web/builders/NamespaceHttpTests.groovy
index a20ad1a92c..1cd0c9a58c 100644
--- a/config/src/test/groovy/org/springframework/security/config/annotation/web/builders/NamespaceHttpTests.groovy
+++ b/config/src/test/groovy/org/springframework/security/config/annotation/web/builders/NamespaceHttpTests.groovy
@@ -326,10 +326,6 @@ public class NamespaceHttpTests extends BaseSpringSpec {
}
}
- // http@path-type is not available (instead request matcher instances are used)
-
- // http@pattern is not available (instead see the tests http@request-matcher-ref ant or http@request-matcher-ref regex)
-
def "http@realm"() {
setup:
loadConfig(RealmConfig)
diff --git a/config/src/test/groovy/org/springframework/security/config/annotation/web/configuration/WebSecurityConfigurationTests.groovy b/config/src/test/groovy/org/springframework/security/config/annotation/web/configuration/WebSecurityConfigurationTests.groovy
index cb38183da9..dbf34ff547 100644
--- a/config/src/test/groovy/org/springframework/security/config/annotation/web/configuration/WebSecurityConfigurationTests.groovy
+++ b/config/src/test/groovy/org/springframework/security/config/annotation/web/configuration/WebSecurityConfigurationTests.groovy
@@ -38,7 +38,6 @@ import org.springframework.security.web.SecurityFilterChain
import org.springframework.security.web.access.DefaultWebInvocationPrivilegeEvaluator
import org.springframework.security.web.access.WebInvocationPrivilegeEvaluator
import org.springframework.security.web.access.expression.DefaultWebSecurityExpressionHandler
-import org.springframework.security.web.access.expression.WebSecurityExpressionHandler
import org.springframework.security.web.util.matcher.AnyRequestMatcher
import org.springframework.test.util.ReflectionTestUtils
@@ -200,21 +199,20 @@ class WebSecurityConfigurationTests extends BaseSpringSpec {
def "Override webSecurityExpressionHandler"() {
setup:
- WebSecurityExpressionHandler expressionHandler = Mock()
+ SecurityExpressionHandler expressionHandler = Mock()
ExpressionParser parser = Mock()
WebSecurityExpressionHandlerConfig.EH = expressionHandler
when:
loadConfig(WebSecurityExpressionHandlerConfig)
then:
- context.getBean(WebSecurityExpressionHandler) == expressionHandler
+ context.getBean(SecurityExpressionHandler) == expressionHandler
1 * expressionHandler.getExpressionParser() >> parser
}
@EnableWebSecurity
@Configuration
static class WebSecurityExpressionHandlerConfig extends WebSecurityConfigurerAdapter {
- @SuppressWarnings("deprecation")
- static WebSecurityExpressionHandler EH
+ static SecurityExpressionHandler EH
@Override
public void configure(WebSecurity web) throws Exception {
@@ -234,7 +232,7 @@ class WebSecurityConfigurationTests extends BaseSpringSpec {
when:
loadConfig(WebSecurityExpressionHandlerDefaultsConfig)
then:
- WebSecurityExpressionHandler wseh = context.getBean(WebSecurityExpressionHandler)
+ SecurityExpressionHandler wseh = context.getBean(SecurityExpressionHandler)
wseh instanceof DefaultWebSecurityExpressionHandler
}
diff --git a/config/src/test/groovy/org/springframework/security/config/http/AccessDeniedConfigTests.groovy b/config/src/test/groovy/org/springframework/security/config/http/AccessDeniedConfigTests.groovy
index 7ad7beeef9..33d0e5b27b 100644
--- a/config/src/test/groovy/org/springframework/security/config/http/AccessDeniedConfigTests.groovy
+++ b/config/src/test/groovy/org/springframework/security/config/http/AccessDeniedConfigTests.groovy
@@ -10,20 +10,11 @@ import org.springframework.security.web.access.ExceptionTranslationFilter
* @author Luke Taylor
*/
class AccessDeniedConfigTests extends AbstractHttpConfigTests {
- private static final String ACCESS_DENIED_PAGE = 'access-denied-page';
-
- def accessDeniedPageAttributeIsSupported() {
- httpAccessDeniedPage ('/accessDenied') { }
- createAppContext();
-
- expect:
- getFilter(ExceptionTranslationFilter.class).accessDeniedHandler.errorPage == '/accessDenied'
-
- }
-
def invalidAccessDeniedUrlIsDetected() {
when:
- httpAccessDeniedPage ('noLeadingSlash') { }
+ httpAutoConfig() {
+ 'access-denied-handler'('error-page':'noLeadingSlash')
+ }
createAppContext();
then:
thrown(BeanCreationException)
@@ -43,16 +34,6 @@ class AccessDeniedConfigTests extends AbstractHttpConfigTests {
filter.accessDeniedHandler == adh
}
- def void accessDeniedPageAndAccessDeniedHandlerAreMutuallyExclusive() {
- when:
- httpAccessDeniedPage ('/accessDenied') {
- 'access-denied-handler'('error-page': '/go-away')
- }
- createAppContext();
- then:
- thrown(BeanDefinitionParsingException)
- }
-
def void accessDeniedHandlerPageAndRefAreMutuallyExclusive() {
when:
httpAutoConfig {
@@ -63,8 +44,4 @@ class AccessDeniedConfigTests extends AbstractHttpConfigTests {
then:
thrown(BeanDefinitionParsingException)
}
-
- def httpAccessDeniedPage(String page, Closure c) {
- xml.http(['auto-config': 'true', 'access-denied-page': page], c)
- }
}
diff --git a/config/src/test/groovy/org/springframework/security/config/http/CsrfConfigTests.groovy b/config/src/test/groovy/org/springframework/security/config/http/CsrfConfigTests.groovy
index d2081733ea..2d03eb42cc 100644
--- a/config/src/test/groovy/org/springframework/security/config/http/CsrfConfigTests.groovy
+++ b/config/src/test/groovy/org/springframework/security/config/http/CsrfConfigTests.groovy
@@ -156,7 +156,7 @@ class CsrfConfigTests extends AbstractHttpConfigTests {
when: "authenticate successfully"
response = new MockHttpServletResponse()
request = new MockHttpServletRequest(session: request.session)
- request.requestURI = "/j_spring_security_check"
+ request.servletPath = "/j_spring_security_check"
request.setParameter(token.parameterName,token.token)
request.setParameter("j_username","user")
request.setParameter("j_password","password")
@@ -190,7 +190,7 @@ class CsrfConfigTests extends AbstractHttpConfigTests {
when: "authenticate successfully"
response = new MockHttpServletResponse()
request = new MockHttpServletRequest(session: request.session)
- request.requestURI = "/j_spring_security_check"
+ request.servletPath = "/j_spring_security_check"
request.setParameter(token.parameterName,token.token)
request.setParameter("j_username","user")
request.setParameter("j_password","password")
@@ -281,7 +281,7 @@ class CsrfConfigTests extends AbstractHttpConfigTests {
request.method = "POST"
request.setParameter("j_username","user")
request.setParameter("j_password","password")
- request.requestURI = "/j_spring_security_check"
+ request.servletPath = "/j_spring_security_check"
when:
springSecurityFilterChain.doFilter(request,response,chain)
then:
diff --git a/config/src/test/groovy/org/springframework/security/config/http/FormLoginConfigTests.groovy b/config/src/test/groovy/org/springframework/security/config/http/FormLoginConfigTests.groovy
index 95523f9624..75dbb95fbf 100644
--- a/config/src/test/groovy/org/springframework/security/config/http/FormLoginConfigTests.groovy
+++ b/config/src/test/groovy/org/springframework/security/config/http/FormLoginConfigTests.groovy
@@ -104,18 +104,4 @@ class FormLoginConfigTests extends AbstractHttpConfigTests {
apf.usernameParameter == 'xname';
apf.passwordParameter == 'xpass'
}
-
- def 'SEC-2455: http@login-processing-url'() {
- when:
- xml.http {
- 'form-login'('login-processing-url':'/authenticate')
- }
- createAppContext()
-
- def apf = getFilter(UsernamePasswordAuthenticationFilter);
-
- then:
- apf.filterProcessesUrl == null // SEC-2455 setFilterProcessesUrl was not invoked
- FieldUtils.getFieldValue(apf,'requiresAuthenticationRequestMatcher.filterProcessesUrl') == '/authenticate'
- }
}
diff --git a/config/src/test/groovy/org/springframework/security/config/http/HttpOpenIDConfigTests.groovy b/config/src/test/groovy/org/springframework/security/config/http/HttpOpenIDConfigTests.groovy
index f2403092c6..b7784fa1e5 100644
--- a/config/src/test/groovy/org/springframework/security/config/http/HttpOpenIDConfigTests.groovy
+++ b/config/src/test/groovy/org/springframework/security/config/http/HttpOpenIDConfigTests.groovy
@@ -116,7 +116,7 @@ class OpenIDConfigTests extends AbstractHttpConfigTests {
then: "Remember-me choice is added to page"
response.getContentAsString().contains(AbstractRememberMeServices.DEFAULT_PARAMETER)
when: "Login is submitted with remember-me selected"
- request.setRequestURI("/j_spring_openid_security_check")
+ request.servletPath = "/j_spring_openid_security_check"
request.setParameter(OpenIDAuthenticationFilter.DEFAULT_CLAIMED_IDENTITY_FIELD, "http://hey.openid.com/")
request.setParameter(AbstractRememberMeServices.DEFAULT_PARAMETER, "on")
response = new MockHttpServletResponse();
diff --git a/config/src/test/groovy/org/springframework/security/config/http/InterceptUrlConfigTests.groovy b/config/src/test/groovy/org/springframework/security/config/http/InterceptUrlConfigTests.groovy
index 18df329acb..d0af38accf 100644
--- a/config/src/test/groovy/org/springframework/security/config/http/InterceptUrlConfigTests.groovy
+++ b/config/src/test/groovy/org/springframework/security/config/http/InterceptUrlConfigTests.groovy
@@ -13,8 +13,9 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-package org.springframework.security.config.http;
+package org.springframework.security.config.http
+import org.springframework.security.crypto.codec.Base64;
import java.security.Principal
@@ -125,4 +126,39 @@ class InterceptUrlConfigTests extends AbstractHttpConfigTests {
then: 'The response is unauthorized'
response.status == HttpServletResponse.SC_UNAUTHORIZED
}
+
+ def "intercept-url supports hasAnyRoles"() {
+ setup:
+ MockHttpServletRequest request = new MockHttpServletRequest(method:'GET')
+ MockHttpServletResponse response = new MockHttpServletResponse()
+ MockFilterChain chain = new MockFilterChain()
+ xml.http('use-expressions':true) {
+ 'http-basic'()
+ 'intercept-url'(pattern: '/**', access: "hasAnyRole('ROLE_DEVELOPER','ROLE_USER')")
+ csrf(disabled:true)
+ }
+ when:
+ createAppContext()
+ then: 'no error'
+ noExceptionThrown()
+ when: 'ROLE_USER can access'
+ login(request, 'user', 'password')
+ springSecurityFilterChain.doFilter(request,response,chain)
+ then: 'The response is OK'
+ response.status == HttpServletResponse.SC_OK
+ when: 'ROLE_A cannot access'
+ request = new MockHttpServletRequest(method:'GET')
+ response = new MockHttpServletResponse()
+ chain = new MockFilterChain()
+ login(request, 'bob', 'bobspassword')
+ springSecurityFilterChain.doFilter(request,response,chain)
+ then: 'The response is Forbidden'
+ response.status == HttpServletResponse.SC_FORBIDDEN
+
+ }
+
+ def login(MockHttpServletRequest request, String username, String password) {
+ String toEncode = username + ':' + password
+ request.addHeader('Authorization','Basic ' + new String(Base64.encode(toEncode.getBytes('UTF-8'))))
+ }
}
\ No newline at end of file
diff --git a/config/src/test/groovy/org/springframework/security/config/http/LogoutConfigTests.groovy b/config/src/test/groovy/org/springframework/security/config/http/LogoutConfigTests.groovy
deleted file mode 100644
index 7820d171a3..0000000000
--- a/config/src/test/groovy/org/springframework/security/config/http/LogoutConfigTests.groovy
+++ /dev/null
@@ -1,26 +0,0 @@
-package org.springframework.security.config.http
-
-import org.springframework.security.util.FieldUtils
-import org.springframework.security.web.authentication.logout.LogoutFilter
-
-/**
- *
- * @author Rob Winch
- */
-class LogoutConfigTests extends AbstractHttpConfigTests {
-
- def 'SEC-2455: logout@logout-url'() {
- when:
- httpAutoConfig {
- 'logout'('logout-url':'/logout')
- csrf(disabled:true)
- }
- createAppContext()
-
- def lf = getFilter(LogoutFilter);
-
- then:
- lf.filterProcessesUrl == null // SEC-2455 setFilterProcessesUrl was not invoked
- FieldUtils.getFieldValue(lf,'logoutRequestMatcher.filterProcessesUrl') == '/logout'
- }
-}
\ No newline at end of file
diff --git a/config/src/test/groovy/org/springframework/security/config/http/PlaceHolderAndELConfigTests.groovy b/config/src/test/groovy/org/springframework/security/config/http/PlaceHolderAndELConfigTests.groovy
index 7e57d9750d..658548aaba 100644
--- a/config/src/test/groovy/org/springframework/security/config/http/PlaceHolderAndELConfigTests.groovy
+++ b/config/src/test/groovy/org/springframework/security/config/http/PlaceHolderAndELConfigTests.groovy
@@ -135,7 +135,9 @@ class PlaceHolderAndELConfigTests extends AbstractHttpConfigTests {
def accessDeniedPageWorksWithPlaceholders() {
System.setProperty("accessDenied", "/go-away");
- xml.http('auto-config': 'true', 'access-denied-page': '${accessDenied}')
+ xml.http('auto-config': 'true') {
+ 'access-denied-handler'('error-page' : '${accessDenied}') {}
+ }
createAppContext();
expect:
diff --git a/config/src/test/groovy/org/springframework/security/config/http/SessionManagementConfigTests.groovy b/config/src/test/groovy/org/springframework/security/config/http/SessionManagementConfigTests.groovy
index 61b0d99b05..e7e60408be 100644
--- a/config/src/test/groovy/org/springframework/security/config/http/SessionManagementConfigTests.groovy
+++ b/config/src/test/groovy/org/springframework/security/config/http/SessionManagementConfigTests.groovy
@@ -285,7 +285,7 @@ class SessionManagementConfigTests extends AbstractHttpConfigTests {
MockHttpServletRequest request = new MockHttpServletRequest();
request.getSession();
- request.setRequestURI("/j_spring_security_check");
+ request.servletPath = "/j_spring_security_check"
request.setMethod("POST");
request.setParameter("j_username", "user");
request.setParameter("j_password", "password");
diff --git a/config/src/test/java/org/springframework/security/config/authentication/AuthenticationProviderBeanDefinitionParserTests.java b/config/src/test/java/org/springframework/security/config/authentication/AuthenticationProviderBeanDefinitionParserTests.java
index ea6496ed89..d88dde9e13 100644
--- a/config/src/test/java/org/springframework/security/config/authentication/AuthenticationProviderBeanDefinitionParserTests.java
+++ b/config/src/test/java/org/springframework/security/config/authentication/AuthenticationProviderBeanDefinitionParserTests.java
@@ -8,7 +8,6 @@ import org.springframework.security.authentication.UsernamePasswordAuthenticatio
import org.springframework.security.authentication.dao.ReflectionSaltSource;
import org.springframework.security.authentication.encoding.ShaPasswordEncoder;
import org.springframework.security.config.BeanIds;
-import org.springframework.security.config.authentication.AuthenticationProviderBeanDefinitionParser;
import org.springframework.security.config.util.InMemoryXmlApplicationContext;
import org.springframework.security.util.FieldUtils;
import org.springframework.beans.factory.parsing.BeanDefinitionParsingException;
@@ -153,8 +152,12 @@ public class AuthenticationProviderBeanDefinitionParserTests {
" " +
" " +
" " +
- " " +
+ " class='org.springframework.security.provisioning.InMemoryUserDetailsManager'>" +
+ " " +
+ " " +
+ " f117f0862384e9497ff4f470e3522606,ROLE_A" +
+ " " +
+ " " +
" ");
getProvider().authenticate(bob);
}
diff --git a/config/src/test/java/org/springframework/security/config/http/SessionManagementConfigServlet31Tests.java b/config/src/test/java/org/springframework/security/config/http/SessionManagementConfigServlet31Tests.java
index d5561b9d7f..bf5d1ad082 100644
--- a/config/src/test/java/org/springframework/security/config/http/SessionManagementConfigServlet31Tests.java
+++ b/config/src/test/java/org/springframework/security/config/http/SessionManagementConfigServlet31Tests.java
@@ -98,7 +98,7 @@ public class SessionManagementConfigServlet31Tests {
Method method = mock(Method.class);
MockHttpServletRequest request = new MockHttpServletRequest();
request.getSession();
- request.setRequestURI("/j_spring_security_check");
+ request.setServletPath("/j_spring_security_check");
request.setMethod("POST");
request.setParameter("j_username", "user");
request.setParameter("j_password", "password");
@@ -124,7 +124,7 @@ public class SessionManagementConfigServlet31Tests {
Method method = mock(Method.class);
MockHttpServletRequest request = new MockHttpServletRequest();
request.getSession();
- request.setRequestURI("/j_spring_security_check");
+ request.setServletPath("/j_spring_security_check");
request.setMethod("POST");
request.setParameter("j_username", "user");
request.setParameter("j_password", "password");
diff --git a/config/src/test/java/org/springframework/security/intercept/method/aopalliance/MethodSecurityInterceptorWithAopConfigTests.java b/config/src/test/java/org/springframework/security/intercept/method/aopalliance/MethodSecurityInterceptorWithAopConfigTests.java
index 56989a7c40..532df87ca3 100644
--- a/config/src/test/java/org/springframework/security/intercept/method/aopalliance/MethodSecurityInterceptorWithAopConfigTests.java
+++ b/config/src/test/java/org/springframework/security/intercept/method/aopalliance/MethodSecurityInterceptorWithAopConfigTests.java
@@ -30,9 +30,9 @@ public class MethodSecurityInterceptorWithAopConfigTests {
static final String ACCESS_MANAGER_XML =
"" +
- " " +
+ " " +
" " +
- " " +
+ " " +
"";
static final String TARGET_BEAN_AND_INTERCEPTOR =
diff --git a/config/src/test/resources/org/springframework/security/util/filtertest-valid.xml b/config/src/test/resources/org/springframework/security/util/filtertest-valid.xml
index 8ba04ee5d2..39d06dd9c0 100644
--- a/config/src/test/resources/org/springframework/security/util/filtertest-valid.xml
+++ b/config/src/test/resources/org/springframework/security/util/filtertest-valid.xml
@@ -104,7 +104,7 @@
-
+
diff --git a/core/src/main/java/org/springframework/security/access/ConfigAttributeEditor.java b/core/src/main/java/org/springframework/security/access/ConfigAttributeEditor.java
deleted file mode 100644
index a92fb0f40b..0000000000
--- a/core/src/main/java/org/springframework/security/access/ConfigAttributeEditor.java
+++ /dev/null
@@ -1,41 +0,0 @@
-/* Copyright 2004, 2005, 2006 Acegi Technology Pty Limited
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.springframework.security.access;
-
-import org.springframework.util.StringUtils;
-
-import java.beans.PropertyEditorSupport;
-
-/**
- * A property editor that can create a populated List<ConfigAttribute> from a comma separated list of values.
- *
- * Trims preceding and trailing spaces from presented command separated tokens, as this can be a source
- * of hard-to-spot configuration issues for end users.
- *
- * @author Ben Alex
- * @deprecated
- */
-public class ConfigAttributeEditor extends PropertyEditorSupport {
- //~ Methods ========================================================================================================
-
- public void setAsText(String s) throws IllegalArgumentException {
- if (StringUtils.hasText(s)) {
- setValue(SecurityConfig.createList(StringUtils.commaDelimitedListToStringArray(s)));
- } else {
- setValue(null);
- }
- }
-}
diff --git a/core/src/main/java/org/springframework/security/access/SecurityConfig.java b/core/src/main/java/org/springframework/security/access/SecurityConfig.java
index 8f799a38ff..4ae6ecefc6 100644
--- a/core/src/main/java/org/springframework/security/access/SecurityConfig.java
+++ b/core/src/main/java/org/springframework/security/access/SecurityConfig.java
@@ -66,14 +66,6 @@ public class SecurityConfig implements ConfigAttribute {
return createList(StringUtils.commaDelimitedListToStringArray(access));
}
- /**
- * @deprecated Use createList instead
- */
- @Deprecated
- public static List createSingleAttributeList(String access) {
- return createList(access);
- }
-
public static List createList(String... attributeNames) {
Assert.notNull(attributeNames, "You must supply an array of attribute names");
List attributes = new ArrayList(attributeNames.length);
diff --git a/core/src/main/java/org/springframework/security/access/hierarchicalroles/UserDetailsServiceWrapper.java b/core/src/main/java/org/springframework/security/access/hierarchicalroles/UserDetailsServiceWrapper.java
deleted file mode 100755
index d4b18bc57d..0000000000
--- a/core/src/main/java/org/springframework/security/access/hierarchicalroles/UserDetailsServiceWrapper.java
+++ /dev/null
@@ -1,53 +0,0 @@
-/*
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.springframework.security.access.hierarchicalroles;
-
-import org.springframework.security.core.userdetails.UserDetails;
-import org.springframework.security.core.userdetails.UserDetailsService;
-
-/**
- * This class wraps Spring Security's UserDetailsService in a way that its loadUserByUsername()
- * method returns wrapped UserDetails that return all hierarchically reachable authorities
- * instead of only the directly assigned authorities.
- *
- * @author Michael Mayr
- * @deprecated use a {@code RoleHierarchyVoter} or use a {@code RoleHierarchyAuthoritiesMapper} to populate the
- * Authentication object with the additional authorities.
- */
-public class UserDetailsServiceWrapper implements UserDetailsService {
-
- private UserDetailsService userDetailsService = null;
-
- private RoleHierarchy roleHierarchy = null;
-
- public void setRoleHierarchy(RoleHierarchy roleHierarchy) {
- this.roleHierarchy = roleHierarchy;
- }
-
- public void setUserDetailsService(UserDetailsService userDetailsService) {
- this.userDetailsService = userDetailsService;
- }
-
- public UserDetails loadUserByUsername(String username) {
- UserDetails userDetails = userDetailsService.loadUserByUsername(username);
- // wrapped UserDetailsService might throw UsernameNotFoundException or DataAccessException which will then bubble up
- return new UserDetailsWrapper(userDetails, roleHierarchy);
- }
-
- public UserDetailsService getWrappedUserDetailsService() {
- return userDetailsService;
- }
-
-}
diff --git a/core/src/main/java/org/springframework/security/access/hierarchicalroles/UserDetailsWrapper.java b/core/src/main/java/org/springframework/security/access/hierarchicalroles/UserDetailsWrapper.java
deleted file mode 100755
index 6d0c226d3d..0000000000
--- a/core/src/main/java/org/springframework/security/access/hierarchicalroles/UserDetailsWrapper.java
+++ /dev/null
@@ -1,76 +0,0 @@
-/*
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.springframework.security.access.hierarchicalroles;
-
-import java.util.Collection;
-
-import org.springframework.security.access.vote.RoleHierarchyVoter;
-import org.springframework.security.core.GrantedAuthority;
-import org.springframework.security.core.userdetails.UserDetails;
-
-/**
- * This class wraps Spring Security's UserDetails in a way that its getAuthorities() method is
- * delegated to RoleHierarchy.getReachableGrantedAuthorities. All other methods are
- * delegated to the UserDetails implementation.
- *
- * @author Michael Mayr
- * @deprecated use a {@link RoleHierarchyVoter} or {@code RoleHierarchyAuthoritiesMapper} instead.
- */
-public class UserDetailsWrapper implements UserDetails {
-
- private static final long serialVersionUID = 1532428778390085311L;
-
- private UserDetails userDetails = null;
-
- private RoleHierarchy roleHierarchy = null;
-
- public UserDetailsWrapper(UserDetails userDetails, RoleHierarchy roleHierarchy) {
- this.userDetails = userDetails;
- this.roleHierarchy = roleHierarchy;
- }
-
- public boolean isAccountNonExpired() {
- return userDetails.isAccountNonExpired();
- }
-
- public boolean isAccountNonLocked() {
- return userDetails.isAccountNonLocked();
- }
-
- public Collection extends GrantedAuthority> getAuthorities() {
- return roleHierarchy.getReachableGrantedAuthorities(userDetails.getAuthorities());
- }
-
- public boolean isCredentialsNonExpired() {
- return userDetails.isCredentialsNonExpired();
- }
-
- public boolean isEnabled() {
- return userDetails.isEnabled();
- }
-
- public String getPassword() {
- return userDetails.getPassword();
- }
-
- public String getUsername() {
- return userDetails.getUsername();
- }
-
- public UserDetails getUnwrappedUserDetails() {
- return userDetails;
- }
-
-}
diff --git a/core/src/main/java/org/springframework/security/access/vote/AbstractAccessDecisionManager.java b/core/src/main/java/org/springframework/security/access/vote/AbstractAccessDecisionManager.java
index ebe63115e9..4ad1bd05e6 100644
--- a/core/src/main/java/org/springframework/security/access/vote/AbstractAccessDecisionManager.java
+++ b/core/src/main/java/org/springframework/security/access/vote/AbstractAccessDecisionManager.java
@@ -50,9 +50,6 @@ public abstract class AbstractAccessDecisionManager implements AccessDecisionMan
private boolean allowIfAllAbstainDecisions = false;
- protected AbstractAccessDecisionManager() {
- }
-
protected AbstractAccessDecisionManager(List> decisionVoters) {
Assert.notEmpty(decisionVoters, "A list of AccessDecisionVoters is required");
this.decisionVoters = decisionVoters;
@@ -84,24 +81,6 @@ public abstract class AbstractAccessDecisionManager implements AccessDecisionMan
this.allowIfAllAbstainDecisions = allowIfAllAbstainDecisions;
}
- /**
- * @deprecated Use constructor
- */
- @Deprecated
- public void setDecisionVoters(List> newList) {
- Assert.notEmpty(newList);
-
- Iterator> iter = newList.iterator();
-
- while (iter.hasNext()) {
- Object currentObject = iter.next();
- Assert.isInstanceOf(AccessDecisionVoter.class, currentObject, "AccessDecisionVoter " +
- currentObject.getClass().getName() + " must implement AccessDecisionVoter");
- }
-
- this.decisionVoters = newList;
- }
-
public void setMessageSource(MessageSource messageSource) {
this.messages = new MessageSourceAccessor(messageSource);
}
diff --git a/core/src/main/java/org/springframework/security/access/vote/AffirmativeBased.java b/core/src/main/java/org/springframework/security/access/vote/AffirmativeBased.java
index b4c9d0af38..b1699e796a 100644
--- a/core/src/main/java/org/springframework/security/access/vote/AffirmativeBased.java
+++ b/core/src/main/java/org/springframework/security/access/vote/AffirmativeBased.java
@@ -29,13 +29,6 @@ import org.springframework.security.core.Authentication;
*/
public class AffirmativeBased extends AbstractAccessDecisionManager {
- /**
- * @deprecated Use constructor which takes voter list
- */
- @Deprecated
- public AffirmativeBased() {
- }
-
public AffirmativeBased(List> decisionVoters) {
super(decisionVoters);
}
diff --git a/core/src/main/java/org/springframework/security/access/vote/ConsensusBased.java b/core/src/main/java/org/springframework/security/access/vote/ConsensusBased.java
index 1be4e29731..716744fbbc 100644
--- a/core/src/main/java/org/springframework/security/access/vote/ConsensusBased.java
+++ b/core/src/main/java/org/springframework/security/access/vote/ConsensusBased.java
@@ -34,13 +34,6 @@ public class ConsensusBased extends AbstractAccessDecisionManager {
private boolean allowIfEqualGrantedDeniedDecisions = true;
- /**
- * @deprecated Use constructor which takes voter list
- */
- @Deprecated
- public ConsensusBased() {
- }
-
public ConsensusBased(List> decisionVoters) {
super(decisionVoters);
}
diff --git a/core/src/main/java/org/springframework/security/access/vote/UnanimousBased.java b/core/src/main/java/org/springframework/security/access/vote/UnanimousBased.java
index 9dd40c48cf..9485b43865 100644
--- a/core/src/main/java/org/springframework/security/access/vote/UnanimousBased.java
+++ b/core/src/main/java/org/springframework/security/access/vote/UnanimousBased.java
@@ -31,13 +31,6 @@ import org.springframework.security.core.Authentication;
*/
public class UnanimousBased extends AbstractAccessDecisionManager {
- /**
- * @deprecated Use constructor which takes voter list
- */
- @Deprecated
- public UnanimousBased() {
- }
-
public UnanimousBased(List> decisionVoters) {
super(decisionVoters);
}
diff --git a/core/src/main/java/org/springframework/security/authentication/AccountExpiredException.java b/core/src/main/java/org/springframework/security/authentication/AccountExpiredException.java
index 8123b5080c..8d35698327 100644
--- a/core/src/main/java/org/springframework/security/authentication/AccountExpiredException.java
+++ b/core/src/main/java/org/springframework/security/authentication/AccountExpiredException.java
@@ -44,9 +44,4 @@ public class AccountExpiredException extends AccountStatusException {
public AccountExpiredException(String msg, Throwable t) {
super(msg, t);
}
-
- @Deprecated
- public AccountExpiredException(String msg, Object extraInformation) {
- super(msg, extraInformation);
- }
}
diff --git a/core/src/main/java/org/springframework/security/authentication/AccountStatusException.java b/core/src/main/java/org/springframework/security/authentication/AccountStatusException.java
index 57c64b47be..cc4bff3f8f 100644
--- a/core/src/main/java/org/springframework/security/authentication/AccountStatusException.java
+++ b/core/src/main/java/org/springframework/security/authentication/AccountStatusException.java
@@ -16,9 +16,4 @@ public abstract class AccountStatusException extends AuthenticationException {
public AccountStatusException(String msg, Throwable t) {
super(msg, t);
}
-
- @Deprecated
- protected AccountStatusException(String msg, Object extraInformation) {
- super(msg, extraInformation);
- }
}
diff --git a/core/src/main/java/org/springframework/security/authentication/AccountStatusUserDetailsChecker.java b/core/src/main/java/org/springframework/security/authentication/AccountStatusUserDetailsChecker.java
index 096751f478..ca3f3b391c 100644
--- a/core/src/main/java/org/springframework/security/authentication/AccountStatusUserDetailsChecker.java
+++ b/core/src/main/java/org/springframework/security/authentication/AccountStatusUserDetailsChecker.java
@@ -14,21 +14,21 @@ public class AccountStatusUserDetailsChecker implements UserDetailsChecker {
public void check(UserDetails user) {
if (!user.isAccountNonLocked()) {
- throw new LockedException(messages.getMessage("AccountStatusUserDetailsChecker.locked", "User account is locked"), user);
+ throw new LockedException(messages.getMessage("AccountStatusUserDetailsChecker.locked", "User account is locked"));
}
if (!user.isEnabled()) {
- throw new DisabledException(messages.getMessage("AccountStatusUserDetailsChecker.disabled", "User is disabled"), user);
+ throw new DisabledException(messages.getMessage("AccountStatusUserDetailsChecker.disabled", "User is disabled"));
}
if (!user.isAccountNonExpired()) {
throw new AccountExpiredException(messages.getMessage("AccountStatusUserDetailsChecker.expired",
- "User account has expired"), user);
+ "User account has expired"));
}
if (!user.isCredentialsNonExpired()) {
throw new CredentialsExpiredException(messages.getMessage("AccountStatusUserDetailsChecker.credentialsExpired",
- "User credentials have expired"), user);
+ "User credentials have expired"));
}
}
}
diff --git a/core/src/main/java/org/springframework/security/authentication/AnonymousAuthenticationProvider.java b/core/src/main/java/org/springframework/security/authentication/AnonymousAuthenticationProvider.java
index b9bfde844b..995cebb02e 100644
--- a/core/src/main/java/org/springframework/security/authentication/AnonymousAuthenticationProvider.java
+++ b/core/src/main/java/org/springframework/security/authentication/AnonymousAuthenticationProvider.java
@@ -33,31 +33,20 @@ import org.springframework.util.Assert;
*
* @author Ben Alex
*/
-public class AnonymousAuthenticationProvider implements AuthenticationProvider, InitializingBean, MessageSourceAware {
+public class AnonymousAuthenticationProvider implements AuthenticationProvider, MessageSourceAware {
//~ Instance fields ================================================================================================
protected MessageSourceAccessor messages = SpringSecurityMessageSource.getAccessor();
private String key;
- /**
- *
- * @deprecated Use constructor injection
- */
- @Deprecated
- public AnonymousAuthenticationProvider() {
- }
-
public AnonymousAuthenticationProvider(String key) {
+ Assert.hasLength(key, "A Key is required");
this.key = key;
}
//~ Methods ========================================================================================================
- public void afterPropertiesSet() throws Exception {
- Assert.hasLength(key, "A Key is required");
- }
-
public Authentication authenticate(Authentication authentication)
throws AuthenticationException {
if (!supports(authentication.getClass())) {
@@ -76,15 +65,6 @@ 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);
diff --git a/core/src/main/java/org/springframework/security/authentication/AuthenticationDetails.java b/core/src/main/java/org/springframework/security/authentication/AuthenticationDetails.java
deleted file mode 100755
index cb6a44fbd3..0000000000
--- a/core/src/main/java/org/springframework/security/authentication/AuthenticationDetails.java
+++ /dev/null
@@ -1,74 +0,0 @@
-package org.springframework.security.authentication;
-
-import org.springframework.security.core.SpringSecurityCoreVersion;
-
-import java.io.Serializable;
-
-/**
-* A holder of the context as a string.
-*
-* @author Ruud Senden
-* @since 2.0
-*/
-@Deprecated
-public class AuthenticationDetails implements Serializable {
-
- private static final long serialVersionUID = SpringSecurityCoreVersion.SERIAL_VERSION_UID;
-
- //~ Instance fields ================================================================================================
-
- private final String context;
-
- //~ Constructors ===================================================================================================
-
- /**
- * Constructor.
- *
- * @param context that the authentication request is initiated from
- */
- public AuthenticationDetails(Object context) {
- this.context = context == null ? "" : context.toString();
- doPopulateAdditionalInformation(context);
- }
-
- //~ Methods ========================================================================================================
-
- /**
- * Provided so that subclasses can populate additional information.
- *
- * @param context the existing contextual information
- */
- protected void doPopulateAdditionalInformation(Object context) {}
-
- public boolean equals(Object obj) {
- if (obj instanceof AuthenticationDetails) {
- AuthenticationDetails rhs = (AuthenticationDetails) obj;
-
- // this.context cannot be null
- if (!context.equals(rhs.getContext())) {
- return false;
- }
-
- return true;
- }
-
- return false;
- }
-
- /**
- * Indicates the context.
- *
- * @return the context
- */
- public String getContext() {
- return context;
- }
-
- public String toString() {
- StringBuilder sb = new StringBuilder();
- sb.append(super.toString() + ": ");
- sb.append("Context: " + this.getContext());
-
- return sb.toString();
- }
-}
diff --git a/core/src/main/java/org/springframework/security/authentication/AuthenticationDetailsSourceImpl.java b/core/src/main/java/org/springframework/security/authentication/AuthenticationDetailsSourceImpl.java
deleted file mode 100755
index 0d774b6266..0000000000
--- a/core/src/main/java/org/springframework/security/authentication/AuthenticationDetailsSourceImpl.java
+++ /dev/null
@@ -1,76 +0,0 @@
-package org.springframework.security.authentication;
-
-import org.springframework.util.Assert;
-import org.springframework.util.ReflectionUtils;
-
-import java.lang.reflect.Constructor;
-
-/**
- * Base implementation of {@link AuthenticationDetailsSource}.
- *
- * By default will create an instance of AuthenticationDetails.
- * Any object that accepts an Object as its sole constructor can
- * be used instead of this default.
- *
- *
- * @author Ruud Senden
- * @since 2.0
- * @deprecated Write an implementation of AuthenticationDetailsSource which returns the desired type directly.
- */
-@Deprecated
-public class AuthenticationDetailsSourceImpl implements AuthenticationDetailsSource
-
-
+
@@ -67,7 +66,7 @@
-
+
@@ -79,12 +78,12 @@
-
-
+
-
+
-
+
+
diff --git a/itest/context/src/integration-test/resources/http-extra-fsi-app-context.xml b/itest/context/src/integration-test/resources/http-extra-fsi-app-context.xml
index e1a8aa833a..290616edf7 100644
--- a/itest/context/src/integration-test/resources/http-extra-fsi-app-context.xml
+++ b/itest/context/src/integration-test/resources/http-extra-fsi-app-context.xml
@@ -31,12 +31,12 @@
-
-
+
-
+
+
diff --git a/itest/context/src/integration-test/resources/sec-936-app-context.xml b/itest/context/src/integration-test/resources/sec-936-app-context.xml
index 3ab778af80..dc3a11f9dd 100755
--- a/itest/context/src/integration-test/resources/sec-936-app-context.xml
+++ b/itest/context/src/integration-test/resources/sec-936-app-context.xml
@@ -16,13 +16,13 @@
-
-
+
-
+
+
diff --git a/itest/web/src/main/webapp/WEB-INF/http-security-custom-concurrency.xml b/itest/web/src/main/webapp/WEB-INF/http-security-custom-concurrency.xml
index af2d81a67e..43e270e8db 100644
--- a/itest/web/src/main/webapp/WEB-INF/http-security-custom-concurrency.xml
+++ b/itest/web/src/main/webapp/WEB-INF/http-security-custom-concurrency.xml
@@ -21,7 +21,7 @@
-
+
@@ -30,8 +30,8 @@
-
-
+
+
diff --git a/itest/web/src/main/webapp/WEB-INF/security.tld b/itest/web/src/main/webapp/WEB-INF/security.tld
index ce94181785..01961e8968 100644
--- a/itest/web/src/main/webapp/WEB-INF/security.tld
+++ b/itest/web/src/main/webapp/WEB-INF/security.tld
@@ -60,35 +60,6 @@
false
-
-
- A comma separated list of roles which the user must not have
- for the body to be output. Deprecated in favour of the access expression.
-
- ifNotGranted
- false
- true
-
-
-
-
- A comma separated list of roles which the user must all
- possess for the body to be output. Deprecated in favour of the access expression.
-
- ifAllGranted
- false
- true
-
-
-
-
- A comma separated list of roles, one of which the user must
- possess for the body to be output. Deprecated in favour of the access expression.
-
- ifAnyGranted
- false
- true
-
diff --git a/ldap/src/main/java/org/springframework/security/ldap/authentication/PasswordComparisonAuthenticator.java b/ldap/src/main/java/org/springframework/security/ldap/authentication/PasswordComparisonAuthenticator.java
index 77cd7b62be..f661700e81 100644
--- a/ldap/src/main/java/org/springframework/security/ldap/authentication/PasswordComparisonAuthenticator.java
+++ b/ldap/src/main/java/org/springframework/security/ldap/authentication/PasswordComparisonAuthenticator.java
@@ -89,7 +89,7 @@ public final class PasswordComparisonAuthenticator extends AbstractLdapAuthentic
}
if (user == null) {
- throw new UsernameNotFoundException("User not found: " + username, username);
+ throw new UsernameNotFoundException("User not found: " + username);
}
if (logger.isDebugEnabled()) {
diff --git a/ldap/src/main/java/org/springframework/security/ldap/authentication/ad/ActiveDirectoryLdapAuthenticationProvider.java b/ldap/src/main/java/org/springframework/security/ldap/authentication/ad/ActiveDirectoryLdapAuthenticationProvider.java
index 43bb830527..a40ac2847d 100644
--- a/ldap/src/main/java/org/springframework/security/ldap/authentication/ad/ActiveDirectoryLdapAuthenticationProvider.java
+++ b/ldap/src/main/java/org/springframework/security/ldap/authentication/ad/ActiveDirectoryLdapAuthenticationProvider.java
@@ -286,7 +286,7 @@ public final class ActiveDirectoryLdapAuthenticationProvider extends AbstractLda
new Object[]{bindPrincipal});
} catch (IncorrectResultSizeDataAccessException incorrectResults) {
if (incorrectResults.getActualSize() == 0) {
- UsernameNotFoundException userNameNotFoundException = new UsernameNotFoundException("User " + username + " not found in directory.", username);
+ UsernameNotFoundException userNameNotFoundException = new UsernameNotFoundException("User " + username + " not found in directory.");
userNameNotFoundException.initCause(incorrectResults);
throw badCredentials(userNameNotFoundException);
}
diff --git a/ldap/src/main/java/org/springframework/security/ldap/search/FilterBasedLdapUserSearch.java b/ldap/src/main/java/org/springframework/security/ldap/search/FilterBasedLdapUserSearch.java
index 8ea6f89d4b..164d167a95 100644
--- a/ldap/src/main/java/org/springframework/security/ldap/search/FilterBasedLdapUserSearch.java
+++ b/ldap/src/main/java/org/springframework/security/ldap/search/FilterBasedLdapUserSearch.java
@@ -117,7 +117,7 @@ public class FilterBasedLdapUserSearch implements LdapUserSearch {
} catch (IncorrectResultSizeDataAccessException notFound) {
if (notFound.getActualSize() == 0) {
- throw new UsernameNotFoundException("User " + username + " not found in directory.", username);
+ throw new UsernameNotFoundException("User " + username + " not found in directory.");
}
// Search should never return multiple results if properly configured, so just rethrow
throw notFound;
diff --git a/ldap/src/main/java/org/springframework/security/ldap/userdetails/DefaultLdapAuthoritiesPopulator.java b/ldap/src/main/java/org/springframework/security/ldap/userdetails/DefaultLdapAuthoritiesPopulator.java
index 252a30b6a4..bbf1dc559a 100644
--- a/ldap/src/main/java/org/springframework/security/ldap/userdetails/DefaultLdapAuthoritiesPopulator.java
+++ b/ldap/src/main/java/org/springframework/security/ldap/userdetails/DefaultLdapAuthoritiesPopulator.java
@@ -85,9 +85,6 @@ import java.util.Set;
* A search for roles for user "uid=ben,ou=people,dc=springframework,dc=org" would return the single granted authority
* "ROLE_DEVELOPER".
*
- * Note that case-conversion, use of the role prefix and setting a default role are better performed using a
- * {@code GrantedAuthoritiesMapper} and are now deprecated.
- *
* The single-level search is performed by default. Setting the searchSubTree property to true will enable
* a search of the entire subtree under groupSearchBase.
*
@@ -250,9 +247,8 @@ public class DefaultLdapAuthoritiesPopulator implements LdapAuthoritiesPopulator
}
/**
- * @deprecated Convert case in the {@code AuthenticationProvider} using a {@code GrantedAuthoritiesMapper}.
+ * Convert the role to uppercase
*/
- @Deprecated
public void setConvertToUpperCase(boolean convertToUpperCase) {
this.convertToUpperCase = convertToUpperCase;
}
@@ -261,9 +257,7 @@ public class DefaultLdapAuthoritiesPopulator implements LdapAuthoritiesPopulator
* The default role which will be assigned to all users.
*
* @param defaultRole the role name, including any desired prefix.
- * @deprecated Assign a default role in the {@code AuthenticationProvider} using a {@code GrantedAuthoritiesMapper}.
*/
- @Deprecated
public void setDefaultRole(String defaultRole) {
Assert.notNull(defaultRole, "The defaultRole property cannot be set to null");
this.defaultRole = new SimpleGrantedAuthority(defaultRole);
@@ -282,10 +276,7 @@ public class DefaultLdapAuthoritiesPopulator implements LdapAuthoritiesPopulator
/**
* Sets the prefix which will be prepended to the values loaded from the directory.
* Defaults to "ROLE_" for compatibility with RoleVoter/tt>.
- *
- * @deprecated Map the authorities in the {@code AuthenticationProvider} using a {@code GrantedAuthoritiesMapper}.
*/
- @Deprecated
public void setRolePrefix(String rolePrefix) {
Assert.notNull(rolePrefix, "rolePrefix must not be null");
this.rolePrefix = rolePrefix;
@@ -312,7 +303,7 @@ public class DefaultLdapAuthoritiesPopulator implements LdapAuthoritiesPopulator
/**
* Returns the current LDAP template.
- * Method available so that classes extending this can override the template used
+ * Method available so that classes extending this can override the template used
* @return the LDAP template
* @see {@link org.springframework.security.ldap.SpringSecurityLdapTemplate}
*/
diff --git a/openid/src/main/java/org/springframework/security/openid/OpenID4JavaConsumer.java b/openid/src/main/java/org/springframework/security/openid/OpenID4JavaConsumer.java
index 1700927726..8beaef52ca 100644
--- a/openid/src/main/java/org/springframework/security/openid/OpenID4JavaConsumer.java
+++ b/openid/src/main/java/org/springframework/security/openid/OpenID4JavaConsumer.java
@@ -62,27 +62,6 @@ public class OpenID4JavaConsumer implements OpenIDConsumer {
this(new ConsumerManager(), new NullAxFetchListFactory());
}
- /**
- * @deprecated use the {@link AxFetchListFactory} version instead.
- */
- @Deprecated
- public OpenID4JavaConsumer(List attributes) throws ConsumerException {
- this(new ConsumerManager(), attributes);
- }
-
- @Deprecated
- public OpenID4JavaConsumer(ConsumerManager consumerManager, final List attributes)
- throws ConsumerException {
- this.consumerManager = consumerManager;
- this.attributesToFetchFactory = new AxFetchListFactory() {
- private final List fetchAttrs = Collections.unmodifiableList(attributes);
-
- public List createAttributeList(String identifier) {
- return fetchAttrs;
- }
- };
- }
-
public OpenID4JavaConsumer(AxFetchListFactory attributesToFetchFactory) throws ConsumerException {
this(new ConsumerManager(), attributesToFetchFactory);
}
diff --git a/openid/src/test/java/org/springframework/security/openid/OpenID4JavaConsumerTests.java b/openid/src/test/java/org/springframework/security/openid/OpenID4JavaConsumerTests.java
index 32f7fd778b..dbc0b5d034 100644
--- a/openid/src/test/java/org/springframework/security/openid/OpenID4JavaConsumerTests.java
+++ b/openid/src/test/java/org/springframework/security/openid/OpenID4JavaConsumerTests.java
@@ -39,7 +39,7 @@ public class OpenID4JavaConsumerTests {
when(mgr.authenticate(any(DiscoveryInformation.class), anyString(), anyString())).thenReturn(authReq);
when(mgr.associate(anyList())).thenReturn(di);
- OpenID4JavaConsumer consumer = new OpenID4JavaConsumer(mgr, attributes);
+ OpenID4JavaConsumer consumer = new OpenID4JavaConsumer(mgr, new MockAttributesFactory());
MockHttpServletRequest request = new MockHttpServletRequest();
consumer.beginConsumption(request, "", "", "");
@@ -195,11 +195,16 @@ public class OpenID4JavaConsumerTests {
consumer.endConsumption(new MockHttpServletRequest());
}
- @SuppressWarnings("deprecation")
@Test
public void additionalConstructorsWork() throws Exception {
new OpenID4JavaConsumer();
- new OpenID4JavaConsumer(attributes);
+ new OpenID4JavaConsumer(new MockAttributesFactory());
}
+ private class MockAttributesFactory implements AxFetchListFactory {
+
+ public List createAttributeList(String identifier) {
+ return attributes;
+ }
+ }
}
diff --git a/openid/src/test/java/org/springframework/security/openid/OpenIDAuthenticationFilterTests.java b/openid/src/test/java/org/springframework/security/openid/OpenIDAuthenticationFilterTests.java
index 711fa047d0..8d189eeef6 100644
--- a/openid/src/test/java/org/springframework/security/openid/OpenIDAuthenticationFilterTests.java
+++ b/openid/src/test/java/org/springframework/security/openid/OpenIDAuthenticationFilterTests.java
@@ -45,7 +45,9 @@ public class OpenIDAuthenticationFilterTests {
@Test
public void testFilterOperation() throws Exception {
- MockHttpServletRequest req = new MockHttpServletRequest("GET", REQUEST_PATH);
+ MockHttpServletRequest req = new MockHttpServletRequest();
+ req.setServletPath(REQUEST_PATH);
+ req.setRequestURI(REQUEST_PATH);
req.setServerPort(8080);
MockHttpServletResponse response = new MockHttpServletResponse();
diff --git a/samples/cas/sample-xml/src/main/webapp/WEB-INF/applicationContext-security.xml b/samples/cas/sample-xml/src/main/webapp/WEB-INF/applicationContext-security.xml
index 923d86a09b..55f8e20f54 100644
--- a/samples/cas/sample-xml/src/main/webapp/WEB-INF/applicationContext-security.xml
+++ b/samples/cas/sample-xml/src/main/webapp/WEB-INF/applicationContext-security.xml
@@ -62,7 +62,9 @@
p:proxyGrantingTicketStorage-ref="pgtStorage"
p:proxyReceptorUrl="/j_spring_cas_security_proxyreceptor">
-
+
+
+ Login to CAS failed!
- Your CAS credentials were rejected.
- Reason:
-<%
- Exception error = ((AuthenticationException) session.getAttribute(AbstractAuthenticationProcessingFilter.SPRING_SECURITY_LAST_EXCEPTION_KEY));
- if(error != null) {
-%>
-<%= error.getMessage() %>
-<%
-}
-%>
+ Your CAS credentials were rejected.
CUSTOM SPRING SECURITY LOGIN
- <%-- this form-login-page form is also used as the
- form-error-page to ask for a login again.
- --%>
- <% if (session.getAttribute(AbstractAuthenticationProcessingFilter.SPRING_SECURITY_LAST_EXCEPTION_KEY) != null) { %>
-
- Your login attempt was not successful, try again.