001 /*
002 * Databinder: a simple bridge from Wicket to Hibernate
003 * Copyright (C) 2006 Nathan Hamblen nathan@technically.us
004 *
005 * This library is free software; you can redistribute it and/or
006 * modify it under the terms of the GNU Lesser General Public
007 * License as published by the Free Software Foundation; either
008 * version 2.1 of the License, or (at your option) any later version.
009 *
010 * This library is distributed in the hope that it will be useful,
011 * but WITHOUT ANY WARRANTY; without even the implied warranty of
012 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
013 * Lesser General Public License for more details.
014 *
015 * You should have received a copy of the GNU Lesser General Public
016 * License along with this library; if not, write to the Free Software
017 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
018 */
019 package net.databinder.auth.hib;
020
021 /**
022 * Holds DataUser identifier for signed in users. Remembering the user with a browser cookie
023 * allows that user to bypass login for the length of time specified in getSignInCookieMaxAge().
024 * <p> In general the semantics here expect users to have a username and password, though the
025 * DataUser interface itself does not require it. Use your <tt>AuthDataApplication</tt> subclass to specify
026 * a user class and criteria builder as needed.</p>
027 */
028 import net.databinder.auth.AuthDataSessionBase;
029 import net.databinder.auth.data.DataUser;
030 import net.databinder.models.hib.HibernateObjectModel;
031
032 import org.apache.wicket.Request;
033 import org.apache.wicket.model.IModel;
034 import org.apache.wicket.protocol.http.WebApplication;
035
036 /** Session to hold DataUser. */
037 public class AuthDataSession extends AuthDataSessionBase {
038 /**
039 * Initialize new session.
040 * @see WebApplication
041 */
042 public AuthDataSession(Request request) {
043 super(request);
044 }
045
046 @Override
047 public IModel createUserModel(DataUser user) {
048 return new HibernateObjectModel(user);
049 }
050 }