All Downloads are FREE. Search and download functionalities are using the official Maven repository.

org.acegisecurity.concurrent.SessionRegistry Maven / Gradle / Ivy

There is a newer version: 1.0.7
Show newest version
/* Copyright 2004, 2005, 2006 Acegi Technology Pty Limited
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *     http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

package org.acegisecurity.concurrent;

/**
 * Maintains a registry of SessionInformation instances.
 *
 * @author Ben Alex
 * @version $Id: SessionRegistry.java 1519 2006-05-29 15:06:32Z benalex $
 */
public interface SessionRegistry {
    //~ Methods ========================================================================================================

    /**
     * Obtains all the known principals in the SessionRegistry.
     *
     * @return each of the unique principals, which can then be presented to {@link #getAllSessions(Object, boolean)}.
     */
    public Object[] getAllPrincipals();

    /**
     * Obtains all the known sessions for the specified principal. Sessions that have been destroyed are not
     * returned. Sessions that have expired may be returned, depending on the passed argument.
     *
     * @param principal to locate sessions for (should never be null)
     * @param includeExpiredSessions if true, the returned sessions will also include those that have
     *        expired for the principal
     *
     * @return the matching sessions for this principal, or null if none were found
     */
    public SessionInformation[] getAllSessions(Object principal, boolean includeExpiredSessions);

    /**
     * Obtains the session information for the specified sessionId. Even expired sessions are
     * returned (although destroyed sessions are never returned).
     *
     * @param sessionId to lookup (should never be null)
     *
     * @return the session information, or null if not found
     */
    public SessionInformation getSessionInformation(String sessionId);

    /**
     * Updates the given sessionId so its last request time is equal to the present date and time.
     * Silently returns if the given sessionId cannot be found or the session is marked to expire.
     *
     * @param sessionId for which to update the date and time of the last request (should never be null)
     */
    public void refreshLastRequest(String sessionId);

    /**
     * Registers a new session for the specified principal. The newly registered session will not be marked for
     * expiration.
     *
     * @param sessionId to associate with the principal (should never be null)
     * @param principal to associate with the session (should never be null)
     *
     * @throws SessionAlreadyUsedException DOCUMENT ME!
     */
    public void registerNewSession(String sessionId, Object principal)
        throws SessionAlreadyUsedException;

    /**
     * Deletes all the session information being maintained for the specified sessionId. If the
     * sessionId is not found, the method gracefully returns.
     *
     * @param sessionId to delete information for (should never be null)
     */
    public void removeSessionInformation(String sessionId);
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy