mirror of
https://github.com/alchemy-fr/Phraseanet.git
synced 2025-10-18 15:33:15 +00:00
Add configuration option to disable SSL requirement on API
This commit is contained in:
@@ -6,6 +6,7 @@ main:
|
|||||||
maintenance: false
|
maintenance: false
|
||||||
languages: []
|
languages: []
|
||||||
key: ''
|
key: ''
|
||||||
|
api_require_ssl: true
|
||||||
database:
|
database:
|
||||||
host: 127.0.0.1
|
host: 127.0.0.1
|
||||||
port: 3306
|
port: 3306
|
||||||
|
@@ -16,6 +16,7 @@ use Alchemy\Phrasea\Authentication\Exception\AccountLockedException;
|
|||||||
use Alchemy\Phrasea\Authentication\Exception\RequireCaptchaException;
|
use Alchemy\Phrasea\Authentication\Exception\RequireCaptchaException;
|
||||||
use Alchemy\Phrasea\Authentication\Phrasea\PasswordAuthenticationInterface;
|
use Alchemy\Phrasea\Authentication\Phrasea\PasswordAuthenticationInterface;
|
||||||
use Alchemy\Phrasea\Controller\Controller;
|
use Alchemy\Phrasea\Controller\Controller;
|
||||||
|
use Alchemy\Phrasea\Core\Configuration\PropertyAccess;
|
||||||
use Alchemy\Phrasea\Core\Event\PostAuthenticate;
|
use Alchemy\Phrasea\Core\Event\PostAuthenticate;
|
||||||
use Alchemy\Phrasea\Core\Event\PreAuthenticate;
|
use Alchemy\Phrasea\Core\Event\PreAuthenticate;
|
||||||
use Alchemy\Phrasea\Core\PhraseaEvents;
|
use Alchemy\Phrasea\Core\PhraseaEvents;
|
||||||
@@ -174,8 +175,11 @@ class OAuth2Controller extends Controller
|
|||||||
*/
|
*/
|
||||||
public function tokenAction(Request $request)
|
public function tokenAction(Request $request)
|
||||||
{
|
{
|
||||||
if ( ! $request->isSecure()) {
|
/** @var PropertyAccess $config */
|
||||||
throw new HttpException(400, 'This route requires the use of the https scheme', null, ['content-type' => 'application/json']);
|
$config = $this->app['conf'];
|
||||||
|
|
||||||
|
if ( ! $request->isSecure() && $config->get(['main', 'api_require_ssl'], true) == true) {
|
||||||
|
throw new HttpException(400, 'This route requires the use of the https scheme: ' . $config->get(['main', 'api_require_ssl']), null, ['content-type' => 'application/json']);
|
||||||
}
|
}
|
||||||
|
|
||||||
$this->oAuth2Adapter->grantAccessToken($request);
|
$this->oAuth2Adapter->grantAccessToken($request);
|
||||||
|
@@ -5,6 +5,7 @@ languages:
|
|||||||
main:
|
main:
|
||||||
maintenance: false
|
maintenance: false
|
||||||
key: ''
|
key: ''
|
||||||
|
api_require_ssl: true
|
||||||
database:
|
database:
|
||||||
host: 'sql-host'
|
host: 'sql-host'
|
||||||
port: 3306
|
port: 3306
|
||||||
|
@@ -5,6 +5,7 @@ languages:
|
|||||||
main:
|
main:
|
||||||
maintenance: false
|
maintenance: false
|
||||||
key: ''
|
key: ''
|
||||||
|
api_require_ssl: true
|
||||||
database:
|
database:
|
||||||
host: 'sql-host'
|
host: 'sql-host'
|
||||||
port: 3306
|
port: 3306
|
||||||
|
Reference in New Issue
Block a user