Home Learn More Purchase Knowledge Base Support Contact

Community Forums

Forum » KBPublisher General discussion

Error - Not enough parameters returned by remoteDoAuth function.

(14 posts)
  • Started 11 months ago by gmrstudios
  • Latest reply from onesign

  1. gmrstudios
    Member

    I am receiving the following errors when trying to authenticate via LDAP.:

    Error - Not enough parameters returned by remoteDoAuth function and Error Not enough parameters returned by remoteDoAuth function

    When I use the first function shown in remote_authldap.php.txt I get:

    "Login failed! Wrong username and/or password"

    When I use the second function show in remote_authldap.php.txt I get:

    "Error Not enough parameters returned by remoteDoAuth function."

    I would assume the bind is going off without a hitch because it is not returning errors. I have triple checked my settings and everything looks to be in order.

    Any help you could give on solving this would be greatly appreciated.

    Posted 11 months ago #
  2. "Not enough parameters returned by remoteDoAuth function" means
    what it said, your function should return associative array with keys:

    first_name
    last_name
    email
    username
    password-- as the user types when they login, that is, not encrypted
    remote_user_id -- a unique userID stored in your system, integer
    role_id - (optional)
    priv_id - (optional) privilege for user. If user has a privilege, he will have access to Admin Area

    Please read these articles
    http://www.kbpublisher.com/kb/Using-Remote-Authentication_181.html

    Posted 11 months ago #
  3. gmrstudios
    Member

    Does that still apply when working with PHP for Active Directory? Here are the complete contents of my remote_auth.php file.


    define('KB_AUTH_LOCAL', 2); // returning exiting kb user

    function remoteDoAuth($username, $password) {

    require_once 'custom/adLDAP.php';

    $auth = false;
    if(empty($username) || empty($password)) {
    return $auth;
    }

    $username = addslashes($username);
    $password = addslashes($password);

    //create the AD LDAP connection
    $adldap = new adLDAP();

    // if found
    if($adldap->authenticate($username, $password)){
    $user = 1; // assign a user id, this user id should exists in kb user table
    }

    return $user;
    }


    I am supposed to add additional information to the function?

    I have _account_suffix, _base_dn, and _domain_controllers set correctly in adldap.

    Posted 11 months ago #
  4. Remote Authentication is a bit tricky, you should understand how it works.

    Adding/refreshing remote user data to KB and authenticate user

    KB_AUTH_TYPE = 1

    On success, the authentication function remoteDoAuth should return an associative array with the following keys:

    first_name
    last_name
    email
    username
    password-- as the user types when they login, that is, not encrypted
    remote_user_id -- a unique userID stored in your system, integer
    role_id - (optional)
    priv_id - (optional) privilege for user. If user has a privilege, he will have access to Admin Area

    Authentication by existing KBPublisher user

    KB_AUTH_TYPE = 2

    On success, the authentication function remoteDoAuth should return the user_id of the user in the KBPublisher USER table or an associative array with keys (user_id, username), for example: array('user_id'=>7, 'username'=>'Test').

    Posted 11 months ago #
  5. gmrstudios
    Member

    Ok, so after combing over my settings in remote_auth.php, config.inc.php, and adLDAP.php it looks like I am finally getting somewhere. In remote_auth.php when KB_AUTH_TYPE = 1 i get the following error:

    "Error Not enough parameters returned by remoteDoAuth function."

    However, when it is set to KB_AUTH_TYPE = 2 I seem to be authenticating against the LDAP database. The problem is the user is logged in as the admin account and displays the admin username! Regardless of the user that logs in they display the admins login name and have full admin area access

    Does KBPublisher create the user upon login after successful authentication? Or do you create a general user account and assign $user = in remote_auth.php to the general account?

    After two months of trying I am at my wits end! I have purchased a license and love the product but LDAP is necessary for full integration into our company. Does KBPublisher offer paid support?

    Posted 9 months ago #
  6. Please send us your remoteDoAuth function.

    Posted 9 months ago #
  7. gmrstudios
    Member

    Here is the remoteDoAuth function. I would like a new account created upon logon utilizing the sAMAccountName as the username. What fields are required? When I try other remoteDoAuth functions I get other errors.

    function remoteDoAuth($username, $password) {
    require_once 'custom/adLDAP.php';

    $auth = false; if(empty($username) || empty($password)) {
    return $auth;
    }

    //create the AD LDAP connection
    $adldap = new adLDAP();

    // if found
    if($adldap->authenticate($username, $password)){
    $user = 4; // assign a user id, this user id should exist in kb user table
    }

    return $user;
    }

    Posted 9 months ago #
  8. "Not enough parameters returned by remoteDoAuth function" means
    what it said, your function should return associative array with keys:

    first_name
    last_name
    email
    username
    password-- as the user types when they login, that is, not encrypted
    remote_user_id -- a unique userID stored in your system, integer
    role_id - (optional)
    priv_id - (optional) privilege for user. If user has a privilege, he will have access to Admin Area

    Please read these articles
    http://www.kbpublisher.com/kb/Using-Remote-Authentication_181.html

    Please see this example
    http://www.kbpublisher.com/kb/download/19/

    Posted 9 months ago #
  9. gmrstudios
    Member

    It is almost like I need a combonation of the two. The second method "// Example of using adLDAP - LDAP Authentication with PHP for Active Directory " works just fine. The problem is I would like it to create a unique user based off the AD username upon logon.

    Do you have an example of LDAP Authentican with PHP for Active Directory that creates a unique user upon logon?

    When I used the following code I received an error:

    function remoteDoAuth($username, $password) {
    
    	require_once 'custom/adLDAP.php';
    
    	$auth = false;
    	if(empty($username) || empty($password)) {
    		return $auth;
    	}
    
    	$username = addslashes($username);
    	$password = addslashes($password);
    
    	//create the AD LDAP connection
    	$adldap = new adLDAP();
    
    	// if found
    	if($adldap->authenticate($username, $password)){
    				// remote_user_id is a unique id for user in your system (integer)
    		$user['first_name'] = $username;
    		$user['last_name'] = $username;
    		$user['email'] = 'test@test.com';
    		$user['username'] = $username;
    		$user['password'] = $password;
    		$user['remote_user_id'] = $username;
    
    		// assign a priv to user (optional)
    		// it is fully up to you how to determine who is authenticated and what priv to assign
    		$user['priv_id'] = 3;
    
    		// assign a role to user (optional)
    		// it is fully up to you how to determine who is authenticated and what role to assign
    		$user['role_id'] = 1;
    	}
    
    	return $user;
    }
    ?>

    Database error!
    1366: Incorrect integer value: 'username' for column 'imported_user_id' at row 1

    We are authenticating against LDAP but it's not creating the user.

    Posted 9 months ago #
  10. Database error!
    1366: Incorrect integer value: 'username' for column 'imported_user_id' at row 1

    imported_user_id should be integer (number) it should be unique from your system
    not just any number. User data will be updated depends on this value.

    $user['remote_user_id'] = 1;

    Posted 9 months ago #
  11. gmrstudios
    Member

    Awesome! That seemed to work. How would you go about pulling the first_name, last_name and email from LDAP and populate the forms? I know this is probably more of an ADLDAP question but I figured I would ask here.

    Posted 9 months ago #
  12. I get same error, is this issue solved ?

    Posted 3 weeks ago #
  13. What error you have? "Error Not enough parameters returned by remoteDoAuth function." ?
    See this post please, all explained here.

    Posted 2 weeks ago #

RSS feed for this topic

Reply

You must log in to post.

© 2008 Double Jade LLC | customer.service@kbpublisher.com