i'm trying simulate login using programmaticlogin class in arquillian tests in embedded glassfish. code following:
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()); }
i'm getting following exception:
severe: sec9050: programmatic login failed com.sun.enterprise.security.auth.login.common.loginexception: login failed: failed file login user1. @ com.sun.enterprise.security.auth.login.logincontextdriver.dopasswordlogin(logincontextdriver.java:394) @ com.sun.enterprise.security.auth.login.logincontextdriver.login(logincontextdriver.java:240) @ com.sun.enterprise.security.auth.login.logincontextdriver.login(logincontextdriver.java:153) @ com.sun.appserv.security.programmaticlogin$1.run(programmaticlogin.java:174) @ java.security.accesscontroller.doprivileged(native method) @ com.sun.appserv.security.programmaticlogin.login(programmaticlogin.java:168) @ com.sun.appserv.security.programmaticlogin.login(programmaticlogin.java:239) @ com.sun.appserv.security.programmaticlogin.login(programmaticlogin.java:211)
i've added properties file users.properties contains login , password.
if glassfish container runs in it's own process, property define using system.setproperty() not available. it's available inside test, runs in different process. maybe should add bean deployment sets property using @postconstruct.
Comments
Post a Comment