Below is my code from REST Api plugin ;
Code: Select all
<?php
defined('_JEXEC') or die;
class LdapapiApiResourceQuery extends ApiResource
{
public function post() {
// Instantiate the application.
$app = JFactory::getApplication();
jimport('joomla.plugin.helper');
$app = JFactory::getApplication();
$data = json_decode(file_get_contents('php://input'), true);
$username = $data["username"];
$password = $data["pwd"];
if ($app->login(array('username'=>$username,'password'=>$password))) {
$this->plugin->setResponse(true);
}else{
$this->plugin->setResponse(false);
}
}
}
Doing a var_dump($credentials), the array return from $username and $password string is empty.
Code: Select all
<?php
defined('_JEXEC') or die;
use Joomla\Ldap\LdapClient;
/**
* LDAP Authentication Plugin
*
* @since 1.5
*/
class plgAuthenticationStmLDAP extends JPlugin
{
public function onUserAuthenticate($credentials, $options, &$response)
{
var_dump($credentials);
exit;
[code]
Can someone help me understand what went wrong with the above implementation.
Thank you in advance