コード例 #1
0
 protected function getClientCredentials()
 {
     $oauthQuery = new ProcessMaker\Services\OAuth2\PmPdo($this->getDsn());
     return $oauthQuery->getClientDetails($this->clientId);
 }
コード例 #2
0
ファイル: authorize.php プロジェクト: emildev35/processmaker
<?php

require_once PATH_CORE . 'src/ProcessMaker/Services/OAuth2/PmPdo.php';
G::LoadSystem('inputfilter');
$filter = new InputFilter();
$_GET = $filter->xssFilterHard($_GET, "url");
$_SERVER["QUERY_STRING"] = $filter->xssFilterHard($_SERVER["QUERY_STRING"], "url");
list($host, $port) = strpos(DB_HOST, ':') !== false ? explode(':', DB_HOST) : array(DB_HOST, '');
$port = empty($port) ? '' : ";port={$port}";
$dsn = DB_ADAPTER . ':host=' . $host . ';dbname=' . DB_NAME . $port;
$username = DB_USER;
$password = DB_PASS;
$this->scope = array('view_processes' => 'View Processes', 'edit_processes' => 'Edit Processes');
// $dsn is the Data Source Name for your database, for exmaple "mysql:dbname=my_oauth2_db;host=localhost"
$storage = new ProcessMaker\Services\OAuth2\PmPdo(array('dsn' => $dsn, 'username' => $username, 'password' => $password));
$clientId = $_GET['client_id'];
$requestedScope = isset($_GET['scope']) ? $_GET['scope'] : '';
$requestedScope = empty($requestedScope) ? array() : explode(' ', $requestedScope);
if (!empty($clientId)) {
    $clientDetails = $storage->getClientDetails($clientId);
    //g::pr($clientDetails); die;
}
$response = array('client_details' => $clientDetails, 'query_string' => $_SERVER['QUERY_STRING'], 'supportedScope' => $this->scope, 'requestedScope' => $requestedScope);
$response = $filter->xssFilterHard($response, "url");
?>

<table width="100%" cellspacing="0" cellpadding="0" border="0">
    <tbody>
    <tr>
        <td width="100%" style="height:25px"></td>
    </tr>