Package org.jasig.cas.ticket

Examples of org.jasig.cas.ticket.Ticket


    protected String resolveFromInternal(final JoinPoint joinPoint) {
        final Object arg1 = joinPoint.getArgs()[0];
        if (arg1 instanceof Credentials) {
           return arg1.toString();
        } else if (arg1 instanceof String) {
            final Ticket ticket = this.ticketRegistry.getTicket((String) arg1);
            if (ticket instanceof ServiceTicket) {
                final ServiceTicket serviceTicket = (ServiceTicket) ticket;
                return serviceTicket.getGrantingTicket().getAuthentication().getPrincipal().getId();
            } else if (ticket instanceof TicketGrantingTicket) {
                final TicketGrantingTicket tgt = (TicketGrantingTicket) ticket;
View Full Code Here


  }

  public void testAddGetRemove() throws Exception {
    int numTimes = 100;
    for (int i = 0; i < numTimes; i++) {
      Ticket originalTicket = generateRandomTicket();
      String id = originalTicket.getId();

      registry.addTicket(originalTicket);

      assertEquals(originalTicket, registry.getTicket(id));
View Full Code Here

        return new BerkleyDbTicketRegistryTestSetup(new LoadTest(testCase, 100));
    }

    public void testBasicFunctionality() throws Exception {

        Ticket originalTicket = generateRandomTicket();
        String id = originalTicket.getId();
        long createTime = originalTicket.getCreationTime();

        registry.addTicket(originalTicket);

        Ticket retrievedTicket = registry.getTicket(id);

        assertEquals(originalTicket, retrievedTicket);
        assertEquals(id, retrievedTicket.getId());
        assertEquals(createTime, retrievedTicket.getCreationTime());

        Collection allTickets = registry.getTickets();
        assertTrue(allTickets.contains(originalTicket));

    }
View Full Code Here

        } catch (final DatabaseException e) {
            throw new RuntimeException(e);
        }

        final Ticket ticket = theData.getData() != null
            ? (Ticket) this.ticketBinding.entryToObject(theData) : null;

        if (ticket != null && log.isDebugEnabled()) {
            log.debug("Ticket [" + ticketId + "] found in registry.");
        }
View Full Code Here

            while (cursor.getNext(foundKey, foundData,
                LockMode.READ_UNCOMMITTED) == OperationStatus.SUCCESS) {

                if (foundData.getData() != null) {
                    Ticket ticket = (Ticket) this.ticketBinding
                        .entryToObject(foundData);
                    tickets.add(getProxiedTicketInstance(ticket));
                }
            }
            cursor.close();
View Full Code Here

      return false;
    }
  }

  public Ticket getTicket(final String ticketId) {
    final Ticket t = (Ticket) this.client.get(ticketId);
    if (t == null) {
      return null;
    }
   
    return getProxiedTicketInstance(t);
View Full Code Here

        this.jpaTemplate.persist(ticket);
    }

    @Transactional(readOnly = false)
    public boolean deleteTicket(final String ticketId) {
        final Ticket ticket = getRawTicket(ticketId);
       
        if (ticket == null) {
            return false;
        }
       
View Full Code Here

        }

        if (log.isDebugEnabled()) {
            log.debug("Attempting to retrieve ticket [" + ticketId + "]");
        }
        final Ticket ticket = this.cache.get(ticketId);

        if (ticket != null) {
            log.debug("Ticket [" + ticketId + "] found in registry.");
        }
View Full Code Here

     */
    public final Ticket getTicket(final String ticketId,
        final Class<? extends Ticket> clazz) {
        Assert.notNull(clazz, "clazz cannot be null");

        final Ticket ticket = this.getTicket(ticketId);

        if (ticket == null) {
            return null;
        }

        if (!clazz.isAssignableFrom(ticket.getClass())) {
            throw new ClassCastException("Ticket [" + ticket.getId()
                + " is of type " + ticket.getClass()
                + " when we were expecting " + clazz);
        }

        return ticket;
    }
View Full Code Here

    }

    @Transactional(readOnly = false)
    @Override
    public boolean deleteTicket(final String ticketId) {
        final Ticket ticket = getRawTicket(ticketId);

        if (ticket == null) {
            return false;
        }
View Full Code Here

TOP

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

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.