Updating PM Local OAuth authorization process
This commit is contained in:
@@ -1165,14 +1165,9 @@ class Bootstrap
|
|||||||
if (array_key_exists('alias', $apiIniConf)) {
|
if (array_key_exists('alias', $apiIniConf)) {
|
||||||
foreach ($apiIniConf['alias'] as $alias => $namespace) {
|
foreach ($apiIniConf['alias'] as $alias => $namespace) {
|
||||||
$namespace = '\\' . ltrim($namespace, '\\');
|
$namespace = '\\' . ltrim($namespace, '\\');
|
||||||
var_dump("$namespace, $alias");
|
|
||||||
$rest->addAPIClass($namespace, $alias);
|
$rest->addAPIClass($namespace, $alias);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
//var_dump($apiIniConf);die;
|
|
||||||
|
|
||||||
//$rest->addAPIClass('\Services\Api\ProcessMaker\Test');
|
|
||||||
//$rest->addAPIClass('\Services\Api\ProcessMaker\Test2','test');
|
|
||||||
|
|
||||||
$rest->handle();
|
$rest->handle();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -9,15 +9,15 @@ switch ($_SERVER['REQUEST_METHOD']) {
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
case 'POST':
|
case 'POST':
|
||||||
require_once PATH_CORE . 'services/oauth2/Server.php';
|
require_once PATH_CORE . 'src/Services/Api/OAuth2/Server.php';
|
||||||
|
|
||||||
list($host, $port) = strpos(DB_HOST, ':') !== false ? explode(':', DB_HOST) : array(DB_HOST, '');
|
list($host, $port) = strpos(DB_HOST, ':') !== false ? explode(':', DB_HOST) : array(DB_HOST, '');
|
||||||
$port = empty($port) ? '' : ";port=$port";
|
$port = empty($port) ? '' : ";port=$port";
|
||||||
|
|
||||||
\Api\OAuth2\Server::setDatabaseSource(DB_USER, DB_PASS, DB_ADAPTER.":host=$host;dbname=".DB_NAME.$port);
|
\Services\Api\OAuth2\Server::setDatabaseSource(DB_USER, DB_PASS, DB_ADAPTER.":host=$host;dbname=".DB_NAME.$port);
|
||||||
\Api\OAuth2\Server::setPmClientId('x-pm-local-client');
|
\Services\Api\OAuth2\Server::setPmClientId('x-pm-local-client');
|
||||||
|
|
||||||
$oauthServer = new \Api\OAuth2\Server();
|
$oauthServer = new \Services\Api\OAuth2\Server();
|
||||||
$userid = $_SESSION['USER_LOGGED'];
|
$userid = $_SESSION['USER_LOGGED'];
|
||||||
$authorize = isset($_POST['authorize']) ? (bool) $_POST['authorize'] : false;
|
$authorize = isset($_POST['authorize']) ? (bool) $_POST['authorize'] : false;
|
||||||
|
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
<?php
|
<?php
|
||||||
require_once PATH_CORE . 'services/oauth2/PmPdo.php';
|
require_once PATH_CORE . 'src/Services/Api/OAuth2/PmPdo.php';
|
||||||
|
|
||||||
|
|
||||||
list($host, $port) = strpos(DB_HOST, ':') !== false ? explode(':', DB_HOST) : array(DB_HOST, '');
|
list($host, $port) = strpos(DB_HOST, ':') !== false ? explode(':', DB_HOST) : array(DB_HOST, '');
|
||||||
@@ -15,7 +15,7 @@ $this->scope = array(
|
|||||||
);
|
);
|
||||||
|
|
||||||
// $dsn is the Data Source Name for your database, for exmaple "mysql:dbname=my_oauth2_db;host=localhost"
|
// $dsn is the Data Source Name for your database, for exmaple "mysql:dbname=my_oauth2_db;host=localhost"
|
||||||
$storage = new Api\OAuth2\PmPdo(array('dsn' => $dsn, 'username' => $username, 'password' => $password));
|
$storage = new Services\Api\OAuth2\PmPdo(array('dsn' => $dsn, 'username' => $username, 'password' => $password));
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user