use of org.apereo.cas.ticket.proxy.ProxyHandler in project cas by apereo.
the class AbstractServiceValidateControllerTests method verifyValidServiceTicketWithValidPgtAndProxyHandlerFailing.
@Test
public void verifyValidServiceTicketWithValidPgtAndProxyHandlerFailing() throws Exception {
final AuthenticationResult ctx = CoreAuthenticationTestUtils.getAuthenticationResult(getAuthenticationSystemSupport(), SERVICE);
final TicketGrantingTicket tId = getCentralAuthenticationService().createTicketGrantingTicket(ctx);
final ServiceTicket sId = getCentralAuthenticationService().grantServiceTicket(tId.getId(), SERVICE, ctx);
final MockHttpServletRequest request = new MockHttpServletRequest();
request.addParameter(SERVICE_PARAM, SERVICE.getId());
request.addParameter(TICKET_PARAM, sId.getId());
request.addParameter(PGT_URL_PARAM, GITHUB_URL);
this.serviceValidateController.setProxyHandler(new ProxyHandler() {
@Override
public String handle(final Credential credential, final TicketGrantingTicket proxyGrantingTicketId) {
return null;
}
@Override
public boolean canHandle(final Credential credential) {
return true;
}
});
final ModelAndView modelAndView = this.serviceValidateController.handleRequestInternal(request, new MockHttpServletResponse());
assertFalse(modelAndView.getView().toString().contains(SUCCESS));
assertNull(modelAndView.getModel().get(PGT_IOU_PARAM));
}
Aggregations