You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tuscany.apache.org by Dan Becker <da...@gmail.com> on 2008/03/13 18:56:03 UTC

Tuscany policy file syntax

I have two questions on running Tuscany code in Eclipse with security 
manager and user policy files.

1) In a command line environment, I usually provide a policy files with 
the following simple syntax:
    java -Djava.security.manager -Djava.security.policy=mypolicy.policy 
MyApp

However with my Tuscany sample in Eclipse, I had trouble finding the 
policy file with that sort of syntax when I placed my policy in the 
src/main/resource or target/classes directory. It did work when I 
provided a long ugly workspace file URL:
    java -Djava.security.manager 
-Djava.security.policy=file:/D:/workspaces/tuscany-code/sample-security-getprops/target/classes/mypolicy.policy 
MyApp

Does anyone have a more usable URL or place to locate the policy file so 
I can use the first simpler syntax?

2) In a similar vein, I tried to add some permissions in my policy file 
for the tuscany runtime code. I found that this ugly type of syntax 
inside the policy file seemed to work:
    grant codeBase "file:/tuscany-sca*.jar" {
       ...
    }

However, this simpler, more understandable, more general way of 
specifying the code base did not seem to work for me:
    grant codeBase "http://org.apache.tuscany.sca/-" {
       ...
    }
Is there a simpler more obvious way to add access to the runtime code?

-- 
Thanks, Dan Becker

---------------------------------------------------------------------
To unsubscribe, e-mail: tuscany-dev-unsubscribe@ws.apache.org
For additional commands, e-mail: tuscany-dev-help@ws.apache.org


Re: Tuscany policy file syntax

Posted by Dan Becker <da...@gmail.com>.
Thanks Raymond. Your codeBases worked for me too. Be sure to put 
tuscany.policy in the project root when using 
-Djava.security.policy==tuscany.policy.

Now on to those pesky doPriviledged blocks ....


Raymond Feng wrote:
> I got the following working with Eclipse.
> 
> 1) Create a java2 security policy file such as tuscany.policy in root of 
> the sample project with the following content:
> 
> grant codeBase "file:/C:/Tuscany/java/sca/modules/-" {
>  permission java.security.AllPermission;
> };
> 
> grant codeBase "file:${user.home}/.m2/repository/-" {
>  permission java.security.AllPermission;
> };
> 
> The first grant is for the tuscany modules in your workspace. You might 
> need to adjust it to fit your environment.
> The second grant is for the 3rd party jars tuscany modules depend on.
> 
> 2) Create a run profile for the main class with VM arguments set to:
> -Djava.security.manager  -Djava.security.policy==tuscany.policy 
> -Dpolicy.allowSystemProperty=true
> 
-- 
Thanks, Dan Becker

---------------------------------------------------------------------
To unsubscribe, e-mail: tuscany-dev-unsubscribe@ws.apache.org
For additional commands, e-mail: tuscany-dev-help@ws.apache.org


Re: Tuscany policy file syntax

Posted by Raymond Feng <en...@gmail.com>.
Hi,

I got the following working with Eclipse.

1) Create a java2 security policy file such as tuscany.policy in root of the 
sample project with the following content:

grant codeBase "file:/C:/Tuscany/java/sca/modules/-" {
  permission java.security.AllPermission;
};

grant codeBase "file:${user.home}/.m2/repository/-" {
  permission java.security.AllPermission;
};

The first grant is for the tuscany modules in your workspace. You might need 
to adjust it to fit your environment.
The second grant is for the 3rd party jars tuscany modules depend on.

2) Create a run profile for the main class with VM arguments set to:
-Djava.security.manager  -Djava.security.policy==tuscany.policy -Dpolicy.allowSystemProperty=true

Thanks,
Raymond
--------------------------------------------------
From: "Dan Becker" <da...@gmail.com>
Sent: Thursday, March 13, 2008 10:56 AM
To: <tu...@ws.apache.org>
Subject: Tuscany policy file syntax

> I have two questions on running Tuscany code in Eclipse with security 
> manager and user policy files.
>
> 1) In a command line environment, I usually provide a policy files with 
> the following simple syntax:
>    java -Djava.security.manager -Djava.security.policy=mypolicy.policy 
> MyApp
>
> However with my Tuscany sample in Eclipse, I had trouble finding the 
> policy file with that sort of syntax when I placed my policy in the 
> src/main/resource or target/classes directory. It did work when I provided 
> a long ugly workspace file URL:
>    java -Djava.security.manager -Djava.security.policy=file:/D:/workspaces/tuscany-code/sample-security-getprops/target/classes/mypolicy.policy 
> MyApp
>
> Does anyone have a more usable URL or place to locate the policy file so I 
> can use the first simpler syntax?
>
> 2) In a similar vein, I tried to add some permissions in my policy file 
> for the tuscany runtime code. I found that this ugly type of syntax inside 
> the policy file seemed to work:
>    grant codeBase "file:/tuscany-sca*.jar" {
>       ...
>    }
>
> However, this simpler, more understandable, more general way of specifying 
> the code base did not seem to work for me:
>    grant codeBase "http://org.apache.tuscany.sca/-" {
>       ...
>    }
> Is there a simpler more obvious way to add access to the runtime code?
>
> -- 
> Thanks, Dan Becker
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: tuscany-dev-unsubscribe@ws.apache.org
> For additional commands, e-mail: tuscany-dev-help@ws.apache.org
> 

---------------------------------------------------------------------
To unsubscribe, e-mail: tuscany-dev-unsubscribe@ws.apache.org
For additional commands, e-mail: tuscany-dev-help@ws.apache.org