Override SAML2AuthenticateUser


I want to override a function in the ‘SAML2AuthenticateUser’ class. I already tried this:https://community.suitecrm.com/t/how-to-override-emailman-class-function/68559/10 , but it’s not working. I want to override the function ‘authenticateUser’.

$customBeanList['User'] = 'SAML2AuthenticateUser';
$customBeanFiles['User'] = 'custom/modules/User/authentication/SAML2Authenticate/SAML2AuthenticateUser.php';

if (!defined('sugarEntry') || !sugarEntry) {
    die('Not A Valid Entry Point');

require_once 'modules/Users/authentication/SAML2Authenticate/SAML2AuthenticateUser.php';

class CustomSAML2AuthenticateUser extends SAML2AuthenticateUser
    public function authenticateUser($name, $password, $fallback = false, $checkPasswordMD5 = false)

        return '';

I did a build and repair, no errors, but unfortunately I am not going through this function.

Anyone any idea, or is it just not possible to overwrite this function?

That way of customizing won’t work, because that is not a Bean (not a SuiteCRM module).

I had a quick glance at the code and I think a simple file override in SuiteCRM custom directory should work, because of this:


You’ll have to check.

You will need to use the entire file copied from the original, you can’t override a single method. But since it is a small file this won’t be too problematic, hopefully.

Thank you for the respond and the perfect answer.

You were right. I only copied the file to the correct location, which in my case was:


And then changed the “required_once” path, because this will direct you to the wrong file. So I changed the path to an absolute path, like this:

require_once '/{MainFolder}/modules/Users/authentication/SugarAuthenticate/SugarAuthenticateUser.php';

And then the functions will be triggered! :smile:

1 Like