*/
@Test
public void testCorrectPass() throws Exception {
Authentication token = new UsernamePasswordAuthenticationToken("user", "pass");
AuthenticationManager manager = createMock(AuthenticationManager.class);
processingFiler.setAuthenticationManager(manager);
SAMLTestHelper.setLocalContextParameters(request, "/saml", null);
final Capture<SAMLMessageContext> context = new Capture<SAMLMessageContext>();
expect(request.getRequestURL()).andReturn(new StringBuffer("http://localhost:8081/spring-security-saml2-webapp/saml/SSO"));
expect(processor.retrieveMessage(capture(context))).andAnswer(new IAnswer<SAMLMessageContext>() {
public SAMLMessageContext answer() throws Throwable {
context.getValue().setInboundSAMLBinding(org.opensaml.common.xml.SAMLConstants.SAML2_POST_BINDING_URI);
return context.getValue();
}
});
expect(manager.authenticate((Authentication) notNull())).andReturn(token);
replay(manager);
replayMock();
Authentication authentication = processingFiler.attemptAuthentication(request, null);
assertEquals(token, authentication);