Coverage Report - org.apache.shiro.web.tags.NotAuthenticatedTag
 
Classes in this File Line Coverage Branch Coverage Complexity
NotAuthenticatedTag
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 only if the current user has <em>not</em> executed a successful authentication
 30  
  * attempt <em>during their current session</em>.
 31  
  *
 32  
  * <p>The logically opposite tag of this one is the {@link org.apache.shiro.web.tags.AuthenticatedTag}.
 33  
  *
 34  
  * @since 0.2
 35  
  */
 36  0
 public class NotAuthenticatedTag extends SecureTag {
 37  
 
 38  
     //TODO - complete JavaDoc
 39  
 
 40  0
     private static final Logger log = LoggerFactory.getLogger(NotAuthenticatedTag.class);
 41  
 
 42  
     public int onDoStartTag() throws JspException {
 43  0
         if (getSubject() == null || !getSubject().isAuthenticated()) {
 44  0
             if (log.isTraceEnabled()) {
 45  0
                 log.trace("Subject does not exist or is not authenticated.  Tag body will be evaluated.");
 46  
             }
 47  0
             return TagSupport.EVAL_BODY_INCLUDE;
 48  
         } else {
 49  0
             if (log.isTraceEnabled()) {
 50  0
                 log.trace("Subject exists and is authenticated.  Tag body will not be evaluated.");
 51  
             }
 52  0
             return TagSupport.SKIP_BODY;
 53  
         }
 54  
     }
 55  
 }