Solved! Go to Solution.
<!DOCTYPE html>
<html>
 <head>
  <title>Secure Access</title>
 </head>
 <body>
  <?php
  // Start session to track this users identity
  session_start();
  // Make sure they aren't already in a session; if so, redirect to GIS Home
  // IWP_loggedIn is boolean, 'true'; if there is a session, credentials are already stored
  if ($_SESSION['IWP_loggedIn']) {
   // Redirect to the secure content (ArcGIS JavaScript app with secured ArcGIS Server services)
   // header("Location: http://example.com/gis.php");
   // TEST MODE: print the authorized user name
   echo $_SERVER['LOGON_USER'];
   // Make sure that code below does not get executed when we redirect
   exit();
  } else {
   // If no session is started and no authentication has been performed
   if (empty($_SERVER["LOGON_USER"])) {
    // If user is not in intranet, or browser is not enabled for SSO
    // IIS/browser prompt for credentials; this message is a stand-in for now
    echo "<h1>Please login with your credentials to access GIS data</h1>";
    // Create session logged-in variable to track user
    $_SESSION['IWP_loggedIn'] = TRUE;
    // Store credentials (how do I pass on username/password or key to the next site?)
    $_SESSION["IWPUser"] = $_SERVER["LOGON_USER"];
    //Redirect, credentials passed via PHP session
    // header("Location: http://example.com/gis.php");
    // TEST MODE: print the authorized user name
    echo $_SERVER['LOGON_USER'];
    // Make sure that code below does not get executed when we redirect
    exit();
    }
   // If user is on intranet and browser is enabled for SSO, automatic login occurs
   // "LOGON USER" field will be filled, auto-redirect to map
   if (!empty($_SERVER["LOGON_USER"])) {
    echo "Oh Joy!!!";
    // Create session logged-in variable to track user
    $_SESSION['IWP_loggedIn'] = TRUE;
    // Store credentials (how do I pass on username/password or key to the next site?)
    $_SESSION["IWPUser"] = $_SERVER["LOGON_USER"];
    // Redirect, credentials passed via PHP session
    // header("Location: http://example.com/gis.php");
    // TEST MODE: print the authorized user name
    echo $_SERVER['LOGON_USER'];
    // Make sure that code below does not get executed when we redirect
    exit();
   }
  }
  ?>
 </body>
</html>
					
				
			
			
				
			
			
				
			
			
			
			
			
			
		<?php
// Start session to track this users identity
session_start();
// Make sure they are logged in, if not redirect to login
// IWP_loggedIn is boolean, 'true'
if (!$_SESSION['IWP_loggedIn']) {
 // Redirect to the secure content
 header("Location: http://example.com/login.php");
 // Make sure that code below does not get executed when we redirect
 exit();
}
else {
 //talk to ArcGIS Server/Web Adaptor to tell it the users credentials
}
?>