Forums

Unfortunately no one can be told what FluxBB is - you have to see it for yourself.

You are not logged in.

#1 2014-06-27 07:17:47

fisharebest
Member
Registered: 2014-02-01
Posts: 5

2.0 Auth Integration

Franz wrote:

Yeah, I'm still trying to figure out what's the best way to integrate the authentication of existing sites with FluxBB's auth.

Have you had any ideas regarding this?  Here is a suggestion.

Laravel 4.2 implements the "remindable interface" using traits.  See laravel.com/docs/security#password-reminders-and-reset

We could use a similar approach for FluxBB.  For example, the host application could use this:

namespace MyApp;

class User implements FluxBBUserInterface {
  use FluxBBUserTrait;

  ...
};

If FluxBB is being used on its own, then Auth::user() returns a FluxBB\Models\User object.

But if FluxBB is being used inside a host application, Auth::user() returns a MyApp\User object - which is now also a FluxBB\Models\User object.

Of course, there is the problem that the myapp_users table does not contain the columns that are found in fluxbb_users.  Perhaps the host could simply add the extra columns to the myapp_users table.

EDIT: I just tried this - and it seems to work OK.  I authenticate using my host application, and I am now authenticated in FluxBB.  These are the only modifications I needed to make in my host application

use FluxBB\Models\UserInterface as FluxBBUserInterface;
use FluxBB\Models\UserTrait as FluxBBUserTrait;

class User extends Eloquent implements UserInterface, RemindableInterface, FluxBBUserInterface {
	use RemindableTrait, FluxBBUserTrait;

Last edited by fisharebest (2014-06-27 10:34:11)

Offline

#2 2014-06-27 18:36:52

Gil
Member
From: France
Registered: 2008-05-10
Posts: 167
Website

Re: 2.0 Auth Integration

Sure, it would be very great if:

  • an external component/appli can easily use the FluxBB authentication (API?)

  • FluxBB can be easily patched to use an external authentication

Offline

#3 2014-06-27 19:01:32

fisharebest
Member
Registered: 2014-02-01
Posts: 5

Re: 2.0 Auth Integration

Gil wrote:

Sure, it would be very great if:

  • an external component/appli can easily use the FluxBB authentication (API?)

I think this is already possible.  See

\FluxBB\Models\User::current()
\FluxBB\Models\User::guest()
\FluxBB\Models\User::isMember()
etc.

Gil wrote:
  • FluxBB can be easily patched to use an external authentication

My change does this.  The external application needs to add just a few lines of code.

Offline

#4 2014-06-27 19:10:10

Franz
Lead developer
From: Germany
Registered: 2008-05-13
Posts: 6,047
Website

Re: 2.0 Auth Integration

Yes, I want our own auth system for FluxBB, that can be integrated with other applications / libraries just by implementing an interface.

See this ticket: https://fluxbb.org/development/core/tickets/726/

What you posted, fisharebest, is going in the right direction.

P.S.: I splitted this off from the old topic.


fluxbb.de | develoPHP

"As code is more often read than written it's really important to write clean code."

Offline

Board footer

Powered by FluxBB 1.5.8