Coverage Report - org.apache.shiro.web.tags.GuestTag
 
Classes in this File Line Coverage Branch Coverage Complexity
GuestTag
0%
0/9
0%
0/8
6
 
 1  
 /*
 2  
  * Licensed to the Apache Software Foundation (ASF) under one
 3  
  * or more contributor license agreements.  See the NOTICE file
 4  
  * distributed with this work for additional information
 5  
  * regarding copyright ownership.  The ASF licenses this file
 6  
  * to you under the Apache License, Version 2.0 (the
 7  
  * "License"); you may not use this file except in compliance
 8  
  * with the License.  You may obtain a copy of the License at
 9  
  *
 10  
  *     http://www.apache.org/licenses/LICENSE-2.0
 11  
  *
 12  
  * Unless required by applicable law or agreed to in writing,
 13  
  * software distributed under the License is distributed on an
 14  
  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
 15  
  * KIND, either express or implied.  See the License for the
 16  
  * specific language governing permissions and limitations
 17  
  * under the License.
 18  
  */
 19  
 package org.apache.shiro.web.tags;
 20  
 
 21  
 import javax.servlet.jsp.JspException;
 22  
 import javax.servlet.jsp.tagext.TagSupport;
 23  
 
 24  
 import org.slf4j.Logger;
 25  
 import org.slf4j.LoggerFactory;
 26  
 
 27  
 
 28  
 /**
 29  
  * JSP tag that renders the tag body if the current user <em>is not</em> known to the system, either because they
 30  
  * haven't logged in yet, or because they have no 'RememberMe' identity.
 31  
  *
 32  
  * <p>The logically opposite tag of this one is the {@link UserTag}.  Please read that class's JavaDoc as it explains
 33  
  * more about the differences between Authenticated/Unauthenticated and User/Guest semantic differences.
 34  
  *
 35  
  * @since 0.9
 36  
  */
 37  0
 public class GuestTag extends SecureTag {
 38  
 
 39  
     //TODO - complete JavaDoc
 40  
 
 41  0
     private static final Logger log = LoggerFactory.getLogger(GuestTag.class);
 42  
 
 43  
     public int onDoStartTag() throws JspException {
 44  0
         if (getSubject() == null || getSubject().getPrincipal() == null) {
 45  0
             if (log.isTraceEnabled()) {
 46  0
                 log.trace("Subject does not exist or does not have a known identity (aka 'principal').  " +
 47  
                         "Tag body will be evaluated.");
 48  
             }
 49  0
             return TagSupport.EVAL_BODY_INCLUDE;
 50  
         } else {
 51  0
             if (log.isTraceEnabled()) {
 52  0
                 log.trace("Subject exists or has a known identity (aka 'principal').  " +
 53  
                         "Tag body will not be evaluated.");
 54  
             }
 55  0
             return TagSupport.SKIP_BODY;
 56  
         }
 57  
     }
 58  
 
 59  
 }