summaryrefslogtreecommitdiffstats
path: root/apps/oauth2
diff options
context:
space:
mode:
authorMorris Jobke <hey@morrisjobke.de>2018-12-07 15:35:24 +0100
committerGitHub <noreply@github.com>2018-12-07 15:35:24 +0100
commitf7e471877995a222548b0a1674618a3e654b4656 (patch)
treefd736e36d8e6aa8255ac0f88141992da54bad432 /apps/oauth2
parentcfcce69272ca684cad32843d780cd31d01038e72 (diff)
parentb9ac258870314a60ca5326d822ca404a19497e6c (diff)
downloadnextcloud-server-f7e471877995a222548b0a1674618a3e654b4656.tar.gz
nextcloud-server-f7e471877995a222548b0a1674618a3e654b4656.zip
Merge pull request #12910 from nextcloud/td/oauth/strict
Make OAuth2 app strict
Diffstat (limited to 'apps/oauth2')
-rw-r--r--apps/oauth2/lib/Controller/LoginRedirectorController.php5
-rw-r--r--apps/oauth2/lib/Controller/OauthApiController.php16
-rw-r--r--apps/oauth2/lib/Exceptions/AccessTokenNotFoundException.php1
-rw-r--r--apps/oauth2/lib/Exceptions/ClientNotFoundException.php1
-rw-r--r--apps/oauth2/lib/Migration/SetTokenExpiration.php3
5 files changed, 10 insertions, 16 deletions
diff --git a/apps/oauth2/lib/Controller/LoginRedirectorController.php b/apps/oauth2/lib/Controller/LoginRedirectorController.php
index 8e8cff1b1a5..25154cbd4dc 100644
--- a/apps/oauth2/lib/Controller/LoginRedirectorController.php
+++ b/apps/oauth2/lib/Controller/LoginRedirectorController.php
@@ -1,4 +1,5 @@
<?php
+declare(strict_types=1);
/**
* @copyright Copyright (c) 2017 Lukas Reschke <lukas@statuscode.ch>
*
@@ -50,7 +51,7 @@ class LoginRedirectorController extends Controller {
* @param ISession $session
* @param IL10N $l
*/
- public function __construct($appName,
+ public function __construct(string $appName,
IRequest $request,
IURLGenerator $urlGenerator,
ClientMapper $clientMapper,
@@ -75,7 +76,7 @@ class LoginRedirectorController extends Controller {
*/
public function authorize($client_id,
$state,
- $response_type) {
+ $response_type): Response {
try {
$client = $this->clientMapper->getByIdentifier($client_id);
} catch (ClientNotFoundException $e) {
diff --git a/apps/oauth2/lib/Controller/OauthApiController.php b/apps/oauth2/lib/Controller/OauthApiController.php
index 73fed3654d5..b05d3781e5c 100644
--- a/apps/oauth2/lib/Controller/OauthApiController.php
+++ b/apps/oauth2/lib/Controller/OauthApiController.php
@@ -1,4 +1,5 @@
<?php
+declare(strict_types=1);
/**
* @copyright Copyright (c) 2017 Lukas Reschke <lukas@statuscode.ch>
*
@@ -53,18 +54,7 @@ class OauthApiController extends Controller {
/** @var Throttler */
private $throttler;
- /**
- * @param string $appName
- * @param IRequest $request
- * @param ICrypto $crypto
- * @param AccessTokenMapper $accessTokenMapper
- * @param ClientMapper $clientMapper
- * @param TokenProvider $tokenProvider
- * @param ISecureRandom $secureRandom
- * @param ITimeFactory $time
- * @param Throttler $throttler
- */
- public function __construct($appName,
+ public function __construct(string $appName,
IRequest $request,
ICrypto $crypto,
AccessTokenMapper $accessTokenMapper,
@@ -94,7 +84,7 @@ class OauthApiController extends Controller {
* @param string $client_secret
* @return JSONResponse
*/
- public function getToken($grant_type, $code, $refresh_token, $client_id, $client_secret) {
+ public function getToken($grant_type, $code, $refresh_token, $client_id, $client_secret): JSONResponse {
// We only handle two types
if ($grant_type !== 'authorization_code' && $grant_type !== 'refresh_token') {
diff --git a/apps/oauth2/lib/Exceptions/AccessTokenNotFoundException.php b/apps/oauth2/lib/Exceptions/AccessTokenNotFoundException.php
index a1eb632a9eb..c6b020b8f7e 100644
--- a/apps/oauth2/lib/Exceptions/AccessTokenNotFoundException.php
+++ b/apps/oauth2/lib/Exceptions/AccessTokenNotFoundException.php
@@ -1,4 +1,5 @@
<?php
+declare(strict_types=1);
/**
* @copyright Copyright (c) 2017 Lukas Reschke <lukas@statuscode.ch>
*
diff --git a/apps/oauth2/lib/Exceptions/ClientNotFoundException.php b/apps/oauth2/lib/Exceptions/ClientNotFoundException.php
index b2395c7bc9e..9655ad508d2 100644
--- a/apps/oauth2/lib/Exceptions/ClientNotFoundException.php
+++ b/apps/oauth2/lib/Exceptions/ClientNotFoundException.php
@@ -1,4 +1,5 @@
<?php
+declare(strict_types=1);
/**
* @copyright Copyright (c) 2017 Lukas Reschke <lukas@statuscode.ch>
*
diff --git a/apps/oauth2/lib/Migration/SetTokenExpiration.php b/apps/oauth2/lib/Migration/SetTokenExpiration.php
index 54add100fa7..f55c1a41c6f 100644
--- a/apps/oauth2/lib/Migration/SetTokenExpiration.php
+++ b/apps/oauth2/lib/Migration/SetTokenExpiration.php
@@ -1,4 +1,5 @@
<?php
+declare(strict_types=1);
/**
* @copyright Copyright 2018, Roeland Jago Douma <roeland@famdouma.nl>
*
@@ -50,7 +51,7 @@ class SetTokenExpiration implements IRepairStep {
$this->tokenProvider = $tokenProvider;
}
- public function getName() {
+ public function getName(): string {
return 'Update OAuth token expiration times';
}