Subversion Repositories spnego

[/] [trunk/] [extension/] [spnego/] [sso_handler/] [ezspnegossohandler.php] - Blame information for rev 1

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 1 cyberwolf
<?php
2
 
3
class eZSPNEGOSSOHandler
4
{
5
    function eZSPNEGOSSOHandler()
6
    {
7
    }
8
 
9
    /*!
10
     \todo add an INI option to specify that an authenticated user should be created automatically in the eZ publish database
11
     \todo if basic auth is used, we should tell the user how to set up Negotiate authentication with Firefox
12
           maybe set some global variable with messages which can be checked in the pagelayout, and give the user the possibility
13
           to disable displaying the message with a user preference
14
    */
15
    function handleSSOLogin()
16
    {
17
        include_once( 'lib/ezutils/classes/ezdebugsetting.php' );
18
 
19
        if ( array_key_exists( 'REMOTE_USER', $_SERVER ) && array_key_exists( 'AUTH_TYPE', $_SERVER ) )
20
        {
21
            $remoteUser = $_SERVER['REMOTE_USER'];
22
            $authType = $_SERVER['AUTH_TYPE'];
23
 
24
            eZDebugSetting::writeDebug( 'kernel-user', 'remote user: ' . $remoteUser, 'authentication type: ' . $authType, 'eZSPNEGOSSOHandler' );
25
 
26
            $loginParts = explode( '@', $remoteUser );
27
            $loginName = $loginParts[0];
28
 
29
            $user = eZUser::fetchByName( $loginName );
30
            // if not found eZUser::fetchByName returns NULL, but the return value of this function will be checked with !== false in eZUser::instance
31
            if ( is_object( $user ) )
32
            {
33
                return $user;
34
            }
35
            else
36
            {
37
                eZDebugSetting::writeDebug( 'kernel-user', 'unable to fetch remote user from local database', 'eZSPNEGOSSOHandler' );
38
            }
39
        }
40
        else
41
        {
42
            eZDebugSetting::writeDebug( 'kernel-user', 'no sso authentication performed', 'eZSPNEGOSSOHandler' );
43
        }
44
 
45
        return false;
46
    }
47
}
48
 
49
?>