I have enterprise application and enterprise client application (I use glassfish server). What I should do in order to use ProgrammaticLogin in client application? Every blog or book describes how to create tables in database, jdbc realm on glassfish, and mappings role-group. And that's all. The official Oracle site says that:
The ProgrammaticLoginPermission permission is required to invoke the programmatic login mechanism for an application if the security manager is enabled. For information about the security manager, see The server.policy File. This permission is not granted by default to deployed applications because this is not a standard Java EE mechanism.
To grant the required permission to the application, add the following to the domain-dir/config/server.policy file:
grant codeBase "file:jar-file-path" { permission com.sun.appserv.security.ProgrammaticLoginPermission "login"; };
but I didn't find any examples concerning it, so I'm not sure if it is obligatory. What is more, I guess there should be a step where I would tell ProgrammaticLogin which realm to use? Right now, ProgrammaticLogin always returns true (for wrong passwords too) and I'm sure it's because none of tutorials describes all necessary steps.