SM_SERVERSESSIONID on single response header from Agent protected page
search cancel

SM_SERVERSESSIONID on single response header from Agent protected page

book

Article ID: 259568

calendar_today

Updated On:

Products

SITEMINDER CA Single Sign On Agents (SiteMinder) CA Single Sign On Secure Proxy Server (SiteMinder)

Issue/Introduction

 

When running an application on a Web Server, how can the web page retrieve the serversessionid when the user is authenticated and authorized by a Web Agent?

 

Resolution

 

At first glance, in PHP, this can be done that way:

  <?php

  foreach (getallheaders() as $name => $value) {
      echo "$name: $value\n";
      echo "<br />";
  }

  ?>

The resulting page:

  [...omitted for brevity...]

  SM_USER: jsmith
  SM_USERDN: cn=jsmith,dc=training,dc=com
  SM_SERVERSESSIONID: tzKtQB0oTGsecM1a7rMFSs3XMvo=
  SM_SERVERSESSIONSPEC: Rx40nQNRHStkHfDOa+fl+wz2a

  [...omitted for brevity...]

In an ASPX page, similar results can be obtained with this code:  

  <html>
  <body>
  <h3>here's the headers!!!</h3>

  <p><%
  Dim AllHttp As String
  AllHttp = Request.ServerVariables("ALL_HTTP")

  AllHttp = Replace(AllHttp, "HTTP", "<br>HTTP")
  Response.Write(AllHttp & "<br>")

  Dim Counter1, Counter2 As Integer
  Dim Keys(), subKeys() As String
  Dim HeaderColl As NameValueCollection

  HeaderColl=Request.Headers

  Keys = HeaderColl.AllKeys
  For Counter1 = 0 To Keys.GetUpperBound(0)
     Response.Write("Key: " & Keys(Counter1) & "<br>")
     subKeys = HeaderColl.GetValues(Counter1) ' Get all values under this key.
     For Counter2 = 0 To subKeys.GetUpperBound(0)
        Response.Write("Value " & CStr(Counter2) & ": " & subKeys(Counter2) & "<br>")
     Next Counter2
  Next Counter1

  %></p>

  </body>
  </html>

From these codes, instead of writing the header and its value in the Web Page, set the value in a variable for your application to use it.