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

org.apache.shiro.session.mgt.SessionManager Maven / Gradle / Ivy

There is a newer version: 3.9
Show newest version
/*
 * Licensed to the Apache Software Foundation (ASF) under one
 * or more contributor license agreements.  See the NOTICE file
 * distributed with this work for additional information
 * regarding copyright ownership.  The ASF licenses this file
 * to you 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.apache.shiro.session.mgt;

import org.apache.shiro.session.Session;
import org.apache.shiro.session.SessionException;

/**
 * A SessionManager manages the creation, maintenance, and clean-up of all application
 * {@link org.apache.shiro.session.Session Session}s.
 *
 * @since 0.1
 */
public interface SessionManager {

    /**
     * Starts a new session based on the specified contextual initialization data, which can be used by the underlying
     * implementation to determine how exactly to create the internal Session instance.
     * 

* This method is mainly used in framework development, as the implementation will often relay the argument * to an underlying {@link SessionFactory} which could use the context to construct the internal Session * instance in a specific manner. This allows pluggable {@link org.apache.shiro.session.Session Session} creation * logic by simply injecting a {@code SessionFactory} into the {@code SessionManager} instance. * * @param context the contextual initialization data that can be used by the implementation or underlying * {@link SessionFactory} when instantiating the internal {@code Session} instance. * @return the newly created session. * @see SessionFactory#createSession(SessionContext) * @since 1.0 */ Session start(SessionContext context); /** * Retrieves the session corresponding to the specified contextual data (such as a session ID if applicable), or * {@code null} if no Session could be found. If a session is found but invalid (stopped or expired), a * {@link SessionException} will be thrown. * * @param key the Session key to use to look-up the Session * @return the {@code Session} instance corresponding to the given lookup key or {@code null} if no session * could be acquired. * @throws SessionException if a session was found but it was invalid (stopped/expired). * @since 1.0 */ Session getSession(SessionKey key) throws SessionException; }





© 2015 - 2025 Weber Informatics LLC | Privacy Policy