[java-identity-provider] branch master updated: IDP-1324 Store CAS tickets in session context.
Marvin S. Addison
marvin.addison at gmail.com
Fri Sep 7 16:38:19 EDT 2018
This is an automated email from the git hooks/post-receive script.
serac pushed a commit to branch master
in repository java-identity-provider.
View the commit online:
http://git.shibboleth.net/view/?p=java-identity-provider.git;a=commit;h=20a2658a7c9e49f0959a13402207792534050452
The following commit(s) were added to refs/heads/master by this push:
new 20a2658 IDP-1324 Store CAS tickets in session context.
20a2658 is described below
commit 20a2658a7c9e49f0959a13402207792534050452
Author: Marvin S. Addison <serac at vt.edu>
AuthorDate: Fri Sep 7 16:35:43 2018 -0400
IDP-1324 Store CAS tickets in session context.
Use the IdP session ID as the storage context for CAS tickets.
Requires storing an additional item to track the session ID for a
particular ticket ID.
See https://issues.shibboleth.net/jira/browse/IDP-1324.
---
.../idp/cas/ticket/impl/AbstractTicketService.java | 36 ++++++++++++++--------
1 file changed, 24 insertions(+), 12 deletions(-)
diff --git a/idp-cas-impl/src/main/java/net/shibboleth/idp/cas/ticket/impl/AbstractTicketService.java b/idp-cas-impl/src/main/java/net/shibboleth/idp/cas/ticket/impl/AbstractTicketService.java
index b2a1439..7675c0d 100644
--- a/idp-cas-impl/src/main/java/net/shibboleth/idp/cas/ticket/impl/AbstractTicketService.java
+++ b/idp-cas-impl/src/main/java/net/shibboleth/idp/cas/ticket/impl/AbstractTicketService.java
@@ -184,14 +184,15 @@ public abstract class AbstractTicketService implements TicketServiceEx {
*/
protected <T extends Ticket> void store(final T ticket) {
final String context = context(ticket.getClass());
- log.debug("Storing {} in context {}", ticket, context);
try {
- if (!storageService.create(
- context,
- ticket.getId(),
- ticket,
- serializer(ticket.getClass()),
- ticket.getExpirationInstant().getMillis())) {
+ final String sessionId = ticket.getSessionId();
+ final long expiry = ticket.getExpirationInstant().getMillis();
+ log.debug("Storing mapping of {} to {} in context {}", ticket, sessionId, context);
+ if (!storageService.create(context, ticket.getId(), sessionId, expiry)) {
+ throw new RuntimeException("Failed to store ticket " + ticket);
+ }
+ log.debug("Storing {} in context {}", ticket, sessionId);
+ if (!storageService.create(sessionId, ticket.getId(), ticket, serializer(ticket.getClass()), expiry)) {
throw new RuntimeException("Failed to store ticket " + ticket);
}
} catch (final IOException e) {
@@ -213,12 +214,18 @@ public abstract class AbstractTicketService implements TicketServiceEx {
final T ticket;
try {
final String context = context(clazz);
- final StorageRecord<T> record = storageService.read(context, id);
- if (record == null) {
+ final StorageRecord<T> sessionRecord = storageService.read(context, id);
+ if (sessionRecord == null) {
log.debug("{} not found in context {}", id, context);
return null;
}
- ticket = record.getValue(serializer(clazz), context, id);
+ final String sessionId = sessionRecord.getValue();
+ final StorageRecord<T> ticketRecord = storageService.read(sessionId, id);
+ if (ticketRecord == null) {
+ log.debug("{} not found in context {}", id, sessionId);
+ return null;
+ }
+ ticket = ticketRecord.getValue(serializer(clazz), sessionId, id);
} catch (final IOException e) {
throw new RuntimeException("Error reading ticket.");
}
@@ -241,9 +248,14 @@ public abstract class AbstractTicketService implements TicketServiceEx {
}
try {
final String context = context(clazz);
- log.debug("Attempting to delete {} from context {}", ticket, context);
+ log.debug("Attempting to delete {} from context {}", id, context);
if (!storageService.delete(context, id)) {
- log.info("Failed deleting {}. Ticket probably expired from storage service.", id);
+ log.info("Failed deleting {} from context {}.", id, context);
+ }
+ final String sessionId = ticket.getSessionId();
+ log.debug("Attempting to delete {} from context {}", id, sessionId);
+ if (!storageService.delete(sessionId, id)) {
+ log.info("Failed deleting {} from context {}.", id, sessionId);
}
} catch (final IOException e) {
throw new RuntimeException("Error deleting ticket " + id, e);
--
To stop receiving notification emails like this one, please contact
the administrator of this repository.
More information about the commits
mailing list