001: /*
002: * Copyright 2001-2007 Steven Grimm <koreth[remove] at midwinter dot com> and
003: * Geert Bevin <gbevin[remove] at uwyn dot com>
004: * Distributed under the terms of either:
005: * - the common development and distribution license (CDDL), v1.0; or
006: * - the GNU Lesser General Public License, v2.1 or later
007: * $Id$
008: */
009: package com.uwyn.rife.authentication.sessionvalidators;
010:
011: import com.uwyn.rife.authentication.CredentialsManager;
012: import com.uwyn.rife.authentication.RememberManager;
013: import com.uwyn.rife.authentication.SessionManager;
014: import com.uwyn.rife.authentication.SessionValidator;
015:
016: /**
017: * Convenience superclass for {@link SessionValidator} implementations.
018: * This provides simple getters and setters for the various properties
019: * that can be set on a session validator.
020:
021: * @author Steven Grimm (koreth[remove] at midwinter dot com)
022: * @author Geert Bevin (gbevin[remove] at uwyn dot com)
023: * @version $Revision: $
024: * @since 1.6
025: */
026: public abstract class AbstractSessionValidator implements
027: SessionValidator {
028: /** Predefined return type for validateSession(): session is invalid */
029: public static final int SESSION_INVALID = 0;
030: /** Predefined return type for validateSession(): session is valid */
031: public static final int SESSION_VALID = 1;
032:
033: protected CredentialsManager mCredentialsManager = null;
034: protected SessionManager mSessionManager = null;
035: protected RememberManager mRememberManager = null;
036:
037: /**
038: * Set's this validator's credentials manager.
039: *
040: * @param credentialsManager the {@code CredentialsManager} instance
041: * @since 1.6
042: */
043: public void setCredentialsManager(
044: CredentialsManager credentialsManager) {
045: mCredentialsManager = credentialsManager;
046: }
047:
048: /**
049: * Retrieves this validator's credentials manager.
050: *
051: * @return the requested {@code CredentialsManager}; or
052: * {@code null} if none has been setup yet
053: * @since 1.6
054: */
055: public CredentialsManager getCredentialsManager() {
056: return mCredentialsManager;
057: }
058:
059: /**
060: * Set's this validator's session manager.
061: *
062: * @param sessionManager the {@code SessionManager} instance
063: * @since 1.6
064: */
065: public void setSessionManager(SessionManager sessionManager) {
066: mSessionManager = sessionManager;
067: }
068:
069: /**
070: * Retrieves this validator's session manager.
071: *
072: * @return the requested {@code SessionManager}; or
073: * {@code null} if none has been setup yet
074: * @since 1.6
075: */
076: public SessionManager getSessionManager() {
077: return mSessionManager;
078: }
079:
080: /**
081: * Set's this validator's "remember me" manager.
082: *
083: * @param rememberManager the {@code RememberManager} instance
084: * @since 1.6
085: */
086: public void setRememberManager(RememberManager rememberManager) {
087: mRememberManager = rememberManager;
088: }
089:
090: /**
091: * Retrieves this validator's "remember me" manager.
092: *
093: * @return the requested {@code RememberManager}; or
094: * {@code null} if none has been setup yet
095: * @since 1.6
096: */
097: public RememberManager getRememberManager() {
098: return mRememberManager;
099: }
100: }
|