How do I code Citrix web sites to use a Secure Gateway (CSG)?

Posted by RAVolt on Stack Overflow See other posts from Stack Overflow or by RAVolt
Published on 2009-03-02T19:41:37Z Indexed on 2010/04/01 12:03 UTC
Read the original article Hit count: 541

I'm using Citrix's sample code as a base and trying to get it to generate ICA files that direct the client to use their Secure Gateway (CSG) provider. My configuration is that the ICA file's server address is replaced with a CSG ticket and traffic is forced to go to the CSG.

The challenge is that both the Citrix App Server (that's providing the ICA session on 1494) and the CSG have to coordinate through a Secure Ticket Authority (STA). That means that my code needs to talk to the STA as it creates the ICA file because STA holds a ticket that the CSG needs embedded into the ICA file. Confusing? Sure! But it's much more secure.

The pre-CSG code looks like this:

AppLaunchInfo launchInfo = (AppLaunchInfo)userContext.launchApp(appID, new AppLaunchParams(ClientType.ICA_30));
ICAFile icaFile = userContext.convertToICAFile(launchInfo, null, null);

I tried to the SSLEnabled information to the ICA generation, but it was not enough. here's that code:

launchInfo.setSSLEnabled(true);
launchInfo.setSSLAddress(new ServiceAddress("CSG URL", 443));

Now, it looks like I need to register the STA when I configure my farm:

ConnectionRoutingPolicy policy = config.getDMZRoutingPolicy();
policy.getRules().clear();

//Set the Secure Ticketing Authorities (STAs).
STAGroup STAgr = new STAGroup();
STAgr.addSTAURL(@"http://CitrixAppServerURL/scripts/ctxsta.dll");

//creat Secure Gateway conenction
SGConnectionRoute SGRoute = new SGConnectionRoute(@"https://CSGURL");
SGRoute.setUseSessionReliability(false);
SGRoute.setGatewayPort(80);
SGRoute.setTicketAuthorities(STAgr);
// add the SGRoute to the policy
policy.setDefault(SGRoute);

This is based on code I found on the Citrix Forums; however, it breaks my ability to connect with the Farm and get my application list!

Can someone point me to an example of code that works? Or a reference document?

© Stack Overflow or respective owner

Related posts about citrix

Related posts about secure-gateway