Search in sources :

Example 1 with ProxyGrantingTicketImpl

use of org.apereo.cas.ticket.ProxyGrantingTicketImpl in project cas by apereo.

the class ProxyControllerTests method verifyNotAuthorizedPGT.

@Test
public void verifyNotAuthorizedPGT() throws Exception {
    final ProxyGrantingTicket ticket = new ProxyGrantingTicketImpl("ticketGrantingTicketId", CoreAuthenticationTestUtils.getAuthentication(), new NeverExpiresExpirationPolicy());
    getTicketRegistry().addTicket(ticket);
    final MockHttpServletRequest request = new MockHttpServletRequest();
    request.addParameter(CasProtocolConstants.PARAMETER_PROXY_GRANTING_TICKET, ticket.getId());
    request.addParameter("targetService", "service");
    final Map<String, Object> map = this.proxyController.handleRequestInternal(request, new MockHttpServletResponse()).getModel();
    assertFalse(map.containsKey(CasProtocolConstants.PARAMETER_TICKET));
}
Also used : NeverExpiresExpirationPolicy(org.apereo.cas.ticket.support.NeverExpiresExpirationPolicy) MockHttpServletRequest(org.springframework.mock.web.MockHttpServletRequest) ProxyGrantingTicketImpl(org.apereo.cas.ticket.ProxyGrantingTicketImpl) ProxyGrantingTicket(org.apereo.cas.ticket.proxy.ProxyGrantingTicket) MockHttpServletResponse(org.springframework.mock.web.MockHttpServletResponse) Test(org.junit.Test)

Example 2 with ProxyGrantingTicketImpl

use of org.apereo.cas.ticket.ProxyGrantingTicketImpl in project cas by apereo.

the class ProxyControllerTests method verifyExistingPGT.

@Test
public void verifyExistingPGT() throws Exception {
    final ProxyGrantingTicket ticket = new ProxyGrantingTicketImpl("ticketGrantingTicketId", CoreAuthenticationTestUtils.getAuthentication(), new NeverExpiresExpirationPolicy());
    getTicketRegistry().addTicket(ticket);
    final MockHttpServletRequest request = new MockHttpServletRequest();
    request.addParameter(CasProtocolConstants.PARAMETER_PROXY_GRANTING_TICKET, ticket.getId());
    request.addParameter("targetService", "testDefault");
    assertTrue(this.proxyController.handleRequestInternal(request, new MockHttpServletResponse()).getModel().containsKey(CasProtocolConstants.PARAMETER_TICKET));
}
Also used : NeverExpiresExpirationPolicy(org.apereo.cas.ticket.support.NeverExpiresExpirationPolicy) MockHttpServletRequest(org.springframework.mock.web.MockHttpServletRequest) ProxyGrantingTicketImpl(org.apereo.cas.ticket.ProxyGrantingTicketImpl) ProxyGrantingTicket(org.apereo.cas.ticket.proxy.ProxyGrantingTicket) MockHttpServletResponse(org.springframework.mock.web.MockHttpServletResponse) Test(org.junit.Test)

Aggregations

ProxyGrantingTicketImpl (org.apereo.cas.ticket.ProxyGrantingTicketImpl)2 ProxyGrantingTicket (org.apereo.cas.ticket.proxy.ProxyGrantingTicket)2 NeverExpiresExpirationPolicy (org.apereo.cas.ticket.support.NeverExpiresExpirationPolicy)2 Test (org.junit.Test)2 MockHttpServletRequest (org.springframework.mock.web.MockHttpServletRequest)2 MockHttpServletResponse (org.springframework.mock.web.MockHttpServletResponse)2