/* (non-Javadoc)
  * @see org.soulwing.cas.support.ProxyTicketService#getTicket(java.lang.String)
  */
 public String getTicket(String targetService) {
   String pgt = ProxyGrantingTicketHolder.getTicket();
   if (pgt == null) {
     throw new IllegalStateException("proxy granting ticket is not available");
   }
   return getTicket(targetService, pgt);
 }
  /**
   * NOTE: you can only retrieve a ProxyGrantingTicket once with this method. Its removed after
   * retrieval.
   */
  public String retrieve(final String proxyGrantingTicketIou) {
    if (CommonUtils.isBlank(proxyGrantingTicketIou)) {
      return null;
    }

    final ProxyGrantingTicketHolder holder = this.cache.get(proxyGrantingTicketIou);

    if (holder == null) {
      logger.info("No Proxy Ticket found for [{}].", proxyGrantingTicketIou);
      return null;
    }

    this.cache.remove(proxyGrantingTicketIou);

    logger.debug("Returned ProxyGrantingTicket of [{}]", holder.getProxyGrantingTicket());
    return holder.getProxyGrantingTicket();
  }