Skip to:
Content
Pages
Categories
Search
Top
Bottom

integrating with external authentication system

Viewing 5 replies - 1 through 5 (of 5 total)
  • Actually, to be more specific, it looks like I should be replacing one of the following functions: bb_auth(), bb_is_user_authorized(), bb_is_user_logged_in(), or bb_get_current_user().

    However, I’m not sure which ones to leave alone (in case they are used by other parts of the application), or how to specify the user ID.

    Still trying to figure this out–I think I just need to find the place where bbPress finds out the ID of the current user, and insert my own function.

    I looked in class.wp-auth.php as well as pluggable.php. As a test, I tried changing the validate_auth_cookie and get_current_user functions to “return XXXXX” in order to login user XXXXX automatically, but it didn’t work. I’m not sure if I’m changing the right functions, or if I’m returning the wrong information.

    Is the ID number enough information to log a user in?

    Where does it need to be provided?

    There are a number of old threads with similar questions, but it seems like nobody has found an answer…

    Thanks again!

    Oh, last post was a mistake. :)

    I finally figured it out. I was right with the last thing I tried…the function to change was validate_auth_cookie, which should return an integer representing the user ID. (It wasn’t working because I hadn’t yet set that user’s capabilities in the database.)

    So, for anyone trying to do the same thing: the function that needs to be rewritten is validate_auth_cookie in class.wp-auth.php. Write your own function to validate the cookie, and return a user ID (int).

    @panchz

    Member

    I had that same problem when trying to make only one register & only one login from my site with bbpress integration.

    register is easy, I just wrote directly to the db from php using the hash classes included. but for login i made a kind of webservice. When I login from tomcat I just request the next url…

    http://www.mysite.com/bbpress-root-dir/bb-login-check.php?user_login=USER&password=PASSWORD&remember=yes

    and i wrote the next code for bb-login-check.php

    <?php

    // Load bbPress.

    require(‘./bb-load.php’);

    // Redirect to an SSL page if required.

    bb_ssl_redirect();

    $user = bb_login( @$_GET, @$_GET, @$_GET );

    if ( $user && !is_wp_error( $user ) ) {

    echo “0”;//login successfully

    exit;

    }else{

    echo “1”; //login fail

    exit;

    }

    ?>

    i hope that’s usefull…

    for any question or help needed for bbpress or wordpress try fran.rod.rod [at] gmail.com

    @wilsonpilar

    Member

    Hi,

    I do like [panchz] but i cannot include it in my function login. I dont know why! but the globals vars lost in the script!

    then i make this and works fine!

    /**

    * Function login from my system

    */

    function login() {

    $login = $_POST;

    $password = $_POST;

    require INCLUDE_PATH.’forumbb-load.php’;

    $schemes[] = ‘auth’;

    $schemes[] = ‘logged_in’;

    $expiration = time() + 172800;

    $expire = 0; /* 0 or 1*/

    foreach ( $schemes as $scheme ) {

    $wp_auth_object->set_auth_cookie( USER_ID , $expiration, $expire, $scheme );

    }

Viewing 5 replies - 1 through 5 (of 5 total)
  • You must be logged in to reply to this topic.
Skip to toolbar