/** * Instantiates a new EhCache ticket registry. * * @param serviceTicketsCache the service tickets cache * @param ticketGrantingTicketsCache the ticket granting tickets cache * @param supportRegistryState the support registry state */ public EhCacheTicketRegistry(final Cache serviceTicketsCache, final Cache ticketGrantingTicketsCache, final boolean supportRegistryState) { this(serviceTicketsCache, ticketGrantingTicketsCache); setSupportRegistryState(supportRegistryState); }
@Override public boolean deleteSingleTicket(final String ticketId) { if (this.ticketRegistry.deleteTicket(ticketId) > 0) { return true; } return false; }
/** * Instantiates a new EhCache ticket registry. * * @param serviceTicketsCache the service tickets cache * @param ticketGrantingTicketsCache the ticket granting tickets cache */ public EhCacheTicketRegistry(final Cache serviceTicketsCache, final Cache ticketGrantingTicketsCache) { super(); setServiceTicketsCache(serviceTicketsCache); setTicketGrantingTicketsCache(ticketGrantingTicketsCache); }
@Override public Ticket getTicket(final String ticketId) { return this.ticketRegistry.getTicket(ticketId); }
@Override public Collection<Ticket> getTickets() { return this.ticketRegistry.getTickets(); }
@Override public int sessionCount() { if (this.ticketRegistry instanceof TicketRegistryState) { return ((TicketRegistryState) this.ticketRegistry).sessionCount(); } logger.debug("Ticket registry {} does not report the sessionCount() operation of the registry state.", this.ticketRegistry.getClass().getName()); return super.sessionCount(); }
@Override public boolean isValidFor(final Service service) { final boolean b = this.getTicket().isValidFor(service); updateTicket(); return b; }
@Override public Collection<ProxyGrantingTicket> getProxyGrantingTickets() { return this.getTicket().getProxyGrantingTickets(); } }
/** * Update ticket by the delegated registry. */ protected void updateTicket() { this.ticketRegistry.updateTicket(this.ticket); }
@Override protected void updateTicket(final Ticket ticket) { addTicket(ticket); }
/** * Delete a single ticket instance from the store. * * @param ticketId the ticket id * @return the boolean */ public boolean deleteSingleTicket(final Ticket ticketId) { return deleteSingleTicket(ticketId.getId()); }
@Override public Principal getAuthenticatedPrincipalFrom(final String ticketGrantingTicketId) throws RuntimeException { final Authentication auth = getAuthenticationFrom(ticketGrantingTicketId); return auth == null ? null : auth.getPrincipal(); }
@Override public Map<String, Object> getPrincipalAttributesFrom(final String ticketGrantingTicketId) throws RuntimeException { final Principal principal = getAuthenticatedPrincipalFrom(ticketGrantingTicketId); return principal == null ? null : principal.getAttributes(); }
@Override public Service getService() { return getTicket().getService(); }
@Override /** {@inheritDoc} */ public Authentication getAuthenticationFrom(final String ticketGrantingTicketId) throws RuntimeException { final TicketGrantingTicket tgt = this.ticketRegistry.getTicket(ticketGrantingTicketId, TicketGrantingTicket.class); return tgt == null ? null : tgt.getAuthentication(); }
@Override public void deleteExpiredTicketGrantingTicket(String ticketGrantingTicketId) { if (ticketGrantingTicketExistsAndExpired(ticketGrantingTicketId)) { this.ticketRegistry.deleteTicket(ticketGrantingTicketId); } }
@Override public Service getProxiedBy() { return getTicket().getProxiedBy(); }
@Override public Authentication getAuthenticationFrom(final String ticketGrantingTicketId) throws RuntimeException { final TicketGrantingTicket tgt = this.ticketRegistry.getTicket(ticketGrantingTicketId, TicketGrantingTicket.class); return tgt == null ? null : tgt.getAuthentication(); }
@Override public boolean isRoot() { return getTicket().isRoot(); }
@Override /** {@inheritDoc} */ public Authentication getAuthenticationFrom(String ticketGrantingTicketId) throws RuntimeException { TicketGrantingTicket tgt = (TicketGrantingTicket) this.ticketRegistry.getTicket(ticketGrantingTicketId, TicketGrantingTicket.class); return tgt == null ? null : tgt.getAuthentication(); }