SEC-1125: Further refactoring of web packages following creation of web module. Fixing samples.

This commit is contained in:
Luke Taylor
2009-03-26 07:18:36 +00:00
parent 2a9a8a41db
commit bec84f874a
275 changed files with 834 additions and 798 deletions

View File

@@ -21,7 +21,7 @@ import javax.servlet.ServletException;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import org.springframework.security.ui.AuthenticationEntryPoint;
import org.springframework.security.web.AuthenticationEntryPoint;
/**

View File

@@ -15,7 +15,7 @@
package org.springframework.security;
import org.springframework.security.web.util.PortResolver;
import org.springframework.security.web.PortResolver;
import javax.servlet.ServletRequest;

View File

@@ -1,52 +0,0 @@
package org.springframework.security.ui;
import static org.junit.Assert.*;
import org.junit.Test;
import org.springframework.security.providers.TestingAuthenticationToken;
/**
*
* @author Luke Taylor
* @version $Id$
*/
public class AuthenticationDetailsSourceImplTests {
@Test
public void buildDetailsReturnsExpectedAuthenticationDetails() {
AuthenticationDetailsSourceImpl ads = new AuthenticationDetailsSourceImpl();
AuthenticationDetails details = (AuthenticationDetails) ads.buildDetails("the context");
assertEquals("the context", details.getContext());
assertEquals(new AuthenticationDetails("the context"), details);
ads.setClazz(AuthenticationDetails.class);
details = (AuthenticationDetails) ads.buildDetails("another context");
assertEquals("another context", details.getContext());
}
@Test(expected=IllegalStateException.class)
public void nonMatchingConstructorIsRejected() {
AuthenticationDetailsSourceImpl ads = new AuthenticationDetailsSourceImpl();
ads.setClazz(String.class);
ads.buildDetails(new Object());
}
@Test(expected=IllegalStateException.class)
public void constructorTakingMultipleArgumentsIsRejected() {
AuthenticationDetailsSourceImpl ads = new AuthenticationDetailsSourceImpl();
ads.setClazz(TestingAuthenticationToken.class);
ads.buildDetails(null);
}
@Test
public void authenticationDetailsEqualsBehavesAsExpected() {
AuthenticationDetails details = new AuthenticationDetails("the context");
assertFalse((new AuthenticationDetails("different context")).equals(details));
assertFalse((new AuthenticationDetails(null)).equals(details));
assertFalse(details.equals(new AuthenticationDetails(null)));
assertFalse(details.equals("a string"));
// Just check toString() functions OK
details.toString();
(new AuthenticationDetails(null)).toString();
}
}

View File

@@ -1,68 +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.util;
import java.io.IOException;
import javax.servlet.Filter;
import javax.servlet.FilterChain;
import javax.servlet.FilterConfig;
import javax.servlet.ServletException;
import javax.servlet.ServletRequest;
import javax.servlet.ServletResponse;
/**
* A simple filter that the test case can delegate to.
*
* @author Ben Alex
* @version $Id$
*/
public class MockFilter implements Filter {
//~ Instance fields ================================================================================================
private boolean wasDestroyed = false;
private boolean wasDoFiltered = false;
private boolean wasInitialized = false;
//~ Methods ========================================================================================================
public void destroy() {
wasDestroyed = true;
}
public void doFilter(ServletRequest request, ServletResponse response, FilterChain chain)
throws IOException, ServletException {
wasDoFiltered = true;
chain.doFilter(request, response);
}
public void init(FilterConfig config) throws ServletException {
wasInitialized = true;
}
public boolean isWasDestroyed() {
return wasDestroyed;
}
public boolean isWasDoFiltered() {
return wasDoFiltered;
}
public boolean isWasInitialized() {
return wasInitialized;
}
}

View File

@@ -13,7 +13,7 @@
* limitations under the License.
*/
package org.springframework.security.ui;
package org.springframework.security.web;
import java.io.IOException;
@@ -33,9 +33,11 @@ import org.springframework.security.BadCredentialsException;
import org.springframework.security.MockAuthenticationEntryPoint;
import org.springframework.security.MockPortResolver;
import org.springframework.security.context.SecurityContextHolder;
import org.springframework.security.providers.anonymous.AnonymousAuthenticationToken;
import org.springframework.security.ui.savedrequest.SavedRequest;
import org.springframework.security.providers.AnonymousAuthenticationToken;
import org.springframework.security.util.AuthorityUtils;
import org.springframework.security.web.AccessDeniedHandlerImpl;
import org.springframework.security.web.ExceptionTranslationFilter;
import org.springframework.security.web.savedrequest.SavedRequest;
/**
* Tests {@link ExceptionTranslationFilter}.

View File

@@ -13,14 +13,14 @@
* limitations under the License.
*/
package org.springframework.security.util;
package org.springframework.security.web;
import junit.framework.TestCase;
import java.util.HashMap;
import java.util.Map;
import org.springframework.security.web.util.PortMapperImpl;
import org.springframework.security.web.PortMapperImpl;
/**

View File

@@ -13,13 +13,13 @@
* limitations under the License.
*/
package org.springframework.security.util;
package org.springframework.security.web;
import junit.framework.TestCase;
import org.springframework.mock.web.MockHttpServletRequest;
import org.springframework.security.web.util.PortMapperImpl;
import org.springframework.security.web.util.PortResolverImpl;
import org.springframework.security.web.PortMapperImpl;
import org.springframework.security.web.PortResolverImpl;
/**

View File

@@ -1,4 +1,4 @@
package org.springframework.security.ui;
package org.springframework.security.web;
import static org.junit.Assert.*;
@@ -10,8 +10,9 @@ import org.springframework.mock.web.MockFilterChain;
import org.springframework.mock.web.MockHttpServletRequest;
import org.springframework.mock.web.MockHttpServletResponse;
import org.springframework.security.context.SecurityContextHolder;
import org.springframework.security.context.web.HttpSessionSecurityContextRepository;
import org.springframework.security.providers.TestingAuthenticationToken;
import org.springframework.security.web.SessionFixationProtectionFilter;
import org.springframework.security.web.context.HttpSessionSecurityContextRepository;
/**
*

View File

@@ -13,7 +13,7 @@
* limitations under the License.
*/
package org.springframework.security.ui;
package org.springframework.security.web.authentication;
import java.io.IOException;
import java.util.Properties;
@@ -40,11 +40,15 @@ import org.springframework.security.BadCredentialsException;
import org.springframework.security.MockAuthenticationManager;
import org.springframework.security.context.SecurityContextHolder;
import org.springframework.security.providers.UsernamePasswordAuthenticationToken;
import org.springframework.security.ui.rememberme.NullRememberMeServices;
import org.springframework.security.ui.rememberme.TokenBasedRememberMeServices;
import org.springframework.security.ui.savedrequest.SavedRequest;
import org.springframework.security.util.AuthorityUtils;
import org.springframework.security.web.util.PortResolverImpl;
import org.springframework.security.web.PortResolverImpl;
import org.springframework.security.web.authentication.AbstractProcessingFilter;
import org.springframework.security.web.authentication.ExceptionMappingAuthenticationFailureHandler;
import org.springframework.security.web.authentication.SavedRequestAwareAuthenticationSuccessHandler;
import org.springframework.security.web.authentication.SimpleUrlAuthenticationFailureHandler;
import org.springframework.security.web.authentication.rememberme.NullRememberMeServices;
import org.springframework.security.web.authentication.rememberme.TokenBasedRememberMeServices;
import org.springframework.security.web.savedrequest.SavedRequest;
/**
@@ -333,9 +337,7 @@ public class AbstractProcessingFilterTests extends TestCase {
MockAbstractProcessingFilter filter = new MockAbstractProcessingFilter(true);
filter.setFilterProcessesUrl("/j_mock_post");
successHandler.setDefaultTargetUrl("/foobar");
assertFalse(successHandler.isAlwaysUseDefaultTargetUrl()); // check default
successHandler.setAlwaysUseDefaultTargetUrl(true);
assertTrue(successHandler.isAlwaysUseDefaultTargetUrl()); // check changed
filter.setAuthenticationSuccessHandler(successHandler);
// Test

View File

@@ -13,7 +13,7 @@
* limitations under the License.
*/
package org.springframework.security.ui;
package org.springframework.security.web.authentication;
import junit.framework.TestCase;
@@ -26,8 +26,8 @@ import org.springframework.security.context.SecurityContextHolder;
import org.springframework.security.providers.TestingAuthenticationToken;
import org.springframework.security.ui.anonymous.AnonymousProcessingFilter;
import org.springframework.security.userdetails.memory.UserAttribute;
import org.springframework.security.web.authentication.AnonymousProcessingFilter;
import org.springframework.mock.web.MockHttpServletRequest;
import org.springframework.mock.web.MockHttpServletResponse;

View File

@@ -13,13 +13,14 @@
* limitations under the License.
*/
package org.springframework.security.ui.webapp;
package org.springframework.security.web.authentication;
import junit.framework.TestCase;
import org.springframework.security.MockPortResolver;
import org.springframework.security.web.util.PortMapperImpl;
import org.springframework.security.web.PortMapperImpl;
import org.springframework.security.web.authentication.AuthenticationProcessingFilterEntryPoint;
import org.springframework.mock.web.MockHttpServletRequest;
import org.springframework.mock.web.MockHttpServletResponse;

View File

@@ -13,7 +13,7 @@
* limitations under the License.
*/
package org.springframework.security.ui.webapp;
package org.springframework.security.web.authentication;
import javax.servlet.ServletException;
@@ -25,7 +25,8 @@ import org.springframework.mock.web.MockHttpServletResponse;
import org.springframework.security.Authentication;
import org.springframework.security.AuthenticationException;
import org.springframework.security.MockAuthenticationManager;
import org.springframework.security.ui.WebAuthenticationDetails;
import org.springframework.security.web.WebAuthenticationDetails;
import org.springframework.security.web.authentication.AuthenticationProcessingFilter;
/**

View File

@@ -1,4 +1,4 @@
package org.springframework.security.ui.webapp;
package org.springframework.security.web.authentication;
import static org.mockito.Mockito.mock;
@@ -11,8 +11,10 @@ import org.springframework.mock.web.MockHttpServletRequest;
import org.springframework.mock.web.MockHttpServletResponse;
import org.springframework.security.Authentication;
import org.springframework.security.AuthenticationException;
import org.springframework.security.ui.AbstractProcessingFilter;
import org.springframework.security.ui.FilterChainOrder;
import org.springframework.security.web.FilterChainOrder;
import org.springframework.security.web.authentication.AbstractProcessingFilter;
import org.springframework.security.web.authentication.AuthenticationProcessingFilter;
import org.springframework.security.web.authentication.DefaultLoginPageGeneratingFilter;
/**
*

View File

@@ -1,8 +1,9 @@
package org.springframework.security.ui;
package org.springframework.security.web.authentication;
import static org.junit.Assert.*;
import org.junit.Test;
import org.springframework.security.web.authentication.SavedRequestAwareAuthenticationSuccessHandler;
public class SavedRequestAwareAuthenticationSuccessHandlerTests {

View File

@@ -1,4 +1,4 @@
package org.springframework.security.ui.preauth;
package org.springframework.security.web.authentication.preauth;
import static org.junit.Assert.assertNull;
import static org.mockito.Mockito.mock;
@@ -13,6 +13,7 @@ import org.springframework.mock.web.MockHttpServletResponse;
import org.springframework.security.BadCredentialsException;
import org.springframework.security.MockAuthenticationManager;
import org.springframework.security.context.SecurityContextHolder;
import org.springframework.security.web.authentication.preauth.AbstractPreAuthenticatedProcessingFilter;
public class AbstractPreAuthenticatedProcessingFilterTests {
private AbstractPreAuthenticatedProcessingFilter filter;

View File

@@ -1,4 +1,4 @@
package org.springframework.security.ui.preauth;
package org.springframework.security.web.authentication.preauth;
import static org.junit.Assert.assertTrue;
@@ -13,6 +13,7 @@ import org.junit.Test;
import org.springframework.mock.web.MockHttpServletRequest;
import org.springframework.security.GrantedAuthority;
import org.springframework.security.util.AuthorityUtils;
import org.springframework.security.web.authentication.preauth.PreAuthenticatedGrantedAuthoritiesWebAuthenticationDetails;
/**
* @author TSARDD

View File

@@ -1,6 +1,7 @@
package org.springframework.security.ui.preauth;
package org.springframework.security.web.authentication.preauth;
import org.springframework.security.AuthenticationCredentialsNotFoundException;
import org.springframework.security.web.authentication.preauth.PreAuthenticatedProcessingFilterEntryPoint;
import java.io.IOException;

View File

@@ -1,8 +1,9 @@
package org.springframework.security.ui.preauth;
package org.springframework.security.web.authentication.preauth;
import org.springframework.security.context.SecurityContextHolder;
import org.springframework.security.MockAuthenticationManager;
import org.springframework.security.ui.FilterChainOrder;
import org.springframework.security.web.FilterChainOrder;
import org.springframework.security.web.authentication.preauth.AbstractPreAuthenticatedProcessingFilter;
import javax.servlet.http.HttpServletRequest;

View File

@@ -1,4 +1,4 @@
package org.springframework.security.ui.preauth.header;
package org.springframework.security.web.authentication.preauth.header;
import static org.junit.Assert.*;
@@ -10,7 +10,8 @@ import org.springframework.mock.web.MockHttpServletRequest;
import org.springframework.mock.web.MockHttpServletResponse;
import org.springframework.security.MockAuthenticationManager;
import org.springframework.security.context.SecurityContextHolder;
import org.springframework.security.ui.preauth.PreAuthenticatedCredentialsNotFoundException;
import org.springframework.security.web.authentication.preauth.PreAuthenticatedCredentialsNotFoundException;
import org.springframework.security.web.authentication.preauth.RequestHeaderPreAuthenticatedProcessingFilter;
/**
*

View File

@@ -1,4 +1,4 @@
package org.springframework.security.ui.preauth.j2ee;
package org.springframework.security.web.authentication.preauth.j2ee;
import java.util.Arrays;
import java.util.Collection;
@@ -14,7 +14,8 @@ import org.springframework.security.authoritymapping.MappableAttributesRetriever
import org.springframework.security.authoritymapping.Attributes2GrantedAuthoritiesMapper;
import org.springframework.security.authoritymapping.SimpleMappableAttributesRetriever;
import org.springframework.security.authoritymapping.SimpleAttributes2GrantedAuthoritiesMapper;
import org.springframework.security.ui.preauth.PreAuthenticatedGrantedAuthoritiesWebAuthenticationDetails;
import org.springframework.security.web.authentication.preauth.PreAuthenticatedGrantedAuthoritiesWebAuthenticationDetails;
import org.springframework.security.web.authentication.preauth.j2ee.J2eeBasedPreAuthenticatedWebAuthenticationDetailsSource;
import org.springframework.security.GrantedAuthority;
import org.springframework.mock.web.MockHttpServletRequest;

View File

@@ -1,4 +1,4 @@
package org.springframework.security.ui.preauth.j2ee;
package org.springframework.security.web.authentication.preauth.j2ee;
import java.security.Principal;
import java.util.Arrays;
@@ -10,6 +10,7 @@ import javax.servlet.http.HttpServletRequest;
import junit.framework.TestCase;
import org.springframework.mock.web.MockHttpServletRequest;
import org.springframework.security.web.authentication.preauth.j2ee.J2eePreAuthenticatedProcessingFilter;
/**
*

View File

@@ -1,10 +1,12 @@
package org.springframework.security.ui.preauth.j2ee;
package org.springframework.security.web.authentication.preauth.j2ee;
import java.io.InputStream;
import java.util.Arrays;
import java.util.List;
import java.util.Set;
import org.springframework.security.web.authentication.preauth.j2ee.WebXmlMappableAttributesRetriever;
import junit.framework.TestCase;
public class WebXmlJ2eeDefinedRolesRetrieverTests extends TestCase {

View File

@@ -1,7 +1,8 @@
package org.springframework.security.ui.preauth.x509;
package org.springframework.security.web.authentication.preauth.x509;
import org.springframework.security.SpringSecurityMessageSource;
import org.springframework.security.BadCredentialsException;
import org.springframework.security.web.authentication.preauth.x509.SubjectDnX509PrincipalExtractor;
import org.junit.Test;
import org.junit.Before;

View File

@@ -13,7 +13,7 @@
* limitations under the License.
*/
package org.springframework.security.ui.preauth.x509;
package org.springframework.security.web.authentication.preauth.x509;
import java.io.ByteArrayInputStream;

View File

@@ -1,4 +1,4 @@
package org.springframework.security.ui.rememberme;
package org.springframework.security.web.authentication.rememberme;
import static org.junit.Assert.*;
@@ -16,6 +16,10 @@ import org.springframework.security.userdetails.UserDetails;
import org.springframework.security.userdetails.UserDetailsService;
import org.springframework.security.userdetails.UsernameNotFoundException;
import org.springframework.security.util.AuthorityUtils;
import org.springframework.security.web.authentication.rememberme.AbstractRememberMeServices;
import org.springframework.security.web.authentication.rememberme.CookieTheftException;
import org.springframework.security.web.authentication.rememberme.InvalidCookieException;
import org.springframework.security.web.authentication.rememberme.RememberMeAuthenticationException;
import org.springframework.util.StringUtils;
/**

View File

@@ -1,6 +1,8 @@
package org.springframework.security.ui.rememberme;
package org.springframework.security.web.authentication.rememberme;
import org.springframework.security.TestDataSource;
import org.springframework.security.web.authentication.rememberme.JdbcTokenRepositoryImpl;
import org.springframework.security.web.authentication.rememberme.PersistentRememberMeToken;
import org.springframework.jdbc.core.JdbcTemplate;
import org.junit.After;

View File

@@ -13,34 +13,22 @@
* limitations under the License.
*/
package org.springframework.security.ui.rememberme;
package org.springframework.security.web.authentication.rememberme;
import org.springframework.security.web.authentication.rememberme.NullRememberMeServices;
import junit.framework.TestCase;
/**
* Tests {@link org.springframework.security.ui.rememberme.NullRememberMeServices}.
* Tests {@link org.springframework.security.web.authentication.rememberme.NullRememberMeServices}.
*
* @author Ben Alex
* @version $Id$
*/
public class NullRememberMeServicesTests extends TestCase {
//~ Constructors ===================================================================================================
public NullRememberMeServicesTests() {
super();
}
public NullRememberMeServicesTests(String arg0) {
super(arg0);
}
//~ Methods ========================================================================================================
public static void main(String[] args) {
junit.textui.TestRunner.run(NullRememberMeServicesTests.class);
}
public void testAlwaysReturnsNull() {
NullRememberMeServices services = new NullRememberMeServices();
assertNull(services.autoLogin(null, null));

View File

@@ -1,4 +1,4 @@
package org.springframework.security.ui.rememberme;
package org.springframework.security.web.authentication.rememberme;
import static org.junit.Assert.*;
@@ -12,6 +12,12 @@ import org.springframework.mock.web.MockHttpServletRequest;
import org.springframework.mock.web.MockHttpServletResponse;
import org.springframework.security.providers.TestingAuthenticationToken;
import org.springframework.security.providers.UsernamePasswordAuthenticationToken;
import org.springframework.security.web.authentication.rememberme.CookieTheftException;
import org.springframework.security.web.authentication.rememberme.InvalidCookieException;
import org.springframework.security.web.authentication.rememberme.PersistentRememberMeToken;
import org.springframework.security.web.authentication.rememberme.PersistentTokenBasedRememberMeServices;
import org.springframework.security.web.authentication.rememberme.PersistentTokenRepository;
import org.springframework.security.web.authentication.rememberme.RememberMeAuthenticationException;
/**
* @author Luke Taylor

View File

@@ -13,7 +13,7 @@
* limitations under the License.
*/
package org.springframework.security.ui.rememberme;
package org.springframework.security.web.authentication.rememberme;
import java.io.IOException;
@@ -37,6 +37,10 @@ import org.springframework.security.MockAuthenticationManager;
import org.springframework.security.MockFilterConfig;
import org.springframework.security.context.SecurityContextHolder;
import org.springframework.security.providers.TestingAuthenticationToken;
import org.springframework.security.web.authentication.rememberme.NullRememberMeServices;
import org.springframework.security.web.authentication.rememberme.RememberMeProcessingFilter;
import org.springframework.security.web.authentication.rememberme.RememberMeServices;
import org.springframework.security.web.authentication.rememberme.TokenBasedRememberMeServices;
/**

View File

@@ -13,10 +13,10 @@
* limitations under the License.
*/
package org.springframework.security.ui.rememberme;
package org.springframework.security.web.authentication.rememberme;
import static org.junit.Assert.*;
import static org.springframework.security.ui.rememberme.TokenBasedRememberMeServices.*;
import static org.springframework.security.web.authentication.rememberme.TokenBasedRememberMeServices.*;
import java.util.Date;
@@ -38,10 +38,11 @@ import org.springframework.security.userdetails.UserDetails;
import org.springframework.security.userdetails.UserDetailsService;
import org.springframework.security.userdetails.UsernameNotFoundException;
import org.springframework.security.util.AuthorityUtils;
import org.springframework.security.web.authentication.rememberme.TokenBasedRememberMeServices;
import org.springframework.util.StringUtils;
/**
* Tests {@link org.springframework.security.ui.rememberme.TokenBasedRememberMeServices}.
* Tests {@link org.springframework.security.web.authentication.rememberme.TokenBasedRememberMeServices}.
*
* @author Ben Alex
* @version $Id$

View File

@@ -13,7 +13,7 @@
* limitations under the License.
*/
package org.springframework.security.ui.switchuser;
package org.springframework.security.web.authentication.switchuser;
import static org.junit.Assert.*;
import static org.mockito.Mockito.*;
@@ -37,17 +37,20 @@ import org.springframework.security.GrantedAuthority;
import org.springframework.security.GrantedAuthorityImpl;
import org.springframework.security.context.SecurityContextHolder;
import org.springframework.security.providers.UsernamePasswordAuthenticationToken;
import org.springframework.security.ui.SimpleUrlAuthenticationSuccessHandler;
import org.springframework.security.userdetails.User;
import org.springframework.security.userdetails.UserDetails;
import org.springframework.security.userdetails.UserDetailsService;
import org.springframework.security.userdetails.UsernameNotFoundException;
import org.springframework.security.util.AuthorityUtils;
import org.springframework.security.util.FieldUtils;
import org.springframework.security.web.authentication.SimpleUrlAuthenticationSuccessHandler;
import org.springframework.security.web.authentication.switchuser.SwitchUserAuthorityChanger;
import org.springframework.security.web.authentication.switchuser.SwitchUserGrantedAuthority;
import org.springframework.security.web.authentication.switchuser.SwitchUserProcessingFilter;
/**
* Tests {@link org.springframework.security.ui.switchuser.SwitchUserProcessingFilter}.
* Tests {@link org.springframework.security.web.authentication.switchuser.SwitchUserProcessingFilter}.
*
* @author Mark St.Godard
* @author Luke Taylor

View File

@@ -13,11 +13,12 @@
* limitations under the License.
*/
package org.springframework.security.ui.basicauth;
package org.springframework.security.web.authentication.www;
import junit.framework.TestCase;
import org.springframework.security.DisabledException;
import org.springframework.security.web.authentication.www.BasicProcessingFilterEntryPoint;
import org.springframework.mock.web.MockHttpServletRequest;
import org.springframework.mock.web.MockHttpServletResponse;

View File

@@ -13,7 +13,7 @@
* limitations under the License.
*/
package org.springframework.security.ui.basicauth;
package org.springframework.security.web.authentication.www;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertFalse;
@@ -49,6 +49,8 @@ import org.springframework.security.MockFilterConfig;
import org.springframework.security.context.SecurityContextHolder;
import org.springframework.security.providers.UsernamePasswordAuthenticationToken;
import org.springframework.security.util.AuthorityUtils;
import org.springframework.security.web.authentication.www.BasicProcessingFilter;
import org.springframework.security.web.authentication.www.BasicProcessingFilterEntryPoint;
/**

View File

@@ -13,13 +13,15 @@
* limitations under the License.
*/
package org.springframework.security.ui.digestauth;
package org.springframework.security.web.authentication.www;
import junit.framework.TestCase;
import org.springframework.security.DisabledException;
import org.springframework.security.util.StringSplitUtils;
import org.springframework.security.web.authentication.www.DigestProcessingFilterEntryPoint;
import org.springframework.security.web.authentication.www.NonceExpiredException;
import org.apache.commons.codec.binary.Base64;
import org.apache.commons.codec.digest.DigestUtils;

View File

@@ -13,7 +13,7 @@
* limitations under the License.
*/
package org.springframework.security.ui.digestauth;
package org.springframework.security.web.authentication.www;
import static org.junit.Assert.*;
@@ -27,14 +27,16 @@ import org.springframework.security.MockFilterConfig;
import org.springframework.security.context.SecurityContextHolder;
import org.springframework.security.providers.dao.cache.NullUserCache;
import org.springframework.security.userdetails.UserDetails;
import org.springframework.security.userdetails.cache.NullUserCache;
import org.springframework.security.userdetails.memory.InMemoryDaoImpl;
import org.springframework.security.userdetails.memory.UserMap;
import org.springframework.security.userdetails.memory.UserMapEditor;
import org.springframework.security.util.StringSplitUtils;
import org.springframework.security.web.authentication.www.DigestProcessingFilter;
import org.springframework.security.web.authentication.www.DigestProcessingFilterEntryPoint;
import org.apache.commons.codec.binary.Base64;
import org.apache.commons.codec.digest.DigestUtils;

View File

@@ -13,15 +13,19 @@
* limitations under the License.
*/
package org.springframework.security.concurrent;
package org.springframework.security.web.concurrent;
import junit.framework.TestCase;
import org.springframework.security.Authentication;
import org.springframework.security.concurrent.ConcurrentLoginException;
import org.springframework.security.concurrent.ConcurrentSessionControllerImpl;
import org.springframework.security.concurrent.SessionRegistry;
import org.springframework.security.providers.UsernamePasswordAuthenticationToken;
import org.springframework.security.ui.WebAuthenticationDetails;
import org.springframework.security.web.WebAuthenticationDetails;
import org.springframework.security.web.concurrent.SessionRegistryImpl;
import org.springframework.mock.web.MockHttpServletRequest;
import org.springframework.mock.web.MockHttpSession;

View File

@@ -13,13 +13,16 @@
* limitations under the License.
*/
package org.springframework.security.concurrent;
package org.springframework.security.web.concurrent;
import junit.framework.TestCase;
import org.springframework.mock.web.MockFilterConfig;
import org.springframework.mock.web.MockHttpServletRequest;
import org.springframework.mock.web.MockHttpServletResponse;
import org.springframework.mock.web.MockHttpSession;
import org.springframework.security.concurrent.SessionRegistry;
import org.springframework.security.web.concurrent.ConcurrentSessionFilter;
import org.springframework.security.web.concurrent.SessionRegistryImpl;
import javax.servlet.Filter;
import javax.servlet.FilterChain;

View File

@@ -13,12 +13,14 @@
* limitations under the License.
*/
package org.springframework.security.concurrent;
package org.springframework.security.web.concurrent;
import junit.framework.TestCase;
import java.util.Date;
import org.springframework.security.concurrent.SessionInformation;
/**
* Tests {@link SessionInformation}.

View File

@@ -13,11 +13,13 @@
* limitations under the License.
*/
package org.springframework.security.concurrent;
package org.springframework.security.web.concurrent;
import junit.framework.TestCase;
import org.springframework.security.ui.session.HttpSessionDestroyedEvent;
import org.springframework.security.concurrent.SessionInformation;
import org.springframework.security.web.concurrent.SessionRegistryImpl;
import org.springframework.security.web.session.HttpSessionDestroyedEvent;
import org.springframework.mock.web.MockHttpSession;

View File

@@ -13,7 +13,7 @@
* limitations under the License.
*/
package org.springframework.security.context.web;
package org.springframework.security.web.context;
import junit.framework.TestCase;
@@ -24,6 +24,7 @@ import org.springframework.security.context.SecurityContextHolder;
import org.springframework.security.context.SecurityContextImpl;
import org.springframework.security.providers.UsernamePasswordAuthenticationToken;
import org.springframework.security.util.AuthorityUtils;
import org.springframework.security.web.context.HttpSessionContextIntegrationFilter;
import org.springframework.mock.web.MockHttpServletRequest;
import org.springframework.mock.web.MockHttpServletResponse;

View File

@@ -1,4 +1,4 @@
package org.springframework.security.context.web;
package org.springframework.security.web.context;
import static org.junit.Assert.*;
@@ -9,6 +9,9 @@ import org.springframework.security.Authentication;
import org.springframework.security.context.SecurityContext;
import org.springframework.security.context.SecurityContextHolder;
import org.springframework.security.providers.TestingAuthenticationToken;
import org.springframework.security.web.context.HttpRequestResponseHolder;
import org.springframework.security.web.context.HttpSessionSecurityContextRepository;
import org.springframework.security.web.context.SaveContextOnUpdateOrErrorResponseWrapper;
public class HttpSessionSecurityContextRepositoryTests {
private final TestingAuthenticationToken testToken = new TestingAuthenticationToken("someone", "passwd", "ROLE_A");

View File

@@ -1,4 +1,4 @@
package org.springframework.security.context.web;
package org.springframework.security.web.context;
import static org.junit.Assert.*;
@@ -22,7 +22,10 @@ import org.springframework.security.context.SecurityContext;
import org.springframework.security.context.SecurityContextHolder;
import org.springframework.security.context.SecurityContextImpl;
import org.springframework.security.providers.TestingAuthenticationToken;
import org.springframework.security.ui.FilterChainOrder;
import org.springframework.security.web.FilterChainOrder;
import org.springframework.security.web.context.HttpRequestResponseHolder;
import org.springframework.security.web.context.SecurityContextPersistenceFilter;
import org.springframework.security.web.context.SecurityContextRepository;
public class SecurityContextPersistenceFilterTests {
Mockery jmock = new JUnit4Mockery();

View File

@@ -1,4 +1,4 @@
package org.springframework.security.expression.web.support;
package org.springframework.security.web.expression;
import static org.junit.Assert.*;
@@ -7,7 +7,7 @@ import org.jmock.integration.junit4.JUnit4Mockery;
import org.junit.Test;
import org.springframework.mock.web.MockHttpServletRequest;
import org.springframework.security.Authentication;
import org.springframework.security.intercept.web.FilterInvocation;
import org.springframework.security.web.intercept.FilterInvocation;
import org.springframework.security.web.util.FilterInvocationUtils;
/**

View File

@@ -13,7 +13,7 @@
* limitations under the License.
*/
package org.springframework.security.intercept.web;
package org.springframework.security.web.intercept;
import static org.junit.Assert.*;
import static org.mockito.Mockito.mock;
@@ -29,6 +29,9 @@ import org.springframework.mock.web.MockHttpServletResponse;
import org.springframework.security.ConfigAttribute;
import org.springframework.security.SecurityConfig;
import org.springframework.security.util.AntUrlPathMatcher;
import org.springframework.security.web.intercept.DefaultFilterInvocationSecurityMetadataSource;
import org.springframework.security.web.intercept.FilterInvocation;
import org.springframework.security.web.intercept.RequestKey;
/**
* Tests parts of {@link DefaultFilterInvocationSecurityMetadataSource} not tested by {@link

View File

@@ -13,7 +13,7 @@
* limitations under the License.
*/
package org.springframework.security.intercept.web;
package org.springframework.security.web.intercept;
import static org.junit.Assert.assertEquals;
import static org.mockito.Mockito.mock;
@@ -23,6 +23,7 @@ import javax.servlet.FilterChain;
import org.junit.Test;
import org.springframework.mock.web.MockHttpServletRequest;
import org.springframework.mock.web.MockHttpServletResponse;
import org.springframework.security.web.intercept.FilterInvocation;
/**
* Tests {@link FilterInvocation}.

View File

@@ -13,7 +13,7 @@
* limitations under the License.
*/
package org.springframework.security.intercept.web;
package org.springframework.security.web.intercept;
import java.util.List;
@@ -36,6 +36,9 @@ import org.springframework.security.RunAsManager;
import org.springframework.security.SecurityConfig;
import org.springframework.security.context.SecurityContextHolder;
import org.springframework.security.providers.TestingAuthenticationToken;
import org.springframework.security.web.intercept.FilterInvocation;
import org.springframework.security.web.intercept.FilterInvocationSecurityMetadataSource;
import org.springframework.security.web.intercept.FilterSecurityInterceptor;
/**

View File

@@ -1,8 +1,9 @@
package org.springframework.security.intercept.web;
package org.springframework.security.web.intercept;
import static org.junit.Assert.*;
import org.junit.Test;
import org.springframework.security.web.intercept.RequestKey;
/**
*

View File

@@ -13,7 +13,7 @@
* limitations under the License.
*/
package org.springframework.security.intercept.web;
package org.springframework.security.web.intercept;
import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertTrue;
@@ -35,11 +35,15 @@ import org.springframework.security.MockApplicationEventPublisher;
import org.springframework.security.RunAsManager;
import org.springframework.security.context.SecurityContextHolder;
import org.springframework.security.providers.TestingAuthenticationToken;
import org.springframework.security.web.intercept.FilterInvocation;
import org.springframework.security.web.intercept.FilterInvocationSecurityMetadataSource;
import org.springframework.security.web.intercept.FilterSecurityInterceptor;
import org.springframework.security.web.intercept.WebInvocationPrivilegeEvaluator;
import org.springframework.security.web.util.FilterInvocationUtils;
/**
* Tests {@link org.springframework.security.intercept.web.WebInvocationPrivilegeEvaluator}.
* Tests {@link org.springframework.security.web.intercept.WebInvocationPrivilegeEvaluator}.
*
* @author Ben Alex
* @version $Id$

View File

@@ -1,9 +1,11 @@
package org.springframework.security.ui.logout;
package org.springframework.security.web.logout;
import junit.framework.TestCase;
import org.springframework.mock.web.MockHttpServletRequest;
import org.springframework.mock.web.MockHttpServletResponse;
import org.springframework.security.web.logout.LogoutFilter;
import org.springframework.security.web.logout.SecurityContextLogoutHandler;
/**
* @author Luke Taylor

View File

@@ -1,8 +1,11 @@
package org.springframework.security.ui.savedrequest;
package org.springframework.security.web.savedrequest;
import junit.framework.TestCase;
import javax.servlet.http.Cookie;
import org.springframework.security.web.savedrequest.SavedCookie;
import java.io.Serializable;
public class SavedCookieTests extends TestCase {

View File

@@ -1,7 +1,8 @@
package org.springframework.security.ui.savedrequest;
package org.springframework.security.web.savedrequest;
import junit.framework.TestCase;
import org.springframework.security.MockPortResolver;
import org.springframework.security.web.savedrequest.SavedRequest;
import org.springframework.mock.web.MockHttpServletRequest;
public class SavedRequestTests extends TestCase {

View File

@@ -13,7 +13,7 @@
* limitations under the License.
*/
package org.springframework.security.securechannel;
package org.springframework.security.web.securechannel;
import static org.mockito.Mockito.mock;
@@ -31,7 +31,9 @@ import org.springframework.mock.web.MockHttpServletRequest;
import org.springframework.mock.web.MockHttpServletResponse;
import org.springframework.security.ConfigAttribute;
import org.springframework.security.SecurityConfig;
import org.springframework.security.intercept.web.FilterInvocation;
import org.springframework.security.web.intercept.FilterInvocation;
import org.springframework.security.web.securechannel.ChannelDecisionManagerImpl;
import org.springframework.security.web.securechannel.ChannelProcessor;
/**

View File

@@ -13,7 +13,7 @@
* limitations under the License.
*/
package org.springframework.security.securechannel;
package org.springframework.security.web.securechannel;
import static org.junit.Assert.assertTrue;
import static org.mockito.Mockito.mock;
@@ -30,8 +30,10 @@ import org.springframework.mock.web.MockHttpServletRequest;
import org.springframework.mock.web.MockHttpServletResponse;
import org.springframework.security.ConfigAttribute;
import org.springframework.security.SecurityConfig;
import org.springframework.security.intercept.web.FilterInvocation;
import org.springframework.security.intercept.web.FilterInvocationSecurityMetadataSource;
import org.springframework.security.web.intercept.FilterInvocation;
import org.springframework.security.web.intercept.FilterInvocationSecurityMetadataSource;
import org.springframework.security.web.securechannel.ChannelDecisionManager;
import org.springframework.security.web.securechannel.ChannelProcessingFilter;
/**

View File

@@ -13,7 +13,7 @@
* limitations under the License.
*/
package org.springframework.security.securechannel;
package org.springframework.security.web.securechannel;
import static org.mockito.Mockito.mock;
@@ -24,7 +24,8 @@ import junit.framework.TestCase;
import org.springframework.mock.web.MockHttpServletRequest;
import org.springframework.mock.web.MockHttpServletResponse;
import org.springframework.security.SecurityConfig;
import org.springframework.security.intercept.web.FilterInvocation;
import org.springframework.security.web.intercept.FilterInvocation;
import org.springframework.security.web.securechannel.InsecureChannelProcessor;
/**

View File

@@ -13,13 +13,14 @@
* limitations under the License.
*/
package org.springframework.security.securechannel;
package org.springframework.security.web.securechannel;
import junit.framework.TestCase;
import org.springframework.security.MockPortResolver;
import org.springframework.security.web.util.PortMapperImpl;
import org.springframework.security.web.PortMapperImpl;
import org.springframework.security.web.securechannel.RetryWithHttpEntryPoint;
import org.springframework.mock.web.MockHttpServletRequest;
import org.springframework.mock.web.MockHttpServletResponse;

View File

@@ -13,13 +13,14 @@
* limitations under the License.
*/
package org.springframework.security.securechannel;
package org.springframework.security.web.securechannel;
import junit.framework.TestCase;
import org.springframework.security.MockPortResolver;
import org.springframework.security.web.util.PortMapperImpl;
import org.springframework.security.web.PortMapperImpl;
import org.springframework.security.web.securechannel.RetryWithHttpsEntryPoint;
import org.springframework.mock.web.MockHttpServletRequest;
import org.springframework.mock.web.MockHttpServletResponse;

View File

@@ -13,7 +13,7 @@
* limitations under the License.
*/
package org.springframework.security.securechannel;
package org.springframework.security.web.securechannel;
import static org.mockito.Mockito.mock;
@@ -24,7 +24,8 @@ import junit.framework.TestCase;
import org.springframework.mock.web.MockHttpServletRequest;
import org.springframework.mock.web.MockHttpServletResponse;
import org.springframework.security.SecurityConfig;
import org.springframework.security.intercept.web.FilterInvocation;
import org.springframework.security.web.intercept.FilterInvocation;
import org.springframework.security.web.securechannel.SecureChannelProcessor;
/**

View File

@@ -13,7 +13,7 @@
* limitations under the License.
*/
package org.springframework.security.ui.session;
package org.springframework.security.web.session;
import static org.junit.Assert.*;
@@ -22,6 +22,7 @@ import javax.servlet.http.HttpSessionEvent;
import org.junit.Test;
import org.springframework.mock.web.MockHttpSession;
import org.springframework.mock.web.MockServletContext;
import org.springframework.security.web.session.HttpSessionEventPublisher;
import org.springframework.web.context.support.StaticWebApplicationContext;

View File

@@ -13,10 +13,12 @@
* limitations under the License.
*/
package org.springframework.security.ui.session;
package org.springframework.security.web.session;
import org.springframework.context.ApplicationEvent;
import org.springframework.context.ApplicationListener;
import org.springframework.security.web.session.HttpSessionCreatedEvent;
import org.springframework.security.web.session.HttpSessionDestroyedEvent;
/**

View File

@@ -11,9 +11,10 @@ import javax.servlet.http.Cookie;
import org.junit.Test;
import org.springframework.mock.web.MockHttpServletRequest;
import org.springframework.security.ui.savedrequest.FastHttpDateFormat;
import org.springframework.security.ui.savedrequest.SavedRequest;
import org.springframework.security.web.util.PortResolverImpl;
import org.springframework.security.web.PortResolverImpl;
import org.springframework.security.web.savedrequest.FastHttpDateFormat;
import org.springframework.security.web.savedrequest.SavedRequest;
import org.springframework.security.web.wrapper.SavedRequestAwareWrapper;
public class SavedRequestAwareWrapperTests {

View File

@@ -25,7 +25,9 @@ import org.jmock.integration.junit4.JUnit4Mockery;
import org.junit.Test;
import org.springframework.mock.web.MockHttpServletRequest;
import org.springframework.mock.web.MockHttpServletResponse;
import org.springframework.security.web.util.PortResolverImpl;
import org.springframework.security.web.PortResolverImpl;
import org.springframework.security.web.wrapper.SavedRequestAwareWrapper;
import org.springframework.security.web.wrapper.SecurityContextHolderAwareRequestFilter;
/**

View File

@@ -23,7 +23,8 @@ import org.springframework.security.context.SecurityContextHolder;
import org.springframework.security.providers.TestingAuthenticationToken;
import org.springframework.security.userdetails.User;
import org.springframework.security.util.AuthorityUtils;
import org.springframework.security.web.util.PortResolverImpl;
import org.springframework.security.web.PortResolverImpl;
import org.springframework.security.web.wrapper.SecurityContextHolderAwareRequestWrapper;
/**