利用JAAS對使用者進行驗證和授權遇到的問題

oceannut發表於2004-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";
};

請各位給些意見,是什麼地方的錯誤?

相關文章