Skip to content
Snippets Groups Projects
Select Git revision
  • fadf44e49f0abde3927e2679969f23eda96c43d5
  • master default protected
  • simple-task/7248-eol-check-add-node-22
  • 6877_check_iml_deployment
4 results

check_fs_errors

Blame
  • userauth.ldap.class.php 1.54 KiB
    <?php
    
    require_once("userauth.interface.php");
    require_once("ldap.class.php");
    
    /**
     * user authentication :: LDAP
     * implements userauth interface
     * 
     * @author hahn
     * 
     * Axel <axel.hahn@unibe.ch>
     * 2024-08-29  Axel php8 only; added variable types
     */
    class userauthLdap implements iUserAuth
    {
    
        /**
         * object for ldap actions
         * @var object
         */
        private object $_oLdap;
    
        // ----------------------------------------------------------------------
        // 
        // ----------------------------------------------------------------------
    
        /**
         * Constructor
         */
        public function __construct()
        {
            global $aConfig;
            $this->_oLdap = new imlldap($aConfig['auth']['ldap']);
    
            // first test of ldap connection
            // $this->_oLdap->debugOn();
            $this->_oLdap->connect();
        }
    
        /**
         * Destructor
         * Close ldap connection
         */
        public function __destruct()
        {
            $this->_oLdap->close();
        }
    
        // ----------------------------------------------------------------------
        // implementation
        // ----------------------------------------------------------------------
    
        /**
         * Verify if a given user and password combination is correct
         * 
         * @param string  $sUser      username
         * @param string  $sPassword  password
         * @return boolean
         */
        public function authenticate(string $sUser, string $sPassword): bool
        {
            return $this->_oLdap->verifyPassword($sUser, $sPassword);
        }
    
    }