<h1>Self Authorisation</h1>

<?php
   
if (array_key_exists('REMOTE_USER'$_SERVER) &&
      
# Authorisation based on the logged-in user:
      # Here: all users with user identifier length > 1 (practically all)
       
strlen($_SERVER['REMOTE_USER']) > 1) {

        echo 
'Logged in as ' .
        
htmlspecialchars($_SERVER['REMOTE_USER']) . ' - ' .
        
htmlspecialchars(utf8_decode($_SERVER['HTTP_SHIB_PERSON_COMMONNAME']));

        
# The actual web application can start at this point

   
} else {
        echo 
'<a href="/Shibboleth.sso/Login?target=https://www.tu-chemnitz.de/urz/www/auth/examples/dir23/">Login</a>';
   }
?>