Share via


Handling of authentication for LOB Activities - Part II

In the previous blog post, we went over how to pass authentication information for WCF SQL, WCF Oracle DB, WCF SAP and WCF Siebel adapters. WCF Oracle E-Business adapter poses some additional challenges since in some case two sets of credentials – one for the Oracle DB and one for the Oracle E-Business server – may be required. Below are few options that can be used to authenticate in such scenarios.

Using custom endpoint behavior

The approach is exactly the same as defined in the previous blog post. In addition to retrieving the Oracle DB credentials and populating the ClientCredentials behavior, we will additionally retrieve the Oracle E-Business credentials and populate the relevant binding properties with that information. 

 

        public void
            ApplyClientBehavior(
                ServiceEndpoint endpoint,
                ClientRuntime clientRuntime
            )
        {
            ClientCredentials clientCredentials = endpoint.Behaviors.Find<ClientCredentials>();
Debug.Assert(clientCredentials != null, "ClientCredentials behavior not present");

// TODO: Add your code to retrieve the credentials from a secure
            // store. For illustration purpose, the values are hard-coded
            clientCredentials.UserName.UserName = "Foo";
clientCredentials.UserName.Password = "Bar";

 

           // We expect the adapter binding element to be part of a custom

            // binding. Locate the Oracle EBS binding element in that

            CustomBinding customBinding = endpoint.Binding as CustomBinding;

            Debug.Assert(customBinding != null, "Binding is not a CustomBinding!");

            OracleEBSAdapter adapterBinding = customBinding.Elements.Find<OracleEBSAdapter>();

            Debug.Assert(adapterBinding != null, "Adapter binding element not present");

 

            // TODO: Add your code to retrieve the credentials from a secure

            // store. For illustration purpose, the values are hard-coded

            adapterBinding.OracleUserName = "FooApps";

            adapterBinding.OraclePassword = "BarApps";

        }

 
Putting the credentials in the configuration file

The Oracle E-Business credentials can be specified by setting the binding properties – oracleUserName and oraclePassword – in the configuration file. Note that this poses a security risk since the credentials are now stored in clear text in the config file. You need to ACL that file properly.

The Oracle DB credentials can be specified using any of the mechanisms specified in the previous blog post.

Sandeep Prabhu,
BizTalk Server Team

Comments

  • Anonymous
    August 31, 2010
    Great example, however the binding properties are only for the OracleEBSBinding. In my example, I can never actually get the  OracleEBSBinding, only the Custom Binding.Thus I needed to iterate over the binding collection to get to the actual OracleEBS Adapter, which is really where these properties are:Binding b = endpoint.Binding;           BindingElementCollection bec = b.CreateBindingElements();           var oracleAdapterElement = bec.Where(be => be.GetType() == typeof (OracleEBSAdapter)).FirstOrDefault();           OracleEBSAdapter adapter = (OracleEBSAdapter) oracleAdapterElement;           adapter.OracleUserName = "DemoUser";           adapter.OraclePassword = "Pa$$w0rd";I'm hoping someelse will find this helpful. I'll blog about it as well.Thanks.