PM-2112 "0016986: REST endpoint PUT /{workspace}/oauth2/token sets.." SOLVED

Issue:
    0016986: REST endpoint PUT /{workspace}/oauth2/token sets the HTTP status to 200 (OK) when error
Cause:
    Al obtener un "access token" con informacion erronea, no se define correctamente el response de error
Solution:
    Se define un response de error, cuando el "HTTP status" es 400
This commit is contained in:
Victor Saisa Lopez
2015-04-10 12:30:04 -04:00
parent 7ca6cb9a13
commit 8f7da244cc

View File

@@ -204,7 +204,7 @@ class Server implements iAuthenticate
$clientId = $_GET['client_id'];
$requestedScope = isset($_GET['scope']) ? $_GET['scope'] : '*';
$requestedScope = empty($requestedScope) ? array() : explode(' ', $requestedScope);
$client = $this->storage->getClientDetails($clientId);;
$client = $this->storage->getClientDetails($clientId);
if (empty($client)) {
// throw error, client does not exist.
@@ -309,7 +309,17 @@ class Server implements iAuthenticate
if ($returnResponse) {
return $response;
} else {
$response->send();
if ($response->getStatusCode() == 400) {
$msg = $response->getParameter("error_description", "");
$msg = ($msg != "")? $msg : $response->getParameter("error", "");
$rest = new \Maveriks\Extension\Restler();
$rest->setMessage(new \Luracast\Restler\RestException(\ProcessMaker\Services\Api::STAT_APP_EXCEPTION, $msg));
exit(0);
} else {
$response->send();
}
}
}