Hello,
I am trying to run a sample JAAS program downloaded from the sun site.But Iam having problems with the setting of one of the file specified in the code named foo.txt. There was sample.jar,sample_modules.jar,sample_action.jar ,sample_jaas.config ,sample_jaas.policy and sample_java2.policy files. I placed these files in my project directory and placed the jaas.jar file in the G:\jdk1.3\jre\lib\ext directory. After setting the CLASSPATH of the above jar files I used the following command as written in the JAAS api documentation. But got the following error with the foo.txt file.

G:\jdk1.3\jre\bin>java -Djava.security.manager -Djava.security.policy==G:\JBuild
er3\myprojects\JAASImp\sample_java2.policy -Djava.security.auth.policy==G:\JBuil
der3\myprojects\JAASImp\sample_jaas.policy -Djava.security.auth.login.config==G:
\JBuilder3\myprojects\JAASImp\sample_jaas.config sample.Sample
SampleModule username: testUser
SampleModule password: testPassword
[SampleLoginModule] user entered username: testUser
[SampleLoginModule] user entered password: testPassword
[SampleLoginModule] authentication succeeded
[SampleLoginModule] added SamplePrincipal to Subject
Authenticated user has the following Principals:
SamplePrincipal: testUser
User has 0 Public Credential(s)

Your java.home property: G:\jdk1.3\jre

Your user.home property: D:\Documents and Settings\Administrator

foo.txt does not exist in the current working directory.

G:\jdk1.3\jre\bin>

I edited the sample_jaas.config ,sample_jaas.policy and sample_java2.policy files for the code base of jaas and the other jaar files. I also tried to give the absolute path for the foo.txt file but it didn't worked e.g

sample_jaas.policy before

/** Subject-Based Access Control Policy for the JAAS Sample Application **/

grant codebase "file:G:/JBuilder3/myprojects/JAASImp/sample_action.jar",
Principal sample.SamplePrincipal "testUser" {

permission java.util.PropertyPermission "java.home", "read";
permission java.util.PropertyPermission "user.home", "read";
permission java.io.FilePermission "foo.txt", "read";
};

sample_jaas.policy after

/** Subject-Based Access Control Policy for the JAAS Sample Application **/

grant codebase "file:G:/JBuilder3/myprojects/JAASImp/sample_action.jar",
Principal sample.SamplePrincipal "testUser" {

permission java.util.PropertyPermission "java.home", "read";
permission java.util.PropertyPermission "user.home", "read";
permission java.io.FilePermission "G:/JBuilder3/myprojects/JAASImp/foo.txt", "read";
};

I did the same changes in the sample_java2.policy file. And runned the same command as above but it showed me an AccessControlException..

G:\jdk1.3\jre\bin>java -Djava.security.manager -Djava.security.policy==G:\JBuild
er3\myprojects\JAASImp\sample_java2.policy -Djava.security.auth.policy==G:\JBuil
der3\myprojects\JAASImp\sample_jaas.policy -Djava.security.auth.login.config==G:
\JBuilder3\myprojects\JAASImp\sample_jaas.config sample.Sample
java.security.Policy: error parsing file:G:/JBuilder3/myprojects/JAASImp/sample_
java2.policy
java.security.Policy: line 22: expected permission entry
Exception in thread "main" java.lang.ExceptionInInitializerError: java.security.
AccessControlException: access denied (java.util.PropertyPermission java.securit
y.auth.debug read)
at java.security.AccessControlContext.checkPermission(AccessControlConte
xt.java:272)
at java.security.AccessController.checkPermission(AccessController.java:
399)
at java.lang.SecurityManager.checkPermission(SecurityManager.java:545)
at java.lang.SecurityManager.checkPropertyAccess(SecurityManager.java:12
78)
at java.lang.System.getProperty(System.java:560)
at javax.security.auth.login.Debug$1.run(Debug.java:27)
at java.security.AccessController.doPrivileged(Native Method)
at javax.security.auth.login.Debug.<clinit>(Debug.java:24)
at javax.security.auth.login.LoginContext.<clinit>(LoginContext.java:147
)
at sample.Sample.main(Sample.java:42)

G:\jdk1.3\jre\bin>

please give me the solution and steps for configuring this JAAS example
M. Naseem Siddiqui
Software Engineer
KalSoft (Pvt) Ltd.
Pakistan


Get Your Private, Free E-mail from MSN Hotmail at http://www.hotmail.com.

_______________________________________________ JBoss-user mailing list [EMAIL PROTECTED] http://lists.sourceforge.net/lists/listinfo/jboss-user

Reply via email to