LoginContext lc = new LoginContext("testJaasSecurityDomainIdentityLoginModule");
lc.login();
Subject subject = lc.getSubject();
assertTrue("Principals contains sa", subject.getPrincipals().contains(new SimplePrincipal("sa")));
Set creds = subject.getPrivateCredentials(PasswordCredential.class);
PasswordCredential pc = (PasswordCredential) creds.iterator().next();
String username = pc.getUserName();
String password = new String(pc.getPassword());
assertTrue("PasswordCredential.username = sa", username.equals("sa"));
assertTrue("PasswordCredential.password = ", password.equals(""));
lc.logout();
server.unregisterMBean(name);
MBeanServerFactory.releaseMBeanServer(server);