array( 'password' => 'student', 'uid' => 'student', 'name' => 'Student Name', 'mail' => 'somestudent@example.org', 'type' => 'student', ), 'admin' => array( 'password' => 'admin', 'uid' => 'admin', 'name' => 'Admin Name', 'mail' => 'someadmin@example.org', 'type' => 'employee', ), ); /* * Time to handle login responses. * Since this is a dummy example, we accept any data. */ $badUserPass = FALSE; if ($_SERVER['REQUEST_METHOD'] === 'POST') { $username = (string)$_REQUEST['username']; $password = (string)$_REQUEST['password']; if (!isset($users[$username]) || $users[$username]['password'] !== $password) { $badUserPass = TRUE; } else { $user = $users[$username]; if (!session_id()) { /* session_start not called before. Do it here. */ session_start(); } $_SESSION['uid'] = $user['uid']; $_SESSION['name'] = $user['name']; $_SESSION['mail'] = $user['mail']; $_SESSION['type'] = $user['type']; SimpleSAML_Utilities::redirectTrustedURL($returnTo); } } /* * If we get this far, we need to show the login page to the user. */ ?> exampleauth login page

exampleauth login page

In this example you can log in with two accounts: student and admin. In both cases, the password is the same as the username.

Bad username or password.

Username:

Password: