000024633 - How to generate a Cookie from the Runtime API token and redirect to a URL

Document created by RSA Customer Support Employee on Jun 16, 2016Last modified by RSA Customer Support Employee on Apr 21, 2017
Version 2Show Document
  • View in full screen mode

Article Content

Article Number000024633
Applies ToClearTrust Authorization Server 5.5.3
IssueHow to generate a Cookie from the Runtime API token and redirect to a URL
It is possible to use the ClearTrust Java Runtime API to authenticate and authorize a user. The application then can generate a URL that will allow the authorized user to SSO (Single-Sign-On) with a website that is protected with ClearTrust. 

The token generated by the ClearTrust runtime API has to be set in the user?s browser as the Access Manager cookie for the website. It must be URL encoded. The name of the Cookie to set by default to CTSESSION.  (This is found in the webagent.conf file paramater cleartrust.agent.cookie_name=CTSESSION)

The following is an example of code to URL encode the token an set as a cookie. 

if ( token != null )
          StringBuffer sb = new StringBuffer();
          token = URLEncoder.encode(sb.toString());
          token = sb.toString();    
          Cookie cookie = new Cookie("CTSESSION", token);

Then perform some kind of redirect:
response.setHeader("Location","http://myserver.example.com/index.html"  );

Legacy Article IDa38256