0 Replies Latest reply on May 18, 2005 6:22 AM by mvwinsen

    passing security information from servlet to Resource Adapte

    mvwinsen

      Hi,

      i'm working on a JCA prototype which uses Connection Management and Security management.

      I can make a connection by passing the username and password in the getConnection() method in the ConnectionFactory.

      But now i want to make a connection without passing parameters to the getConnection() method.
      I've tried all kind of things, but the Subject stays empty (PasswordCredentials) in the Resource adapter.

      In the servlet i've tried the following:

      <<sourcecode servlet>>

      Hashtable properties = new Hashtable();
      properties.put(Context.SECURITY_PRINCIPAL, userName);
      properties.put(Context.SECURITY_CREDENTIALS,userPassWord);
      Context jndiContext = new InitialContext(properties);
      Object ref = jndiContext.lookup("ejb/ResourceConnectorSession");


      <<sourcecode ejb-jar.xml>>


      <![CDATA[Description for ResourceConnectorSession]]>
      <display-name>Name for ResourceConnectorSession</display-name>

      <ejb-name>ResourceConnectorSession</ejb-name>

      SsaJcaTestClient.interfaces.ResourceConnectorSessionHome
      SsaJcaTestClient.interfaces.ResourceConnectorSession
      <ejb-class>SsaJcaTestClient.ejb.ResourceConnectorSessionBean</ejb-class>
      <session-type>Stateless</session-type>
      <transaction-type>Container</transaction-type>

      <resource-ref>
      A J2ee Resource Adapter
      <res-ref-name>SsaJcaConnector</res-ref-name>
      <res-type> javax.resource.cci.ConnectionFactory
      </res-type>
      <res-auth>Container</res-auth>
      </resource-ref>



      <<sourcecode jboss.xml>>


      <ejb-name>ResourceConnectorSession</ejb-name>
      <jndi-name>ejb/ResourceConnectorSession</jndi-name>
      <resource-ref>
      <res-ref-name>SsaJcaConnector</res-ref-name>
      <jndi-name>java:/SsaJcaConnector</jndi-name>

      </resource-ref>



      ----------------------------------------------------------------

      I'm really don't what i do wrong. I let the application server handeling the security, but in the ManagedConnectionFactory, the Subject stays empty.

      Does anyone knows a sollution?

      Mark van Winsen