SEC-1125: Further refactoring of web packages following creation of web module. Fixing samples.
This commit is contained in:
+1
-1
@@ -1,4 +1,4 @@
|
||||
package org.springframework.security.ui;
|
||||
package org.springframework.security;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
+1
-1
@@ -13,7 +13,7 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package org.springframework.security.ui;
|
||||
package org.springframework.security;
|
||||
|
||||
|
||||
|
||||
+2
-2
@@ -1,8 +1,8 @@
|
||||
package org.springframework.security.ui;
|
||||
package org.springframework.security;
|
||||
|
||||
import java.lang.reflect.Constructor;
|
||||
|
||||
import org.springframework.security.ui.AuthenticationDetailsSource;
|
||||
import org.springframework.security.AuthenticationDetailsSource;
|
||||
import org.springframework.util.Assert;
|
||||
import org.springframework.util.ReflectionUtils;
|
||||
|
||||
+2
-2
@@ -15,8 +15,8 @@
|
||||
|
||||
package org.springframework.security;
|
||||
|
||||
import org.springframework.security.providers.anonymous.AnonymousAuthenticationToken;
|
||||
import org.springframework.security.providers.rememberme.RememberMeAuthenticationToken;
|
||||
import org.springframework.security.providers.AnonymousAuthenticationToken;
|
||||
import org.springframework.security.providers.RememberMeAuthenticationToken;
|
||||
|
||||
|
||||
/**
|
||||
|
||||
+5
@@ -0,0 +1,5 @@
|
||||
package org.springframework.security.expression.support;
|
||||
|
||||
public class AbstractSecurityExpressionHandler {
|
||||
|
||||
}
|
||||
+1
-2
@@ -13,7 +13,7 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package org.springframework.security.providers.anonymous;
|
||||
package org.springframework.security.providers;
|
||||
|
||||
import org.springframework.beans.factory.InitializingBean;
|
||||
import org.springframework.context.MessageSource;
|
||||
@@ -23,7 +23,6 @@ import org.springframework.security.Authentication;
|
||||
import org.springframework.security.AuthenticationException;
|
||||
import org.springframework.security.BadCredentialsException;
|
||||
import org.springframework.security.SpringSecurityMessageSource;
|
||||
import org.springframework.security.providers.AuthenticationProvider;
|
||||
import org.springframework.util.Assert;
|
||||
|
||||
|
||||
+1
-2
@@ -13,11 +13,10 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package org.springframework.security.providers.anonymous;
|
||||
package org.springframework.security.providers;
|
||||
|
||||
import org.springframework.security.GrantedAuthority;
|
||||
|
||||
import org.springframework.security.providers.AbstractAuthenticationToken;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.Arrays;
|
||||
+1
-2
@@ -13,7 +13,7 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package org.springframework.security.providers.rememberme;
|
||||
package org.springframework.security.providers;
|
||||
|
||||
import org.springframework.beans.factory.InitializingBean;
|
||||
import org.springframework.context.MessageSource;
|
||||
@@ -23,7 +23,6 @@ import org.springframework.security.Authentication;
|
||||
import org.springframework.security.AuthenticationException;
|
||||
import org.springframework.security.BadCredentialsException;
|
||||
import org.springframework.security.SpringSecurityMessageSource;
|
||||
import org.springframework.security.providers.AuthenticationProvider;
|
||||
import org.springframework.util.Assert;
|
||||
|
||||
|
||||
+1
-2
@@ -13,14 +13,13 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package org.springframework.security.providers.rememberme;
|
||||
package org.springframework.security.providers;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
|
||||
import org.springframework.security.GrantedAuthority;
|
||||
import org.springframework.security.providers.AbstractAuthenticationToken;
|
||||
|
||||
|
||||
/**
|
||||
@@ -1,7 +0,0 @@
|
||||
<html>
|
||||
<body>
|
||||
Allows you to secure every invocation (especially useful for web request
|
||||
URI security) by always having either an actual principal or an anonymous
|
||||
principal authenticated.
|
||||
</body>
|
||||
</html>
|
||||
+2
-1
@@ -26,12 +26,13 @@ import org.springframework.security.LockedException;
|
||||
|
||||
import org.springframework.security.providers.AuthenticationProvider;
|
||||
import org.springframework.security.providers.UsernamePasswordAuthenticationToken;
|
||||
import org.springframework.security.providers.dao.cache.NullUserCache;
|
||||
|
||||
import org.springframework.security.userdetails.UserCache;
|
||||
import org.springframework.security.userdetails.UserDetails;
|
||||
import org.springframework.security.userdetails.UserDetailsService;
|
||||
import org.springframework.security.userdetails.UsernameNotFoundException;
|
||||
import org.springframework.security.userdetails.UserDetailsChecker;
|
||||
import org.springframework.security.userdetails.cache.NullUserCache;
|
||||
|
||||
import org.springframework.beans.factory.InitializingBean;
|
||||
|
||||
|
||||
@@ -1,5 +0,0 @@
|
||||
<html>
|
||||
<body>
|
||||
Authentication provider that processes <code>RememberMeAuthenticationToken</code>s.
|
||||
</body>
|
||||
</html>
|
||||
+1
-3
@@ -13,10 +13,8 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package org.springframework.security.providers.dao;
|
||||
package org.springframework.security.userdetails;
|
||||
|
||||
import org.springframework.security.userdetails.User;
|
||||
import org.springframework.security.userdetails.UserDetails;
|
||||
|
||||
|
||||
/**
|
||||
+2
-2
@@ -13,14 +13,14 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package org.springframework.security.providers.dao.cache;
|
||||
package org.springframework.security.userdetails.cache;
|
||||
|
||||
import net.sf.ehcache.CacheException;
|
||||
import net.sf.ehcache.Element;
|
||||
import net.sf.ehcache.Ehcache;
|
||||
|
||||
import org.springframework.security.providers.dao.UserCache;
|
||||
|
||||
import org.springframework.security.userdetails.UserCache;
|
||||
import org.springframework.security.userdetails.UserDetails;
|
||||
|
||||
import org.apache.commons.logging.Log;
|
||||
+2
-2
@@ -13,10 +13,10 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package org.springframework.security.providers.dao.cache;
|
||||
package org.springframework.security.userdetails.cache;
|
||||
|
||||
import org.springframework.security.providers.dao.UserCache;
|
||||
|
||||
import org.springframework.security.userdetails.UserCache;
|
||||
import org.springframework.security.userdetails.UserDetails;
|
||||
|
||||
|
||||
+2
-2
@@ -9,11 +9,11 @@ import org.springframework.security.GrantedAuthorityImpl;
|
||||
import org.springframework.security.util.AuthorityUtils;
|
||||
import org.springframework.security.context.SecurityContextHolder;
|
||||
import org.springframework.security.providers.UsernamePasswordAuthenticationToken;
|
||||
import org.springframework.security.providers.dao.UserCache;
|
||||
import org.springframework.security.providers.dao.cache.NullUserCache;
|
||||
import org.springframework.security.userdetails.UserCache;
|
||||
import org.springframework.security.userdetails.UserDetails;
|
||||
import org.springframework.security.userdetails.UserDetailsManager;
|
||||
import org.springframework.security.userdetails.GroupManager;
|
||||
import org.springframework.security.userdetails.cache.NullUserCache;
|
||||
import org.springframework.context.ApplicationContextException;
|
||||
import org.springframework.dao.IncorrectResultSizeDataAccessException;
|
||||
import org.springframework.jdbc.core.PreparedStatementSetter;
|
||||
|
||||
+54
@@ -0,0 +1,54 @@
|
||||
package org.springframework.security;
|
||||
|
||||
import static org.junit.Assert.*;
|
||||
|
||||
import org.junit.Test;
|
||||
import org.springframework.security.AuthenticationDetails;
|
||||
import org.springframework.security.AuthenticationDetailsSourceImpl;
|
||||
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();
|
||||
}
|
||||
|
||||
}
|
||||
+2
-2
@@ -17,9 +17,9 @@ package org.springframework.security;
|
||||
|
||||
import junit.framework.TestCase;
|
||||
|
||||
import org.springframework.security.providers.AnonymousAuthenticationToken;
|
||||
import org.springframework.security.providers.RememberMeAuthenticationToken;
|
||||
import org.springframework.security.providers.TestingAuthenticationToken;
|
||||
import org.springframework.security.providers.anonymous.AnonymousAuthenticationToken;
|
||||
import org.springframework.security.providers.rememberme.RememberMeAuthenticationToken;
|
||||
import org.springframework.security.util.AuthorityUtils;
|
||||
|
||||
|
||||
|
||||
+2
@@ -22,6 +22,8 @@ import org.springframework.security.BadCredentialsException;
|
||||
import org.springframework.security.GrantedAuthority;
|
||||
import org.springframework.security.GrantedAuthorityImpl;
|
||||
|
||||
import org.springframework.security.providers.AnonymousAuthenticationProvider;
|
||||
import org.springframework.security.providers.AnonymousAuthenticationToken;
|
||||
import org.springframework.security.providers.TestingAuthenticationToken;
|
||||
import org.springframework.security.util.AuthorityUtils;
|
||||
|
||||
|
||||
+1
@@ -20,6 +20,7 @@ import java.util.List;
|
||||
import junit.framework.TestCase;
|
||||
|
||||
import org.springframework.security.GrantedAuthority;
|
||||
import org.springframework.security.providers.AnonymousAuthenticationToken;
|
||||
import org.springframework.security.providers.UsernamePasswordAuthenticationToken;
|
||||
import org.springframework.security.util.AuthorityUtils;
|
||||
|
||||
|
||||
+2
-2
@@ -30,8 +30,6 @@ import org.springframework.security.LockedException;
|
||||
|
||||
import org.springframework.security.providers.TestingAuthenticationToken;
|
||||
import org.springframework.security.providers.UsernamePasswordAuthenticationToken;
|
||||
import org.springframework.security.providers.dao.cache.EhCacheBasedUserCache;
|
||||
import org.springframework.security.providers.dao.cache.NullUserCache;
|
||||
import org.springframework.security.providers.dao.salt.SystemWideSaltSource;
|
||||
import org.springframework.security.providers.encoding.ShaPasswordEncoder;
|
||||
|
||||
@@ -39,6 +37,8 @@ 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.userdetails.cache.EhCacheBasedUserCache;
|
||||
import org.springframework.security.userdetails.cache.NullUserCache;
|
||||
import org.springframework.security.util.AuthorityUtils;
|
||||
|
||||
import org.springframework.dao.DataAccessException;
|
||||
|
||||
@@ -7,6 +7,7 @@ import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
import org.springframework.security.userdetails.User;
|
||||
import org.springframework.security.userdetails.UserCache;
|
||||
import org.springframework.security.userdetails.UserDetails;
|
||||
|
||||
public class MockUserCache implements UserCache {
|
||||
|
||||
Vendored
+1
@@ -25,6 +25,7 @@ import org.junit.AfterClass;
|
||||
import org.junit.BeforeClass;
|
||||
import org.junit.Test;
|
||||
import org.springframework.security.userdetails.User;
|
||||
import org.springframework.security.userdetails.cache.EhCacheBasedUserCache;
|
||||
import org.springframework.security.util.AuthorityUtils;
|
||||
|
||||
/**
|
||||
|
||||
Vendored
+1
@@ -18,6 +18,7 @@ package org.springframework.security.providers.dao.cache;
|
||||
import junit.framework.TestCase;
|
||||
|
||||
import org.springframework.security.userdetails.User;
|
||||
import org.springframework.security.userdetails.cache.NullUserCache;
|
||||
import org.springframework.security.util.AuthorityUtils;
|
||||
|
||||
|
||||
|
||||
+2
@@ -19,6 +19,8 @@ import junit.framework.TestCase;
|
||||
|
||||
import org.springframework.security.Authentication;
|
||||
import org.springframework.security.BadCredentialsException;
|
||||
import org.springframework.security.providers.RememberMeAuthenticationProvider;
|
||||
import org.springframework.security.providers.RememberMeAuthenticationToken;
|
||||
import org.springframework.security.providers.TestingAuthenticationToken;
|
||||
import org.springframework.security.util.AuthorityUtils;
|
||||
|
||||
|
||||
+1
@@ -21,6 +21,7 @@ import java.util.List;
|
||||
import junit.framework.TestCase;
|
||||
|
||||
import org.springframework.security.GrantedAuthority;
|
||||
import org.springframework.security.providers.RememberMeAuthenticationToken;
|
||||
import org.springframework.security.providers.UsernamePasswordAuthenticationToken;
|
||||
import org.springframework.security.util.AuthorityUtils;
|
||||
|
||||
|
||||
+1
-1
@@ -26,8 +26,8 @@ import org.springframework.security.PopulatedDatabase;
|
||||
import org.springframework.security.TestDataSource;
|
||||
import org.springframework.security.context.SecurityContextHolder;
|
||||
import org.springframework.security.providers.UsernamePasswordAuthenticationToken;
|
||||
import org.springframework.security.providers.dao.UserCache;
|
||||
import org.springframework.security.userdetails.User;
|
||||
import org.springframework.security.userdetails.UserCache;
|
||||
import org.springframework.security.userdetails.UserDetails;
|
||||
import org.springframework.security.util.AuthorityUtils;
|
||||
|
||||
|
||||
@@ -22,9 +22,9 @@ import junit.framework.TestCase;
|
||||
import org.springframework.security.Authentication;
|
||||
import org.springframework.security.ConfigAttribute;
|
||||
import org.springframework.security.SecurityConfig;
|
||||
import org.springframework.security.providers.AnonymousAuthenticationToken;
|
||||
import org.springframework.security.providers.RememberMeAuthenticationToken;
|
||||
import org.springframework.security.providers.UsernamePasswordAuthenticationToken;
|
||||
import org.springframework.security.providers.anonymous.AnonymousAuthenticationToken;
|
||||
import org.springframework.security.providers.rememberme.RememberMeAuthenticationToken;
|
||||
import org.springframework.security.util.AuthorityUtils;
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user