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

org.springframework.session.FindByIndexNameSessionRepository Maven / Gradle / Ivy

There is a newer version: 1.3.5.RELEASE
Show newest version
/*
 * Copyright 2014-2018 the original author or authors.
 *
 * 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.springframework.session;

import java.util.Map;

/**
 * Extends a basic {@link SessionRepository} to allow finding a session id by the
 * principal name. The principal name is defined by the {@link Session} attribute with the
 * name {@link FindByIndexNameSessionRepository#PRINCIPAL_NAME_INDEX_NAME}.
 *
 * @param  the type of Session being managed by this
 * {@link FindByIndexNameSessionRepository}
 * @author Rob Winch
 */
public interface FindByIndexNameSessionRepository
		extends SessionRepository {

	/**
	 * 

* A common session attribute that contains the current principal name (i.e. * username). *

* *

* It is the responsibility of the developer to ensure the attribute is populated * since Spring Session is not aware of the authentication mechanism being used. *

* * @since 1.1 */ String PRINCIPAL_NAME_INDEX_NAME = FindByIndexNameSessionRepository.class.getName() .concat(".PRINCIPAL_NAME_INDEX_NAME"); /** * Find a Map of the session id to the {@link Session} of all sessions that contain * the session attribute with the name * {@link FindByIndexNameSessionRepository#PRINCIPAL_NAME_INDEX_NAME} and the value of * the specified principal name. * * @param indexName the name of the index (i.e. * {@link FindByIndexNameSessionRepository#PRINCIPAL_NAME_INDEX_NAME}) * @param indexValue the value of the index to search for. * @return a Map (never null) of the session id to the {@link Session} of all sessions * that contain the session specified index name and the value of the specified index * name. If no results are found, an empty Map is returned. */ Map findByIndexNameAndIndexValue(String indexName, String indexValue); }