Coverage Report - org.apache.turbine.modules.screens.LegacyVelocitySecureScreen
 
Classes in this File Line Coverage Branch Coverage Complexity
LegacyVelocitySecureScreen
0%
0/4
0%
0/2
1,333
 
 1  
 package org.apache.turbine.modules.screens;
 2  
 
 3  
 /*
 4  
  * Licensed to the Apache Software Foundation (ASF) under one
 5  
  * or more contributor license agreements.  See the NOTICE file
 6  
  * distributed with this work for additional information
 7  
  * regarding copyright ownership.  The ASF licenses this file
 8  
  * to you under the Apache License, Version 2.0 (the
 9  
  * "License"); you may not use this file except in compliance
 10  
  * with the License.  You may obtain a copy of the License at
 11  
  *
 12  
  *   http://www.apache.org/licenses/LICENSE-2.0
 13  
  *
 14  
  * Unless required by applicable law or agreed to in writing,
 15  
  * software distributed under the License is distributed on an
 16  
  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
 17  
  * KIND, either express or implied.  See the License for the
 18  
  * specific language governing permissions and limitations
 19  
  * under the License.
 20  
  */
 21  
 
 22  
 
 23  
 import org.apache.turbine.pipeline.PipelineData;
 24  
 import org.apache.turbine.util.RunData;
 25  
 import org.apache.velocity.context.Context;
 26  
 
 27  
 /**
 28  
  * Support Turbine 2 screens
 29  
  *
 30  
  * @author <a href="mailto:tv@apache.org">Thomas Vandahl</a>
 31  
  * @deprecated Use VelocitySecureScreen directly
 32  
  */
 33  
 @Deprecated
 34  0
 public abstract class LegacyVelocitySecureScreen
 35  
         extends LegacyVelocityScreen
 36  
 {
 37  
     /**
 38  
      * Implement this to add information to the context.
 39  
      *
 40  
      * @param data Turbine information.
 41  
      * @param context Context for web pages.
 42  
      * @throws Exception a generic exception.
 43  
      */
 44  
     @Override
 45  
     protected abstract void doBuildTemplate(RunData data, Context context)
 46  
             throws Exception;
 47  
 
 48  
     /**
 49  
      * This method overrides the method in VelocityScreen to
 50  
      * perform a security check first.
 51  
      *
 52  
      * @param pipelineData Turbine information.
 53  
      * @throws Exception a generic exception.
 54  
      */
 55  
     @Override
 56  
     protected void doBuildTemplate(PipelineData pipelineData)
 57  
         throws Exception
 58  
     {
 59  0
         if (isAuthorized(getRunData(pipelineData)))
 60  
         {
 61  0
             doBuildTemplate(getRunData(pipelineData), velocity.getContext(pipelineData));
 62  
         }
 63  0
     }
 64  
 
 65  
     /**
 66  
      * Implement this method to perform the security check needed.
 67  
      * You should set the template in this method that you want the
 68  
      * user to be sent to if they're unauthorized.  See the
 69  
      * VelocitySecurityCheck utility.
 70  
      *
 71  
      * @param data Turbine information.
 72  
      * @return True if the user is authorized to access the screen.
 73  
      * @throws Exception a generic exception.
 74  
      */
 75  
     protected abstract boolean isAuthorized(RunData data)
 76  
             throws Exception;
 77  
 }