XF 2.1 Where to put custom authentication?

Karelke

Well-known member
In XenForo 1.x, we had a custom authentication class. It worked like this:

PHP:
<?php

class XenForo_Authentication_CompanyConnect extends XenForo_Authentication_Abstract
{
    protected $_data = array();

    public function setData($data)
    {
        $this->_data = unserialize($data);
    }

    public function generate($password)
    {
        // Logic
    }

    public function authenticate($userId, $password)
    {
        // Logic
    }

    private function _createHash($password, $salt)
    {
        // Logic
    }
}

This file was located in library/Company/CompanyConnect.php

In order for this to work, we updated the following MySQL table:

SQL:
UPDATE `xf_user_authenticate` SET scheme_class = 'XenForo_Authentication_CompanyConnect';

Is this still possible in XenForo 2, and what would be the quickest way to migrate?
 
PHP:
<?php

namespace XF\Authentication;

class Core extends AbstractAuth
{

PHP:
XF:Core12

PHP:
<?php

namespace XF\Authentication;

class Core12 extends AbstractAuth
{
public function getAuthenticationName()
{
   return 'XF:Core12';
}
/CODE]
 
Back
Top Bottom