mirror of
https://github.com/spring-projects/spring-security.git
synced 2025-07-04 09:42:29 +00:00
Fix test. BasicProcessingFilter doesn't work with TestingAuthenticationToken.
This commit is contained in:
parent
3acd515c6c
commit
e18971fdf0
@ -47,7 +47,8 @@ import org.springframework.security.MockAuthenticationEntryPoint;
|
|||||||
import org.springframework.security.MockAuthenticationManager;
|
import org.springframework.security.MockAuthenticationManager;
|
||||||
import org.springframework.security.MockFilterConfig;
|
import org.springframework.security.MockFilterConfig;
|
||||||
import org.springframework.security.context.SecurityContextHolder;
|
import org.springframework.security.context.SecurityContextHolder;
|
||||||
import org.springframework.security.providers.TestingAuthenticationToken;
|
import org.springframework.security.providers.UsernamePasswordAuthenticationToken;
|
||||||
|
import org.springframework.security.util.AuthorityUtils;
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -87,7 +88,8 @@ public class BasicProcessingFilterTests {
|
|||||||
SecurityContextHolder.clearContext();
|
SecurityContextHolder.clearContext();
|
||||||
|
|
||||||
final AuthenticationManager manager = jmock.mock(AuthenticationManager.class);
|
final AuthenticationManager manager = jmock.mock(AuthenticationManager.class);
|
||||||
final Authentication rod = new TestingAuthenticationToken("rod", "koala", "ROLE_1");
|
final Authentication rod =
|
||||||
|
new UsernamePasswordAuthenticationToken("rod", "koala", AuthorityUtils.createAuthorityList("ROLE_1"));
|
||||||
jmock.checking(new Expectations() {{
|
jmock.checking(new Expectations() {{
|
||||||
allowing(manager).authenticate(with(anAuthenticationWithUsernameAndPassword("rod", "koala")));
|
allowing(manager).authenticate(with(anAuthenticationWithUsernameAndPassword("rod", "koala")));
|
||||||
will(returnValue(rod));
|
will(returnValue(rod));
|
||||||
|
Loading…
x
Reference in New Issue
Block a user