|
@@ -68,6 +68,7 @@ public class MethodSecurityInterceptorTests extends TestCase {
|
|
|
|
|
|
public final void setUp() throws Exception {
|
|
public final void setUp() throws Exception {
|
|
super.setUp();
|
|
super.setUp();
|
|
|
|
+ SecurityContextHolder.getContext().setAuthentication(null);
|
|
}
|
|
}
|
|
|
|
|
|
public static void main(String[] args) {
|
|
public static void main(String[] args) {
|
|
@@ -79,8 +80,6 @@ public class MethodSecurityInterceptorTests extends TestCase {
|
|
ITargetObject target = makeInterceptedTarget();
|
|
ITargetObject target = makeInterceptedTarget();
|
|
String result = target.publicMakeLowerCase("HELLO");
|
|
String result = target.publicMakeLowerCase("HELLO");
|
|
assertEquals("hello Authentication empty", result);
|
|
assertEquals("hello Authentication empty", result);
|
|
-
|
|
|
|
- SecurityContextHolder.getContext().setAuthentication(null);
|
|
|
|
}
|
|
}
|
|
|
|
|
|
public void testCallingAPublicMethodWhenPresentingAnAuthenticationObjectWillNotChangeItsIsAuthenticatedProperty()
|
|
public void testCallingAPublicMethodWhenPresentingAnAuthenticationObjectWillNotChangeItsIsAuthenticatedProperty()
|
|
@@ -95,8 +94,6 @@ public class MethodSecurityInterceptorTests extends TestCase {
|
|
String result = target.publicMakeLowerCase("HELLO");
|
|
String result = target.publicMakeLowerCase("HELLO");
|
|
assertEquals("hello net.sf.acegisecurity.providers.UsernamePasswordAuthenticationToken false",
|
|
assertEquals("hello net.sf.acegisecurity.providers.UsernamePasswordAuthenticationToken false",
|
|
result);
|
|
result);
|
|
-
|
|
|
|
- SecurityContextHolder.getContext().setAuthentication(null);
|
|
|
|
}
|
|
}
|
|
|
|
|
|
public void testDeniesWhenAppropriate() throws Exception {
|
|
public void testDeniesWhenAppropriate() throws Exception {
|
|
@@ -113,8 +110,6 @@ public class MethodSecurityInterceptorTests extends TestCase {
|
|
} catch (AccessDeniedException expected) {
|
|
} catch (AccessDeniedException expected) {
|
|
assertTrue(true);
|
|
assertTrue(true);
|
|
}
|
|
}
|
|
-
|
|
|
|
- SecurityContextHolder.getContext().setAuthentication(null);
|
|
|
|
}
|
|
}
|
|
|
|
|
|
public void testGetters() {
|
|
public void testGetters() {
|
|
@@ -149,8 +144,6 @@ public class MethodSecurityInterceptorTests extends TestCase {
|
|
String result = target.makeUpperCase("hello");
|
|
String result = target.makeUpperCase("hello");
|
|
assertEquals("HELLO net.sf.acegisecurity.MockRunAsAuthenticationToken true",
|
|
assertEquals("HELLO net.sf.acegisecurity.MockRunAsAuthenticationToken true",
|
|
result);
|
|
result);
|
|
-
|
|
|
|
- SecurityContextHolder.getContext().setAuthentication(null);
|
|
|
|
}
|
|
}
|
|
|
|
|
|
public void testMethodCallWithoutRunAsReplacement()
|
|
public void testMethodCallWithoutRunAsReplacement()
|
|
@@ -167,8 +160,6 @@ public class MethodSecurityInterceptorTests extends TestCase {
|
|
// Note we check the isAuthenticated remained true in following line
|
|
// Note we check the isAuthenticated remained true in following line
|
|
assertEquals("hello net.sf.acegisecurity.providers.UsernamePasswordAuthenticationToken true",
|
|
assertEquals("hello net.sf.acegisecurity.providers.UsernamePasswordAuthenticationToken true",
|
|
result);
|
|
result);
|
|
-
|
|
|
|
- SecurityContextHolder.getContext().setAuthentication(null);
|
|
|
|
}
|
|
}
|
|
|
|
|
|
public void testRejectionOfEmptySecurityContext() throws Exception {
|
|
public void testRejectionOfEmptySecurityContext() throws Exception {
|
|
@@ -216,8 +207,6 @@ public class MethodSecurityInterceptorTests extends TestCase {
|
|
} catch (AuthenticationException expected) {
|
|
} catch (AuthenticationException expected) {
|
|
assertTrue(true);
|
|
assertTrue(true);
|
|
}
|
|
}
|
|
-
|
|
|
|
- SecurityContextHolder.getContext().setAuthentication(null);
|
|
|
|
}
|
|
}
|
|
|
|
|
|
public void testRejectsCallsWhenObjectDefinitionSourceDoesNotSupportObject()
|
|
public void testRejectsCallsWhenObjectDefinitionSourceDoesNotSupportObject()
|