Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
[equinox-dev] Conditional Permission are not being checked

Hi,

 

I am trying to check Conditional Permssion Admin SErvice in Equinox. For this reason, I create a Bundle consumer, another one called service and another called PermissionManager who will implement the Conditional Permissions for the consumer.

 

The problem is that I do not get any exception when I try to get the service from another location different from my allowed one.

 

My PermissionManager implements BundleActivator and get the service ConditionalPermissionAdmin from the framework in the start method, finally is shown below:

 

private ConditionalPermissionAdmin cpa;

 

condPermRef = context.getServiceReference(ConditionalPermissionAdmin.class.getName());

 

cpa =(ConditionalPermissionAdmin) context.getService(condPermRef);

 

AccessController.doPrivileged(new PrivilegedAction() {

                  public Object run() {

                      cpa.addConditionalPermissionInfo(new ConditionInfo[]{

                         new ConditionInfo(BundleLocationCondition.class.getName(),

                         new

      String[]{context.getBundle().getLocation()})

                     },

                     new PermissionInfo[]{

                         new PermissionInfo(

                         AllPermission.class.getName(), "", "")

                     });

 

                      cpa.addConditionalPermissionInfo(

                               new ConditionInfo[]{

                                   new ConditionInfo(

                                   BundleLocationCondition.class.getName(),

                                   new

 

                  String[]{"file:C:\\equinoxv34\\clientserviceconditional.jar"})

                               },

                               new PermissionInfo[]{

                                   new PermissionInfo

                                   (ServicePermission.class.getName(),"dconde.osgi.serviceconditional.ServiceConditional","GET")

                                   

                                    });

                     // Add other permissions

                      return null; // nothing to return

                  }

              });

 

If I try to get the Service from another consumer in another location no exception is thrown, and I do not really know what I am missing. What do I need to apply Conditional Permission?

 

I am not applying as the same time Local Permission with permissions.perm, Does this have something to do with my results?

 

I am launching Equinox in this way:

 

java -Djava.security.manager=org.eclipse.osgi.framework.internal.core.FrameworkSecurityManager -Djava.security.policy=policy.policy -jar org.eclipse.osgi_3.4.3.R34x_v20081215-1030.jar –console

 

Any advice will be helpful

 

Thanks in advance

 

David

 

 


Back to the top