@Override public ProxyGrantingTicket grantProxyGrantingTicket( final String id, final Authentication authentication, final ExpirationPolicy expirationPolicy) { synchronized (this) { if(this.grantedTicketAlready) { throw new IllegalStateException( "PGT already generated for this ST. Cannot grant more than one TGT for ST"); } this.grantedTicketAlready = Boolean.TRUE; } final ProxyGrantingTicket pgt = new ProxyGrantingTicketImpl(id, this.service, this.getGrantingTicket(), authentication, expirationPolicy); getGrantingTicket().getProxyGrantingTickets().add(pgt); return pgt; }
/** * {@inheritDoc} */ @Override public boolean equals(final Object object) { if (object == null) { return false; } if (object == this) { return true; } if (!(object instanceof ServiceTicket)) { return false; } final Ticket ticket = (Ticket) object; return new EqualsBuilder() .append(ticket.getId(), this.getId()) .isEquals(); }
/** * {@inheritDoc} * <p>The state of the ticket is affected by this operation and the * ticket will be considered used regardless of the match result. * The state update subsequently may impact the ticket expiration * policy in that, depending on the policy configuration, the ticket * may be considered expired. */ @Override public boolean isValidFor(final Service serviceToValidate) { updateState(); return serviceToValidate.matches(this.service); }
/** * {@inheritDoc} * <p>The state of the ticket is affected by this operation and the * ticket will be considered used. The state update subsequently may * impact the ticket expiration policy in that, depending on the policy * configuration, the ticket may be considered expired. */ @Override public final synchronized ServiceTicket grantServiceTicket(final String id, final Service service, final ExpirationPolicy expirationPolicy, final boolean credentialsProvided, final boolean onlyTrackMostRecentSession) { final ServiceTicket serviceTicket = new ServiceTicketImpl(id, this, service, this.getCountOfUses() == 0 || credentialsProvided, expirationPolicy); updateServiceAndTrackSession(serviceTicket.getId(), service, onlyTrackMostRecentSession); return serviceTicket; }