Penn Computing
Computing Menu Computing A-Z
Computing Home Information Systems & Computing Penn
The following instructions apply to using Websec to authenticate for web applications. Websec was retired in December 2009 and replaced by a new authentication system, Penn Weblogin.

Example PHP code to interact with the web-security module

We provide example PHP code that can interact with the web-security module. To use these routines, you can:
  1. copy the routines into a PHP file, like websec.php
  2. edit your copy of the PHP file and define:
    • $websec_app - the name of your registered websec application
    • $websec_client - the full filepath to the websec_client binary as installed on your system.
      Note: If you are running PHP in a restricted mode, you need to install the websec_client in the PHP safe_mode_exec_dir
  3. include your PHP file and call websec_require($websec_token) at the top of every page you want to authenticate.
    • If $websec_token is not defined or null the function automatically redirects the user to the websec authentication page. The function also checks for timeouts
    • Alternatively use session variables to avoid passing around $websec_token as a GET or POST variable.

Example of an authenticated PHP page


Information Systems and Computing
University of Pennsylvania
Comments & Questions

University of Pennsylvania Penn Computing University of Pennsylvania Information Systems & Computing (ISC)
Information Systems and Computing, University of Pennsylvania