Package org.jasig.cas.ticket

Examples of org.jasig.cas.ticket.TicketGrantingTicketImpl


        try {
            final Authentication authentication = this.authenticationManager
                .authenticate(credentials);

            final TicketGrantingTicket ticketGrantingTicket = new TicketGrantingTicketImpl(
                this.ticketGrantingTicketUniqueTicketIdGenerator
                    .getNewTicketId(TicketGrantingTicket.PREFIX),
                authentication, this.ticketGrantingTicketExpirationPolicy);

            this.ticketRegistry.addTicket(ticketGrantingTicket);
            return ticketGrantingTicket.getId();
        } catch (final AuthenticationException e) {
            throw new TicketCreationException(e);
        }
    }
View Full Code Here


            "code"));
    }

    @Test
    public void testExistingPGT() throws Exception {
        final TicketGrantingTicket ticket = new TicketGrantingTicketImpl(
            "ticketGrantingTicketId", TestUtils.getAuthentication(),
            new NeverExpiresExpirationPolicy());
        getTicketRegistry().addTicket(ticket);
        MockHttpServletRequest request = new MockHttpServletRequest();
        request
            .addParameter("pgt", ticket.getId());
        request.addParameter(
            "targetService", "service");

        assertTrue(this.proxyController.handleRequestInternal(request,
            new MockHttpServletResponse()).getModel().containsKey(
View Full Code Here

  }

  private TicketGrantingTicketImpl generateRandomTicket() {
    String id = this.generator.getNewTicketId("TGT");
        final SimplePrincipal principal = new SimplePrincipal(id);
    TicketGrantingTicketImpl ticket = new TicketGrantingTicketImpl(id,
        new ImmutableAuthentication(principal),
        new TimeoutExpirationPolicy(500));

    return ticket;
  }
View Full Code Here

    this.reg.addTicket(ticket);
  }

  TicketGrantingTicket getTicket(String id) {
        final SimplePrincipal principal = new SimplePrincipal(id);
        TicketGrantingTicket ticket = new TicketGrantingTicketImpl(id, new ImmutableAuthentication(principal), new TimeoutExpirationPolicy(500));

    return ticket;
  }
View Full Code Here

    private TicketGrantingTicketImpl generateRandomTicket() {
        final String id = this.generator.getNewTicketId("TGT");
        final SimplePrincipal principal = new SimplePrincipal(id);

        TicketGrantingTicketImpl ticket = new TicketGrantingTicketImpl(id,
            new ImmutableAuthentication(principal),
            new TimeoutExpirationPolicy(500));

        return ticket;
    }
View Full Code Here

     * Method to add a TicketGrantingTicket to the ticket cache. This should add
     * the ticket and return. Failure upon any exception.
     */
    public void testAddTicketToCache() {
        try {
            this.ticketRegistry.addTicket(new TicketGrantingTicketImpl("TEST",
                TestUtils.getAuthentication(),
                new NeverExpiresExpirationPolicy()));
        } catch (Exception e) {
            fail("Caught an exception. But no exception should have been thrown.");
        }
View Full Code Here

        }
    }

    public void testGetExistingTicketWithProperClass() {
        try {
            this.ticketRegistry.addTicket(new TicketGrantingTicketImpl("TEST",
                TestUtils.getAuthentication(),
                new NeverExpiresExpirationPolicy()));
            this.ticketRegistry.getTicket("TEST", TicketGrantingTicket.class);
        } catch (Exception e) {
            System.out.println(e);
View Full Code Here

        }
    }

    public void testGetExistingTicketWithInproperClass() {
        try {
            this.ticketRegistry.addTicket(new TicketGrantingTicketImpl("TEST",
                TestUtils.getAuthentication(),
                new NeverExpiresExpirationPolicy()));
            this.ticketRegistry.getTicket("TEST", ServiceTicket.class);
        } catch (ClassCastException e) {
            return;
View Full Code Here

        }
    }

    public void testGetExistingTicket() {
        try {
            this.ticketRegistry.addTicket(new TicketGrantingTicketImpl("TEST",
                TestUtils.getAuthentication(),
                new NeverExpiresExpirationPolicy()));
            this.ticketRegistry.getTicket("TEST");
        } catch (Exception e) {
            e.printStackTrace();
View Full Code Here

    }

    public void testTicketExpirationWithRememberMe() {
        final MutableAuthentication authentication = new MutableAuthentication(TestUtils.getPrincipal());
        authentication.getAttributes().put(RememberMeCredentials.AUTHENTICATION_ATTRIBUTE_REMEMBER_ME, Boolean.TRUE);
        final TicketGrantingTicketImpl t = new TicketGrantingTicketImpl("111", authentication, this.p);
        assertFalse(t.isExpired());
        t.grantServiceTicket("55", TestUtils.getService(), this.p, false);
        assertTrue(t.isExpired());
       
    }
View Full Code Here

TOP

Related Classes of org.jasig.cas.ticket.TicketGrantingTicketImpl

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.