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 package org.apache.openejb.ri.sp; 18 19 import javax.security.jacc.PolicyConfigurationFactory; 20 import javax.security.jacc.PolicyConfiguration; 21 import javax.security.jacc.PolicyContextException; 22 import java.security.PermissionCollection; 23 import java.security.Permission; 24 25 /** 26 * @version $Rev: 602704 $ $Date: 2007-12-09 09:58:22 -0800 (Sun, 09 Dec 2007) $ 27 */ 28 public class PseudoPolicyConfigurationFactory extends PolicyConfigurationFactory { 29 30 public static void install() { 31 System.setProperty("javax.security.jacc.PolicyConfigurationFactory.provider", PseudoPolicyConfigurationFactory.class.getName()) ; 32 } 33 34 public PolicyConfiguration getPolicyConfiguration(final String contextID, boolean remove) throws PolicyContextException { 35 return new PolicyConfiguration(){ 36 public String getContextID() throws PolicyContextException { 37 return contextID; 38 } 39 40 public void addToRole(String roleName, PermissionCollection permissions) throws PolicyContextException { 41 } 42 43 public void addToRole(String roleName, Permission permission) throws PolicyContextException { 44 } 45 46 public void addToUncheckedPolicy(PermissionCollection permissions) throws PolicyContextException { 47 } 48 49 public void addToUncheckedPolicy(Permission permission) throws PolicyContextException { 50 } 51 52 public void addToExcludedPolicy(PermissionCollection permissions) throws PolicyContextException { 53 } 54 55 public void addToExcludedPolicy(Permission permission) throws PolicyContextException { 56 } 57 58 public void removeRole(String roleName) throws PolicyContextException { 59 } 60 61 public void removeUncheckedPolicy() throws PolicyContextException { 62 } 63 64 public void removeExcludedPolicy() throws PolicyContextException { 65 } 66 67 public void linkConfiguration(PolicyConfiguration link) throws PolicyContextException { 68 } 69 70 public void delete() throws PolicyContextException { 71 } 72 73 public void commit() throws PolicyContextException { 74 } 75 76 public boolean inService() throws PolicyContextException { 77 return false; 78 } 79 }; 80 } 81 82 public boolean inService(String contextID) throws PolicyContextException { 83 return true; 84 } 85 }