summaryrefslogtreecommitdiffstats
path: root/lib/Controller/PageController.php
diff options
context:
space:
mode:
authorJoas Schilling <coding@schilljs.com>2023-04-25 15:37:10 +0200
committerJoas Schilling <coding@schilljs.com>2023-04-26 09:15:49 +0200
commit5ac5d00e2d64f580aadc3257d166c1df4c904313 (patch)
tree17c2d32d1ab87501fed7c356dcd82c02d21fec83 /lib/Controller/PageController.php
parenta699d959ec4c6749172ee70d419f0ed90efc80f5 (diff)
feat(controllers): Migrate server annotations to attributes
Signed-off-by: Joas Schilling <coding@schilljs.com>
Diffstat (limited to 'lib/Controller/PageController.php')
-rw-r--r--lib/Controller/PageController.php43
1 files changed, 16 insertions, 27 deletions
diff --git a/lib/Controller/PageController.php b/lib/Controller/PageController.php
index 3c5781587..fc92e83c4 100644
--- a/lib/Controller/PageController.php
+++ b/lib/Controller/PageController.php
@@ -41,6 +41,8 @@ use OCP\App\IAppManager;
use OCP\AppFramework\Controller;
use OCP\AppFramework\Http;
use OCP\AppFramework\Http\Attribute\BruteForceProtection;
+use OCP\AppFramework\Http\Attribute\NoCSRFRequired;
+use OCP\AppFramework\Http\Attribute\PublicPage;
use OCP\AppFramework\Http\Attribute\UseSession;
use OCP\AppFramework\Http\ContentSecurityPolicy;
use OCP\AppFramework\Http\NotFoundResponse;
@@ -126,13 +128,12 @@ class PageController extends Controller {
}
/**
- * @PublicPage
- * @NoCSRFRequired
- *
* @param string $token
* @return Response
* @throws HintException
*/
+ #[NoCSRFRequired]
+ #[PublicPage]
#[UseSession]
#[BruteForceProtection(action: 'talkRoomToken')]
public function showCall(string $token): Response {
@@ -141,14 +142,13 @@ class PageController extends Controller {
}
/**
- * @PublicPage
- * @NoCSRFRequired
- *
* @param string $token
* @param string $password
* @return Response
* @throws HintException
*/
+ #[NoCSRFRequired]
+ #[PublicPage]
#[UseSession]
#[BruteForceProtection(action: 'talkRoomPassword')]
public function authenticatePassword(string $token, string $password = ''): Response {
@@ -156,36 +156,27 @@ class PageController extends Controller {
return $this->index($token, '', $password);
}
- /**
- * @PublicPage
- * @NoCSRFRequired
- *
- * @return Response
- */
+ #[NoCSRFRequired]
+ #[PublicPage]
public function notFound(): Response {
return $this->index();
}
- /**
- * @PublicPage
- * @NoCSRFRequired
- *
- * @return Response
- */
+ #[NoCSRFRequired]
+ #[PublicPage]
public function duplicateSession(): Response {
return $this->index();
}
/**
- * @PublicPage
- * @NoCSRFRequired
- *
* @param string $token
* @param string $callUser
* @param string $password
* @return TemplateResponse|RedirectResponse
* @throws HintException
*/
+ #[NoCSRFRequired]
+ #[PublicPage]
#[BruteForceProtection(action: 'talkRoomToken')]
#[UseSession]
public function index(string $token = '', string $callUser = '', string $password = ''): Response {
@@ -308,12 +299,11 @@ class PageController extends Controller {
}
/**
- * @PublicPage
- * @NoCSRFRequired
- *
* @param string $token
* @return TemplateResponse|NotFoundResponse
*/
+ #[NoCSRFRequired]
+ #[PublicPage]
#[BruteForceProtection(action: 'talkRoomToken')]
public function recording(string $token): Response {
try {
@@ -432,12 +422,11 @@ class PageController extends Controller {
}
/**
- * @PublicPage
- * @NoCSRFRequired
- *
* @param string $token
* @return RedirectResponse
*/
+ #[NoCSRFRequired]
+ #[PublicPage]
protected function redirectToConversation(string $token): RedirectResponse {
// These redirects are already done outside of this method
if ($this->userId === null) {