1 Reply Latest reply on Jun 4, 2005 8:48 AM by starksm64

    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>