利用JAAS对用户进行验证和授权遇到的问题

oceannut 04-12-05

错误提示如下:
java.security.auth.policy:语法解析错误 file:C:/myworkspace/test/policy.jaas
java.security.auth.policy: 行 1: 只允许基于 Principal 的授权项目

java.security.AccessControlException: access denied (java.util.PropertyPermission java.home read)


Policy文件如下:

grant codebase "file:./-" {
permission javax.security.auth.AuthPermission
"createLoginContext.Example";
permission javax.security.auth.AuthPermission "doAs";
permission java.lang.RuntimePermission "accessClassInPackage.sun.jdbc.odbc";
permission java.util.PropertyPermission "file.encoding", "read";
};

grant codebase "file:./-" {
permission javax.security.auth.AuthPermission "modifyPrincipals";
};

grant codebase "file:./-",
Principal org.oceannut.test.User "zsp" {
permission java.util.PropertyPermission "java.home", "read";
permission java.util.PropertyPermission "user.home", "read";
permission java.io.FilePermission "hi.txt", "read,write";
};

请各位给些意见,是什么地方的错误?