Strict 2FA

* make OCP\Authentication\TwoFactorAuth strict
* scalar types
* return types

Signed-off-by: Roeland Jago Douma <roeland@famdouma.nl>
This commit is contained in:
Roeland Jago Douma 2018-03-26 11:18:21 +02:00
parent e2b44d199b
commit 24b12385d0
No known key found for this signature in database
GPG Key ID: F941078878347C0C
3 changed files with 12 additions and 8 deletions

View File

@ -1,4 +1,5 @@
<?php
declare(strict_types=1);
/**
* @copyright Copyright (c) 2016, ownCloud, Inc.
*
@ -43,7 +44,7 @@ interface IProvider {
*
* @return string
*/
public function getId();
public function getId(): string;
/**
* Get the display name for selecting the 2FA provider
@ -54,7 +55,7 @@ interface IProvider {
*
* @return string
*/
public function getDisplayName();
public function getDisplayName(): string;
/**
* Get the description for selecting the 2FA provider
@ -65,7 +66,7 @@ interface IProvider {
*
* @return string
*/
public function getDescription();
public function getDescription(): string;
/**
* Get the template for rending the 2FA provider view
@ -75,7 +76,7 @@ interface IProvider {
* @param IUser $user
* @return Template
*/
public function getTemplate(IUser $user);
public function getTemplate(IUser $user): Template;
/**
* Verify the given challenge
@ -84,8 +85,9 @@ interface IProvider {
*
* @param IUser $user
* @param string $challenge
* @return bool
*/
public function verifyChallenge(IUser $user, $challenge);
public function verifyChallenge(IUser $user, string $challenge): bool;
/**
* Decides whether 2FA is enabled for the given user
@ -93,7 +95,7 @@ interface IProvider {
* @since 9.1.0
*
* @param IUser $user
* @return boolean
* @return bool
*/
public function isTwoFactorAuthEnabledForUser(IUser $user);
public function isTwoFactorAuthEnabledForUser(IUser $user): bool;
}

View File

@ -1,4 +1,5 @@
<?php
declare(strict_types=1);
/**
*
*
@ -35,5 +36,5 @@ interface IProvidesCustomCSP {
*
* @since 13.0.0
*/
public function getCSP();
public function getCSP(): ContentSecurityPolicy;
}

View File

@ -1,4 +1,5 @@
<?php
declare(strict_types=1);
/**
* @copyright Copyright (c) 2016, ownCloud GmbH.
*