use of org.apereo.cas.ticket.TicketDefinition in project cas by apereo.
the class DynamoDbTicketRegistryFacilitator method deleteAll.
/**
* Delete all.
*
* @return the int
*/
public int deleteAll() {
final AtomicInteger count = new AtomicInteger();
final Collection<TicketDefinition> metadata = this.ticketCatalog.findAll();
metadata.forEach(r -> {
final ScanRequest scan = new ScanRequest(r.getProperties().getStorageName());
LOGGER.debug("Submitting scan request [{}] to table [{}]", scan, r.getProperties().getStorageName());
count.addAndGet(this.amazonDynamoDBClient.scan(scan).getCount());
});
createTicketTables(true);
return count.get();
}
use of org.apereo.cas.ticket.TicketDefinition in project cas by apereo.
the class DynamoDbTicketRegistryFacilitator method put.
/**
* Put ticket.
*
* @param ticket the ticket
* @param encodedTicket the encoded ticket
*/
public void put(final Ticket ticket, final Ticket encodedTicket) {
final TicketDefinition metadata = this.ticketCatalog.find(ticket);
final Map<String, AttributeValue> values = buildTableAttributeValuesMapFromTicket(ticket, encodedTicket);
LOGGER.debug("Adding ticket id [{}] with attribute values [{}]", encodedTicket.getId(), values);
final PutItemRequest putItemRequest = new PutItemRequest(metadata.getProperties().getStorageName(), values);
LOGGER.debug("Submitting put request [{}] for ticket id [{}]", putItemRequest, encodedTicket.getId());
final PutItemResult putItemResult = amazonDynamoDBClient.putItem(putItemRequest);
LOGGER.debug("Ticket added with result [{}]", putItemResult);
getAll();
}
use of org.apereo.cas.ticket.TicketDefinition in project cas by apereo.
the class DynamoDbTicketRegistryFacilitator method getAll.
/**
* Gets all.
*
* @return the all
*/
public Collection<Ticket> getAll() {
final Collection<Ticket> tickets = new ArrayList<>();
final Collection<TicketDefinition> metadata = this.ticketCatalog.findAll();
metadata.forEach(r -> {
final ScanRequest scan = new ScanRequest(r.getProperties().getStorageName());
LOGGER.debug("Scanning table with request [{}]", scan);
final ScanResult result = this.amazonDynamoDBClient.scan(scan);
LOGGER.debug("Scanned table with result [{}]", scan);
tickets.addAll(result.getItems().stream().map(this::deserializeTicket).collect(Collectors.toList()));
});
return tickets;
}
use of org.apereo.cas.ticket.TicketDefinition in project cas by apereo.
the class CasWsSecurityTokenTicketCatalogConfiguration method configureTicketCatalog.
@Override
public void configureTicketCatalog(final TicketCatalog plan) {
LOGGER.debug("Registering core WS security token ticket definitions...");
final TicketDefinition defn = buildTicketDefinition(plan, SecurityTokenTicket.PREFIX, DefaultSecurityTokenTicket.class);
defn.getProperties().setStorageName("wsSecurityTokenTicketsCache");
defn.getProperties().setStorageTimeout(casProperties.getTicket().getTgt().getMaxTimeToLiveInSeconds());
registerTicketDefinition(plan, defn);
}
Aggregations