Atk4 has basic login functionality and I could build it out to add user registration, forgotten password link, email verify etc using atk4, tmail templates and so on. But if I want to integrate it with an existing open source application that already provides that functionality, what do I need to do to allow that systems login to be allowed so that atk4 protected pages can be viewed after login on the third party app?
Share
There are four alternatives.
Separate sites, separate domains, separate servers, separate database
The most secure way to do that is by passing secure token from the other system to Agile Toolkit. The token should contain the username and hash of some secret passphrase along with that username
$user.":".md5($secret.":".$user)You can check the argument inside API Class:
Separate site, domain, but same user access
You would need to build same encryption in Agile Toolkit Auth class. Fortunately you can easily do that, by re-defining encryptPassword
If you need different connection to database you can also add:
Sharing session – same domain and same computer, but no code access
Agile Toolkit uses the Application’s realm as a name. That’s the argument you specify to the constructor when you create your app instance inside index.php:
You would need to call
Then you need to set the session variable, something like myrealm_MyAuth_info, you can probably get this by dumping contents of $_SESSION from Agile Toolkit. You need to set it to something like array(‘user’=>’john’), as long as it’s not “false” anything is ok.
Sharing computer, domain, session and some code
This is similar to previous approach, but it should be easier to do:
This assumes that your “Frontend” class properly sets the “auth”. If this does not work, some tweaks might be needed, for example you might want to move $auth->check() into initLayout() function, if you are calling it from within API.