001/* 002 * Licensed under the Apache License, Version 2.0 (the "License"); 003 * you may not use this file except in compliance with the License. 004 * You may obtain a copy of the License at 005 * 006 * http://www.apache.org/licenses/LICENSE-2.0 007 * 008 * Unless required by applicable law or agreed to in writing, software 009 * distributed under the License is distributed on an "AS IS" BASIS, 010 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 011 * See the License for the specific language governing permissions and 012 * limitations under the License. 013 */ 014package org.apache.shiro.ee.faces.tags; 015 016import javax.faces.view.facelets.TagConfig; 017 018/** 019 * Tag that renders the tag body only if the current user has executed a <b>successful</b> authentication attempt 020 * <em>during their current session</em>. 021 * 022 * <p>This is more restrictive than the {@link UserTag}, which only 023 * ensures the current user is known to the system, either via a current login or from Remember Me services, 024 * which only makes the assumption that the current user is who they say they are, and does not guarantee it like 025 * this tag does. 026 * 027 * <p>The logically opposite tag of this one is the {@link NotAuthenticatedTag} 028 */ 029public class AuthenticatedTag extends AuthenticationTagHandler { 030 public AuthenticatedTag(TagConfig config) { 031 super(config); 032 } 033 034 @Override 035 protected boolean checkAuthentication() { 036 return getSubject() != null && getSubject().isAuthenticated(); 037 } 038}