Coverage report

  %line %branch
org.apache.jetspeed.security.impl.JaasPolicyCoordinator
0% 
0% 

 1  
 /* 
 2  
  * Licensed to the Apache Software Foundation (ASF) under one or more
 3  
  * contributor license agreements.  See the NOTICE file distributed with
 4  
  * this work for additional information regarding copyright ownership.
 5  
  * The ASF licenses this file to You under the Apache License, Version 2.0
 6  
  * (the "License"); you may not use this file except in compliance with
 7  
  * the License.  You may obtain a copy of the License at
 8  
  *
 9  
  *     http://www.apache.org/licenses/LICENSE-2.0
 10  
  *
 11  
  * Unless required by applicable law or agreed to in writing, software
 12  
  * distributed under the License is distributed on an "AS IS" BASIS,
 13  
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 14  
  * See the License for the specific language governing permissions and
 15  
  * limitations under the License.
 16  
  */
 17  
 
 18  
 package org.apache.jetspeed.security.impl;
 19  
 
 20  
 import java.security.CodeSource;
 21  
 import java.security.Permission;
 22  
 import java.security.PermissionCollection;
 23  
 import java.security.Policy;
 24  
 import java.security.ProtectionDomain;
 25  
 
 26  
 /**
 27  
  * <p>
 28  
  * Provide coordination between the default policy and Jetspeed custom policy.
 29  
  * </p>
 30  
  */
 31  
 public class JaasPolicyCoordinator extends Policy
 32  
 {
 33  
     private final Policy defaultPolicy;
 34  
 
 35  
     private final Policy j2Policy;
 36  
 
 37  
     /**
 38  
      * <p>
 39  
      * Constructor for coordinating the policies.
 40  
      * </p>
 41  
      * 
 42  
      * @param defaultPolicy The default policy.
 43  
      * @param j2Policy Jetspeed policy.
 44  
      */
 45  
     public JaasPolicyCoordinator(Policy defaultPolicy, Policy j2Policy)
 46  0
     {
 47  0
         this.defaultPolicy = defaultPolicy;
 48  0
         this.j2Policy = j2Policy;
 49  0
     }
 50  
 
 51  
     /**
 52  
      * @see java.security.Policy#getPermissions(java.security.CodeSource)
 53  
      */
 54  
     public PermissionCollection getPermissions(CodeSource codeSource)
 55  
     {
 56  0
         return defaultPolicy.getPermissions(codeSource);
 57  
     }
 58  
 
 59  
     /**
 60  
      * @see java.security.Policy#refresh()
 61  
      */
 62  
     public void refresh()
 63  
     {
 64  0
         defaultPolicy.refresh();
 65  0
         j2Policy.refresh();
 66  0
     }
 67  
 
 68  
     /**
 69  
      * @see java.security.Policy#implies(java.security.ProtectionDomain, java.security.Permission)
 70  
      */
 71  
     public boolean implies(ProtectionDomain domain, Permission permission)
 72  
     {
 73  0
         if (permission.getClass().getName().startsWith("java"))
 74  
         {
 75  0
             return defaultPolicy.implies(domain, permission);
 76  
         }
 77  
         else
 78  
         {
 79  0
             return j2Policy.implies(domain, permission);
 80  
         }
 81  
     }
 82  
 }

This report is generated by jcoverage, Maven and Maven JCoverage Plugin.