In this example, we assume that your system administrator has configured the system so that Apache knows you by the username you used to login to your computer and that it makes this information available to PHP in the authenticated_user variable. In this setup, we can completely skip the login screen and log you in directly, based on the data provided by the system.
We will call this authentication provider ApacheAuthenticationProvider and we'll define it in /activecollab/angie/classes/auth/providers/ApacheAuthenticationProvider.class.php. Because we're not using the normal activeCollab login process, we can skip the authentication() method and implement the initialization() method instead:
class ServerAuthenticationProvider extends AuthenticationProvider {
function initialize() {
$user = Users::findById($_SERVER['user_id']);
if(instance_of($user, 'User')) {
return $this->logUserIn($user);
} else {
return new Error('User not recognized');
} // if
} // initialize
}
If you are properly logged in within your network, the system will skip the login screen and automatically log you in every time you visit activeCollab .