Playing around with the SSGD API (Part 2 : API-test pages)
During installation of Sun Secure Global Desktop (SSGD) a couple of extra web tools are created for SSGD Administrators/Developers. One of these web tools is an API testing tool for Developers. The base URL is:
http://[FQDN_SSGD_Server]/sgd/admin/apitest/The webpage shown on this URL is divided in two parts. The left containing a menu where all the API-calls can be found and on the right hand side there is space for the result of the performed API-calls.

All available API-calls can be issued by using the menu. Most of the menu-items have a sub-menu with the actual API-calls. In the following example we will only use the menu-items 'webtopsession' and 'emulatorsession'.
To manually start an application using API calls at least to following steps need to be performed:
- Authenticate the user
- Set the configuration of the TCC (The SGD Client Connector)
- Start the TCC
- Start the SGD Application
- System Authentication; The authentication is performed from within SSGD using the provided username and password.
- Third Party Authentication; The authentication is performed by a trusted external application/service which passed the user-ID to SSGD.
Authenticate the user by using the main API-test menu item: webtopsession
Use the function: authenticate

In the right frame the result is shown with the most important attribute 'scottasessioncookie'. This attribute contains the ID of the 'webtop'-session. With the field 'Auto-fill Cookie' enabled the the session ID will be filled in automatically for all following API calls.
Just a click on the 'Call' button is sufficient to provide all information.
- Check if the correct TCC is already 'installed', if not download the TCC
- Start the TCC with the correct parameters
If all goes well the TCC will be started and we are ready to start a SSGD Application.
The API-calls in the group 'emulatorsession' can be used to start, resume, suspend and list application sessions.
To start an application go to the API-call startSession (API-test main menu -> emulatorsession -> startSession). Fill in the Application Name (like: .../_ens/o=applications/cn=My Desktop) and click 'Call'.
To see which applications the user may start an API-call from the 'webtopcontent'-group must be used (searchWebtopContent), but a simple shortcut for this command is available: 'List Webtop'
The Application will start up just like it will be when clicking the Application-link in the browser-based-webtop.
Same Example in JSP-file
On the Sun wiki a example JSP-file is available which performs the same API-calls: Single sign-on JSP
By placing the attachement in the directory/opt/tarantella/webserver/tomcat/[version]/webapps/sgdAfter providing the same information from the example above in the JSP-file, the manual called API-calls can be performed automatically.
Perform the following API-calls to start an application:
- webtopsession -> authenticate : Provide Username and Password
- webtopsession -> setTCCConfiguration
- webtopsession -> startTCC
- emulatorsession -> startSession : Provide Application-name