001/* 002 * Licensed to the Apache Software Foundation (ASF) under one or more 003 * contributor license agreements. See the NOTICE file distributed with 004 * this work for additional information regarding copyright ownership. 005 * The ASF licenses this file to You under the Apache License, Version 2.0 006 * (the "License"); you may not use this file except in compliance with 007 * the License. You may obtain a copy of the License at 008 * 009 * http://www.apache.org/licenses/LICENSE-2.0 010 * 011 * Unless required by applicable law or agreed to in writing, software 012 * distributed under the License is distributed on an "AS IS" BASIS, 013 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 014 * See the License for the specific language governing permissions and 015 * limitations under the License. 016 */ 017package org.apache.wicket.authroles.authentication; 018 019import org.apache.wicket.Session; 020import org.apache.wicket.authroles.authorization.strategies.role.Roles; 021import org.apache.wicket.protocol.http.WebSession; 022import org.apache.wicket.request.Request; 023 024 025/** 026 * Authenticated web session. Subclasses must provide a method that gets User authentication status 027 * and a method that returns the Roles for current User. 028 * 029 * @author Jonathan Locke 030 * @author Leonid Bogdanov 031 */ 032public abstract class AbstractAuthenticatedWebSession extends WebSession 033{ 034 private static final long serialVersionUID = 1L; 035 036 /** 037 * @return Current authenticated web session 038 */ 039 public static AbstractAuthenticatedWebSession get() 040 { 041 return (AbstractAuthenticatedWebSession)Session.get(); 042 } 043 044 /** 045 * Construct. 046 * 047 * @param request 048 * The current request object 049 */ 050 public AbstractAuthenticatedWebSession(final Request request) 051 { 052 super(request); 053 } 054 055 /** 056 * @return Get the roles that this session can play 057 */ 058 public abstract Roles getRoles(); 059 060 /** 061 * @return True if the user is signed in to this session 062 */ 063 public abstract boolean isSignedIn(); 064}