Title: php-borealis-authentication library to check authentication topic: sample (start code) // ----------------------------------------------- // --- Step 1 : Mettre la source de borealis-authentication et borealis-foundation disponible dans le classe path // ----------------------------------------------- set_include_path('.;../../main/src;../../../borealis-foundation/main/src'); // ----------------------------------------------- // --- Step 2 : Inclure la classe responsable du chargement des autre classe (com/borealis/Autoload) // ----------------------------------------------- require_once 'com/borealis/Autoload.php'; // ----------------------------------------------- // --- Step 3 : Configurer la library borealis-authentication, l'ui indiquer la liste des checher (Serveur d'authentification ou méthode d'authentification) // ----------------------------------------------- // ---- Constructeur de Password (Password = class qui encode le mot de passe dans le bon format) // ---- // Createur de mot de passe en texte claire $objRawPasswordCreator = new com_borealis_authentication_password_RawPasswordCreator(); // Créateur de mot de passe qui encode le mot de passe en md5 $objMD5PasswordCreator = new com_borealis_authentication_password_MD5PasswordCreator(); // Créateur de mot de passe qui encode le mot de passe dans le même format que la v2 $objV2PasswordCreator = new com_borealis_authentication_password_V2PasswordCreator(); // ---- Checker (Serveur d'authentification ou méthode d'authentification) // ---- // Checker qui vérifie les droits de connexion par un serveur Alfresco $g_strAlfrescoUrl = 'http://192.168.5.121:8081/alfresco/service/api/login.xml'; $g_objAlfrescoChecker1 = new com_borealis_authentication_checker_AlfrescoChecker($objRawPasswordCreator, $g_strAlfrescoUrl); $g_objAlfrescoChecker2 = new com_borealis_authentication_checker_AlfrescoChecker($objMD5PasswordCreator, $g_strAlfrescoUrl); // Checker qui vérifie les droits de connexion par un serveur JOSSO $g_strJossoUrl = 'http://192.168.5.121:9997/josso/services/SSOIdentityProvider?wsdl'; $g_strJossoSecurityDomain = 'josso'; $g_objJossoChecker1 = new com_borealis_authentication_checker_JossoChecker($objRawPasswordCreator, $g_strJossoUrl, $g_strJossoSecurityDomain); $g_objJossoChecker2 = new com_borealis_authentication_checker_JossoChecker($objV2PasswordCreator, $g_strJossoUrl, $g_strJossoSecurityDomain); // Checker qui vérifie les droits de connexion par un serveur LDAP $g_strLDAPHostname = '192.168.1.39'; $g_iLDAPPort = 389; $g_strLDAPSearchDN = 'ou=People,dc=boreal-is,dc=com'; $g_strLDAPUsernameColumn = 'uid'; $g_strLDAPArrayOptions = array(LDAP_OPT_PROTOCOL_VERSION => 3); $g_objLDAPChecker = new com_borealis_authentication_checker_LdapChecker($objRawPasswordCreator, $g_strLDAPHostname, $g_iLDAPPort, $g_strLDAPSearchDN, $g_strLDAPUsernameColumn, $g_strLDAPArrayOptions) ; // Checker qui vérifie les droits de connexion par une BD $g_strPDODSN = 'pgsql:host=192.168.5.121;port=5432;dbname=qa_application;user=postgres;password=postgres'; $g_strPDOQuery = 'select users_id from users where users_login = :username and users_password = :password'; $g_objPDOChecker1 = new com_borealis_authentication_checker_PDOChecker($objRawPasswordCreator, $g_strPDODSN, $g_strPDOQuery); $g_objPDOChecker2 = new com_borealis_authentication_checker_PDOChecker($objV2PasswordCreator, $g_strPDODSN, $g_strPDOQuery); // Checker qui vérifie les droits de connexion par un fichier XML $g_strXMLFILE = dirname(__FILE__).'/users.xml'; $g_objXMLChecker1 = new com_borealis_authentication_checker_XMLChecker($objRawPasswordCreator, $g_strXMLFILE); $g_objXMLChecker2 = new com_borealis_authentication_checker_XMLChecker($objMD5PasswordCreator, $g_strXMLFILE); // ---- com_borealis_authentication_SettingImpl setCheckers (Permet d'indiquer la liste des Checker qui serons utiliser par le com_borealis_authentication_AuthenticationManager) // ---- // You can set one checker com_borealis_authentication_SettingImpl::setCheckers(array($g_objAlfrescoChecker1)); // Or more than one checker (All checker are call and if one return true the result is true) com_borealis_authentication_SettingImpl::setCheckers(array($g_objXMLChecker1, $g_objPDOChecker1)); // ----------------------------------------------- // --- Step 4 : Test if user is authorized to login // ----------------------------------------------- $bIsAuthorized = com_borealis_authentication_AuthenticationManager::isAuthorized('Username','Password'); if ($bIsAuthorized) { // You are Authorized // Save in session one variable to say you are Authorized for not call checker on each session call // Show you securer page } else { // You are not Authorized // Show the login page } (end)