1 Reply Latest reply on Mar 12, 2008 12:03 AM by sbiwal

    jboss 3.2.5 valve realm problem

    sago

      Hi,

      I'm writing my own valve to authenticate http requests, I'm getting the realm from catalina context and invoking the authenticate method(String, String).

      The realm used is by jboss is JBossSecurityMgrRealm (the default) but when this realm looks for the security context the JNDI lookup fails :

      public class JBossSecurityMgrRealm extends RealmBase implements Realm, Valve
      {
       ...
       private Context getSecurityContext()
       {
       Context securityCtx = null;
       // Get the JBoss security manager from the ENC context
       try
       {
       InitialContext iniCtx = new InitialContext();
       securityCtx = (Context) iniCtx.lookup("java:comp/env/security");
       }
       catch (NamingException e)
       {
       // Apparently there is no security context?
       }
       return securityCtx;
       }
       ...
      }


      I configured the valve in $JBOSS_HOME/server/default/deploy/jbossweb-tomcat50.sar/server.xml file :


      </Host>
       ...
       <Valve className="org.josso.agent.SSOAgentValve" debug="1"/>
       ...
      </Host>
      




      I'm using jboss 3.2.5 (tomcat 5.0.26)

      The problem is that when invoking the realm from my onw valve, the JNDI context is not properly set, and the realm can't find the security context.

      Any ideas ?


      Thx,

        • 1. Re: jboss 3.2.5 valve realm problem
          sbiwal

          Hi sago,

          I am working on a similar thing and am getting the exact same problem. The securityCtx seems to exist if I login normally to the portal. However it is null while using my custom valve.

          Have you found any solutions to this problem ? If so please help cos I'm stuck at this problem for really long.

          Thanks,
          Swati