jboss-arquillian - 在arquillian測試中,登錄ProgrammaticLogin不工作

  显示原文与译文双语对照的内容
67 4

我正在嘗試使用ProgrammaticLogin中的arquillian測試中的類來模擬登錄。我的代碼如下所示:

System.setProperty("java.security.auth.login.config","path/login.config")
com.sun.appserv.security.ProgrammaticLogin loginP = new ProgrammaticLogin();
 try{
 loginP.login("user1","password","fileRealm",true);
 }
 catch (Exception e){
 System.out.println(e.getMessage());
 }

我得到以下異常:

SEVERE: SEC9050: Programmatic login failed
com.sun.enterprise.security.auth.login.common.LoginException: Login failed: Failed file login for user1.
 at com.sun.enterprise.security.auth.login.LoginContextDriver.doPasswordLogin(LoginContextDriver.java:394)
 at com.sun.enterprise.security.auth.login.LoginContextDriver.login(LoginContextDriver.java:240)
 at com.sun.enterprise.security.auth.login.LoginContextDriver.login(LoginContextDriver.java:153)
 at com.sun.appserv.security.ProgrammaticLogin$1.run(ProgrammaticLogin.java:174)
 at java.security.AccessController.doPrivileged(Native Method)
 at com.sun.appserv.security.ProgrammaticLogin.login(ProgrammaticLogin.java:168)
 at com.sun.appserv.security.ProgrammaticLogin.login(ProgrammaticLogin.java:239)
 at com.sun.appserv.security.ProgrammaticLogin.login(ProgrammaticLogin.java:211)

我添加了一個包含登錄和密碼的屬性文件 users.properties 。

时间:原作者:0个回答

...