CTSOperations.java revision 72450cb9c2ca854c6d3479832c2738196c1d3282
/**
* Copyright 2014 ForgeRock AS.
*
* The contents of this file are subject to the terms of the Common Development and
* Distribution License (the License). You may not use this file except in compliance with the
* License.
*
* You can obtain a copy of the License at legal/CDDLv1.0.txt. See the License for the
* specific language governing permission and limitations under the License.
*
* When distributing Covered Software, include this CDDL Header Notice in each file and include
* the License file at legal/CDDLv1.0.txt. If applicable, add the following below the CDDL
* Header, with the fields enclosed by brackets [] replaced by your own identifying
* information: "Portions copyright [year] [name of copyright owner]".
*/
/**
* Responsible for providing an implementation of the Session Operations
* strategy that is backed by the Core Token Service (CTS).
*
* The operations themselves depend on the presence of an InternalSession which
* the CTS can provide by deserialising the token stored in the CTS.
*
* Note: This implementation is only appropriate in the situation where the
* remote site that is typically responsible for servicing a Session is down.
*/
public class CTSOperations implements SessionOperations {
private final CTSPersistentStore cts;
private final SessionAdapter adapter;
private final TokenIdFactory idFactory;
private final SessionInfoFactory sessionInfoFactory;
private final SessionService sessionService;
/**
* Guice initialised constructor.
*
* @param cts Non null.
* @param adapter Non null.
* @param idFactory Non null.
* @param sessionInfoFactory Non null.
* @param sessionService Non null.
* @param debug Non null.
*/
this.sessionInfoFactory = sessionInfoFactory;
this.sessionService = sessionService;
}
/**
* Fetch the SessionInfo for the Session ID.
*
* The SessionID is used to recall the token from the CTS, which is then
* converted to a SessionInfo object. The token is not modified as part of
* this operation.
*
* @param session Non null SessionID to use for the lookup.
* @param reset If true, then update the last modified timestamp of the Session.
* @param session The SessionID to update.
* @return A non null SessionInfo
* @throws SessionException If there was a problem locating the Session in the CTS.
*/
// Modifies the Session if required.
if (reset) {
}
}
/**
* Perform a logout based on the SessionID.
*
* Locates the token in the CTS and performs a delete.
*
* @param session Non null SessionID to use for the delete.
* @throws SessionException If there was a problem deleting the token from the CTS.
*/
}
/**
* Perform a destroy operation on the SessionID.
*
* This will, like logout, perform a delete on the token.
*
* @param session Non null SessionID to use for the lookup.
* @throws SessionException If there was a problem deleting the token.
*/
}
/**
* Sets the property using the {@link InternalSession#putProperty} method.
*
* {@inheritDoc}
*/
try {
} catch (CoreTokenException e) {
throw new SessionException(e);
}
}
try {
} catch (DeleteFailedException e) {
throw new SessionException(e);
}
}
try {
} catch (CoreTokenException e) {
throw new SessionException(e);
}
}
}