1 Reply Latest reply on Oct 1, 2005 1:01 AM by evrim ulu

    Howto use JaasSecurityManager mbean isValid method?

    evrim ulu Newbie

      Hi,

      I'm trying to authenticate a subject using jaassecurity manager but failed.

      public void authenticate(String nick, String pass)
       throws UnauthorizedException {
       MBeanServer server = MBeanServerLocator.locateJBoss();
       String jaasMgrName = "jboss.security:service=JaasSecurityManager";
       String domainName = "java:/jaas/core";
       Principal p = new SimplePrincipal(nick);
      
       ObjectName jaasMgr;
       try {
       jaasMgr = new ObjectName(jaasMgrName);
       Object[] params = {domainName, p, pass.toCharArray()};
       String[] signature = {"java.lang.String", "java.security.Principal",
       "java.lang.Object"};
       Boolean valid= (Boolean) server.invoke(jaasMgr, "isValid", params, signature);
       System.err.println("result:"+valid);
       } catch (Exception e) {
       e.printStackTrace();
       }
       }
      


      Code is executed inside a war which is also using java:/jaas/core domain. How to use isValid() method? It now returns false all the time.

      I'm using standard login-config.xml with DatabaseServerLoginModule.