mirror of
https://github.com/Bubka/2FAuth.git
synced 2024-11-07 17:04:34 +01:00
Apply Laravel Pint fixes
This commit is contained in:
parent
1e0c0b8cfc
commit
ac6c715e9a
@ -16,7 +16,6 @@ class GroupController extends Controller
|
||||
/**
|
||||
* Display all user groups.
|
||||
*
|
||||
* @param \Illuminate\Http\Request $request
|
||||
* @return \Illuminate\Http\Resources\Json\AnonymousResourceCollection
|
||||
*/
|
||||
public function index(Request $request)
|
||||
@ -31,7 +30,6 @@ public function index(Request $request)
|
||||
/**
|
||||
* Store a newly created resource in storage.
|
||||
*
|
||||
* @param \App\Api\v1\Requests\GroupStoreRequest $request
|
||||
* @return \Illuminate\Http\JsonResponse
|
||||
*/
|
||||
public function store(GroupStoreRequest $request)
|
||||
@ -50,7 +48,6 @@ public function store(GroupStoreRequest $request)
|
||||
/**
|
||||
* Display the specified resource.
|
||||
*
|
||||
* @param \App\Models\Group $group
|
||||
* @return \App\Api\v1\Resources\GroupResource
|
||||
*/
|
||||
public function show(Group $group)
|
||||
@ -63,8 +60,6 @@ public function show(Group $group)
|
||||
/**
|
||||
* Update the specified resource in storage.
|
||||
*
|
||||
* @param \App\Api\v1\Requests\GroupStoreRequest $request
|
||||
* @param \App\Models\Group $group
|
||||
* @return \App\Api\v1\Resources\GroupResource
|
||||
*/
|
||||
public function update(GroupStoreRequest $request, Group $group)
|
||||
@ -81,8 +76,6 @@ public function update(GroupStoreRequest $request, Group $group)
|
||||
/**
|
||||
* Associate the specified accounts with the group
|
||||
*
|
||||
* @param \App\Api\v1\Requests\GroupAssignRequest $request
|
||||
* @param \App\Models\Group $group
|
||||
* @return \App\Api\v1\Resources\GroupResource
|
||||
*/
|
||||
public function assignAccounts(GroupAssignRequest $request, Group $group)
|
||||
@ -99,7 +92,6 @@ public function assignAccounts(GroupAssignRequest $request, Group $group)
|
||||
/**
|
||||
* Get accounts assigned to the group
|
||||
*
|
||||
* @param \App\Models\Group $group
|
||||
* @return \App\Api\v1\Resources\TwoFAccountCollection
|
||||
*/
|
||||
public function accounts(Group $group)
|
||||
@ -112,7 +104,6 @@ public function accounts(Group $group)
|
||||
/**
|
||||
* Remove the specified resource from storage.
|
||||
*
|
||||
* @param \App\Models\Group $group
|
||||
* @return \Illuminate\Http\JsonResponse
|
||||
*/
|
||||
public function destroy(Group $group)
|
||||
|
@ -13,7 +13,6 @@ class IconController extends Controller
|
||||
/**
|
||||
* Handle uploaded icon image
|
||||
*
|
||||
* @param \Illuminate\Http\Request $request
|
||||
* @return \Illuminate\Http\JsonResponse
|
||||
*/
|
||||
public function upload(Request $request)
|
||||
@ -33,8 +32,6 @@ public function upload(Request $request)
|
||||
/**
|
||||
* Fetch a logo
|
||||
*
|
||||
* @param \Illuminate\Http\Request $request
|
||||
* @param \App\Services\LogoService $logoService
|
||||
* @return \Illuminate\Http\JsonResponse
|
||||
*/
|
||||
public function fetch(Request $request, LogoService $logoService)
|
||||
@ -53,8 +50,6 @@ public function fetch(Request $request, LogoService $logoService)
|
||||
/**
|
||||
* delete an icon
|
||||
*
|
||||
* @param \Illuminate\Http\Request $request
|
||||
* @param string $icon
|
||||
* @return \Illuminate\Http\JsonResponse
|
||||
*/
|
||||
public function delete(string $icon, Request $request)
|
||||
|
@ -12,7 +12,6 @@ class QrCodeController extends Controller
|
||||
/**
|
||||
* Show a QR code image
|
||||
*
|
||||
* @param \App\Models\TwoFAccount $twofaccount
|
||||
* @return \Illuminate\Http\JsonResponse
|
||||
*/
|
||||
public function show(TwoFAccount $twofaccount)
|
||||
@ -27,7 +26,6 @@ public function show(TwoFAccount $twofaccount)
|
||||
/**
|
||||
* Decode an uploaded QR Code image
|
||||
*
|
||||
* @param \App\Api\v1\Requests\QrCodeDecodeRequest $request
|
||||
* @return \Illuminate\Http\JsonResponse
|
||||
*/
|
||||
public function decode(QrCodeDecodeRequest $request)
|
||||
|
@ -51,7 +51,6 @@ public function show($settingName)
|
||||
/**
|
||||
* Store a setting
|
||||
*
|
||||
* @param \App\Api\v1\Requests\SettingStoreRequest $request
|
||||
* @return \Illuminate\Http\JsonResponse
|
||||
*/
|
||||
public function store(SettingStoreRequest $request)
|
||||
@ -69,7 +68,6 @@ public function store(SettingStoreRequest $request)
|
||||
/**
|
||||
* Update a setting
|
||||
*
|
||||
* @param \App\Api\v1\Requests\SettingUpdateRequest $request
|
||||
* @return \Illuminate\Http\JsonResponse
|
||||
*/
|
||||
public function update(SettingUpdateRequest $request, string $settingName)
|
||||
@ -87,7 +85,6 @@ public function update(SettingUpdateRequest $request, string $settingName)
|
||||
/**
|
||||
* Delete a setting
|
||||
*
|
||||
* @param string $settingName
|
||||
* @return \Illuminate\Http\JsonResponse
|
||||
*/
|
||||
public function destroy(string $settingName)
|
||||
|
@ -36,7 +36,6 @@ public function index(Request $request)
|
||||
/**
|
||||
* Display a 2FA account
|
||||
*
|
||||
* @param \App\Models\TwoFAccount $twofaccount
|
||||
* @return \App\Api\v1\Resources\TwoFAccountReadResource
|
||||
*/
|
||||
public function show(TwoFAccount $twofaccount)
|
||||
@ -49,7 +48,6 @@ public function show(TwoFAccount $twofaccount)
|
||||
/**
|
||||
* Store a new 2FA account
|
||||
*
|
||||
* @param \App\Api\v1\Requests\TwoFAccountDynamicRequest $request
|
||||
* @return \Illuminate\Http\JsonResponse
|
||||
*/
|
||||
public function store(TwoFAccountDynamicRequest $request)
|
||||
@ -83,8 +81,6 @@ public function store(TwoFAccountDynamicRequest $request)
|
||||
/**
|
||||
* Update a 2FA account
|
||||
*
|
||||
* @param \App\Api\v1\Requests\TwoFAccountUpdateRequest $request
|
||||
* @param \App\Models\TwoFAccount $twofaccount
|
||||
* @return \Illuminate\Http\JsonResponse
|
||||
*/
|
||||
public function update(TwoFAccountUpdateRequest $request, TwoFAccount $twofaccount)
|
||||
@ -104,7 +100,6 @@ public function update(TwoFAccountUpdateRequest $request, TwoFAccount $twofaccou
|
||||
/**
|
||||
* Convert a migration resource to a valid TwoFAccounts collection
|
||||
*
|
||||
* @param \App\Api\v1\Requests\TwoFAccountImportRequest $request
|
||||
* @return \Illuminate\Http\JsonResponse|\App\Api\v1\Resources\TwoFAccountCollection
|
||||
*/
|
||||
public function migrate(TwoFAccountImportRequest $request)
|
||||
@ -125,7 +120,6 @@ public function migrate(TwoFAccountImportRequest $request)
|
||||
/**
|
||||
* Save 2FA accounts order
|
||||
*
|
||||
* @param \App\Api\v1\Requests\TwoFAccountReorderRequest $request
|
||||
* @return \Illuminate\Http\JsonResponse
|
||||
*/
|
||||
public function reorder(TwoFAccountReorderRequest $request)
|
||||
@ -143,7 +137,6 @@ public function reorder(TwoFAccountReorderRequest $request)
|
||||
/**
|
||||
* Preview account using an uri, without any db moves
|
||||
*
|
||||
* @param \App\Api\v1\Requests\TwoFAccountUriRequest $request
|
||||
* @return \App\Api\v1\Resources\TwoFAccountStoreResource
|
||||
*/
|
||||
public function preview(TwoFAccountUriRequest $request)
|
||||
@ -157,7 +150,6 @@ public function preview(TwoFAccountUriRequest $request)
|
||||
/**
|
||||
* Export accounts
|
||||
*
|
||||
* @param \App\Api\v1\Requests\TwoFAccountBatchRequest $request
|
||||
* @return TwoFAccountExportCollection|\Illuminate\Http\JsonResponse
|
||||
*/
|
||||
public function export(TwoFAccountBatchRequest $request)
|
||||
@ -180,7 +172,6 @@ public function export(TwoFAccountBatchRequest $request)
|
||||
/**
|
||||
* Get a One-Time Password
|
||||
*
|
||||
* @param \Illuminate\Http\Request $request
|
||||
* @param string|null $id
|
||||
* @return \Illuminate\Http\JsonResponse
|
||||
*/
|
||||
@ -222,7 +213,6 @@ public function otp(Request $request, $id = null)
|
||||
/**
|
||||
* A simple and light method to get the account count.
|
||||
*
|
||||
* @param \Illuminate\Http\Request $request
|
||||
* @return \Illuminate\Http\JsonResponse
|
||||
*/
|
||||
public function count(Request $request)
|
||||
@ -233,7 +223,6 @@ public function count(Request $request)
|
||||
/**
|
||||
* Withdraw one or more accounts from their group
|
||||
*
|
||||
* @param \App\Api\v1\Requests\TwoFAccountBatchRequest $request
|
||||
* @return \Illuminate\Http\JsonResponse
|
||||
*/
|
||||
public function withdraw(TwoFAccountBatchRequest $request)
|
||||
@ -260,7 +249,6 @@ public function withdraw(TwoFAccountBatchRequest $request)
|
||||
/**
|
||||
* Remove the specified resource from storage.
|
||||
*
|
||||
* @param \App\Models\TwoFAccount $twofaccount
|
||||
* @return \Illuminate\Http\JsonResponse
|
||||
*/
|
||||
public function destroy(TwoFAccount $twofaccount)
|
||||
@ -275,7 +263,6 @@ public function destroy(TwoFAccount $twofaccount)
|
||||
/**
|
||||
* Remove the specified resources from storage.
|
||||
*
|
||||
* @param \App\Api\v1\Requests\TwoFAccountBatchRequest $request
|
||||
* @return \Illuminate\Http\JsonResponse
|
||||
*/
|
||||
public function batchDestroy(TwoFAccountBatchRequest $request)
|
||||
|
@ -44,8 +44,6 @@ public function allPreferences(Request $request)
|
||||
/**
|
||||
* Display a preference
|
||||
*
|
||||
* @param \Illuminate\Http\Request $request
|
||||
* @param string $preferenceName
|
||||
* @return \Illuminate\Http\JsonResponse
|
||||
*/
|
||||
public function showPreference(Request $request, string $preferenceName)
|
||||
@ -63,8 +61,6 @@ public function showPreference(Request $request, string $preferenceName)
|
||||
/**
|
||||
* Save a preference
|
||||
*
|
||||
* @param \App\Api\v1\Requests\SettingUpdateRequest $request
|
||||
* @param string $preferenceName
|
||||
* @return \Illuminate\Http\JsonResponse
|
||||
*/
|
||||
public function setPreference(SettingUpdateRequest $request, string $preferenceName)
|
||||
@ -77,7 +73,7 @@ public function setPreference(SettingUpdateRequest $request, string $preferenceN
|
||||
|
||||
$request->user()['preferences->' . $preferenceName] = $validated['value'];
|
||||
$request->user()->save();
|
||||
|
||||
|
||||
Log::info(sprintf('User ID #%s changed its preference %s to %s', $request->user()->id, var_export($preferenceName, true), var_export($validated['value'], true)));
|
||||
|
||||
return response()->json([
|
||||
|
@ -33,8 +33,6 @@ public function __construct()
|
||||
|
||||
/**
|
||||
* Execute the console command.
|
||||
*
|
||||
* @return int
|
||||
*/
|
||||
public function handle() : int
|
||||
{
|
||||
|
@ -10,7 +10,6 @@ class Kernel extends ConsoleKernel
|
||||
/**
|
||||
* Define the application's command schedule.
|
||||
*
|
||||
* @param \Illuminate\Console\Scheduling\Schedule $schedule
|
||||
* @return void
|
||||
*
|
||||
* @codeCoverageIgnore Because no code will always remains Not Executed code
|
||||
|
@ -19,7 +19,6 @@ class GroupDeleted
|
||||
/**
|
||||
* Create a new event instance.
|
||||
*
|
||||
* @param \App\Models\Group $group
|
||||
* @return void
|
||||
*/
|
||||
public function __construct(Group $group)
|
||||
|
@ -19,7 +19,6 @@ class GroupDeleting
|
||||
/**
|
||||
* Create a new event instance.
|
||||
*
|
||||
* @param \App\Models\Group $group
|
||||
* @return void
|
||||
*/
|
||||
public function __construct(Group $group)
|
||||
|
@ -20,7 +20,6 @@ class TwoFAccountDeleted
|
||||
/**
|
||||
* Create a new event instance.
|
||||
*
|
||||
* @param \App\Models\TwoFAccount $twofaccount
|
||||
* @return void
|
||||
*/
|
||||
public function __construct(TwoFAccount $twofaccount)
|
||||
|
@ -12,10 +12,6 @@ class WebauthnCredentialBroker extends PasswordBroker
|
||||
{
|
||||
/**
|
||||
* Send a password reset link to a user.
|
||||
*
|
||||
* @param array $credentials
|
||||
* @param \Closure|null $callback
|
||||
* @return string
|
||||
*/
|
||||
public function sendResetLink(array $credentials, Closure $callback = null) : string
|
||||
{
|
||||
@ -48,8 +44,6 @@ public function sendResetLink(array $credentials, Closure $callback = null) : st
|
||||
/**
|
||||
* Reset the password for the given token.
|
||||
*
|
||||
* @param array $credentials
|
||||
* @param \Closure $callback
|
||||
* @return \Illuminate\Contracts\Auth\CanResetPassword|string
|
||||
*/
|
||||
public function reset(array $credentials, Closure $callback)
|
||||
|
@ -12,8 +12,6 @@ class WebauthnTwoFAuthUserProvider extends WebAuthnUserProvider
|
||||
* Validate a user against the given credentials.
|
||||
*
|
||||
* @param \App\Models\User $user
|
||||
* @param array $credentials
|
||||
* @return bool
|
||||
*/
|
||||
public function validateCredentials($user, array $credentials) : bool
|
||||
{
|
||||
|
@ -20,7 +20,6 @@ class MigratorFactory implements MigratorFactoryInterface
|
||||
* Infer the type of migrator needed from a payload and create the migrator
|
||||
*
|
||||
* @param string $migrationPayload The migration payload used to infer the migrator type
|
||||
* @return Migrator
|
||||
*/
|
||||
public function create(string $migrationPayload) : Migrator
|
||||
{
|
||||
@ -43,7 +42,6 @@ public function create(string $migrationPayload) : Migrator
|
||||
* Determine if a payload comes from Google Authenticator
|
||||
*
|
||||
* @param string $migrationPayload The payload to analyse
|
||||
* @return bool
|
||||
*/
|
||||
private function isGoogleAuth(string $migrationPayload) : bool
|
||||
{
|
||||
@ -62,7 +60,6 @@ private function isGoogleAuth(string $migrationPayload) : bool
|
||||
* Determine if a payload is a plain text content
|
||||
*
|
||||
* @param string $migrationPayload The payload to analyse
|
||||
* @return bool
|
||||
*/
|
||||
private function isPlainText(string $migrationPayload) : bool
|
||||
{
|
||||
@ -81,7 +78,6 @@ private function isPlainText(string $migrationPayload) : bool
|
||||
* Determine if a payload comes from 2FAuth in JSON format
|
||||
*
|
||||
* @param string $migrationPayload The payload to analyse
|
||||
* @return bool
|
||||
*/
|
||||
private function isTwoFAuthJSON(string $migrationPayload) : bool
|
||||
{
|
||||
|
@ -10,7 +10,6 @@ interface MigratorFactoryInterface
|
||||
* Infer the type of migrator needed from a payload and create the migrator
|
||||
*
|
||||
* @param string $migrationPayload The migration payload used to infer the migrator type
|
||||
* @return Migrator
|
||||
*/
|
||||
public function create(string $migrationPayload) : Migrator;
|
||||
}
|
||||
|
@ -6,9 +6,6 @@ class Helpers
|
||||
{
|
||||
/**
|
||||
* Clean a version number string
|
||||
*
|
||||
* @param string|null $release
|
||||
* @return string|false
|
||||
*/
|
||||
public static function cleanVersionNumber(?string $release) : string|false
|
||||
{
|
||||
|
@ -24,7 +24,6 @@ class ForgotPasswordController extends Controller
|
||||
/**
|
||||
* Validate the email for the given request.
|
||||
*
|
||||
* @param \Illuminate\Http\Request $request
|
||||
* @return void
|
||||
*/
|
||||
protected function validateEmail(Request $request)
|
||||
|
@ -30,14 +30,13 @@ class LoginController extends Controller
|
||||
/**
|
||||
* The login throttle.
|
||||
*
|
||||
* @var integer
|
||||
* @var int
|
||||
*/
|
||||
protected $maxAttempts;
|
||||
|
||||
/**
|
||||
* Handle a login request to the application.
|
||||
*
|
||||
* @param \App\Http\Requests\LoginRequest $request
|
||||
* @return \Illuminate\Http\JsonResponse
|
||||
*
|
||||
* @throws \Illuminate\Validation\ValidationException
|
||||
@ -87,7 +86,6 @@ public function login(LoginRequest $request)
|
||||
/**
|
||||
* log out current user
|
||||
*
|
||||
* @param Request $request
|
||||
* @return \Illuminate\Http\JsonResponse
|
||||
*/
|
||||
public function logout(Request $request)
|
||||
@ -103,7 +101,6 @@ public function logout(Request $request)
|
||||
/**
|
||||
* Send the response after the user was authenticated.
|
||||
*
|
||||
* @param \Illuminate\Http\Request $request
|
||||
* @return \Illuminate\Http\JsonResponse
|
||||
*/
|
||||
protected function sendLoginResponse(Request $request)
|
||||
@ -124,7 +121,6 @@ protected function sendLoginResponse(Request $request)
|
||||
/**
|
||||
* Get the failed login response instance.
|
||||
*
|
||||
* @param \Illuminate\Http\Request $request
|
||||
* @return \Illuminate\Http\JsonResponse
|
||||
*/
|
||||
protected function sendFailedLoginResponse(Request $request)
|
||||
@ -135,7 +131,6 @@ protected function sendFailedLoginResponse(Request $request)
|
||||
/**
|
||||
* Redirect the user after determining they are locked out.
|
||||
*
|
||||
* @param \Illuminate\Http\Request $request
|
||||
* @return \Illuminate\Http\JsonResponse
|
||||
*/
|
||||
protected function sendLockoutResponse(Request $request)
|
||||
@ -150,7 +145,6 @@ protected function sendLockoutResponse(Request $request)
|
||||
/**
|
||||
* Get the needed authorization credentials from the request.
|
||||
*
|
||||
* @param \Illuminate\Http\Request $request
|
||||
* @return array
|
||||
*/
|
||||
protected function credentials(Request $request)
|
||||
@ -166,7 +160,6 @@ protected function credentials(Request $request)
|
||||
/**
|
||||
* The user has been authenticated.
|
||||
*
|
||||
* @param \Illuminate\Http\Request $request
|
||||
* @param mixed $user
|
||||
* @return void
|
||||
*/
|
||||
|
@ -13,7 +13,6 @@ class PasswordController extends Controller
|
||||
/**
|
||||
* Update the user's password.
|
||||
*
|
||||
* @param \App\Http\Requests\UserPatchPwdRequest $request
|
||||
* @return \Illuminate\Http\JsonResponse
|
||||
*/
|
||||
public function update(UserPatchPwdRequest $request)
|
||||
|
@ -7,7 +7,6 @@
|
||||
use App\Models\User;
|
||||
use Illuminate\Auth\Events\Registered;
|
||||
use Illuminate\Foundation\Auth\RegistersUsers;
|
||||
use Illuminate\Support\Facades\DB;
|
||||
use Illuminate\Support\Facades\Hash;
|
||||
use Illuminate\Support\Facades\Log;
|
||||
|
||||
@ -29,7 +28,6 @@ class RegisterController extends Controller
|
||||
/**
|
||||
* Handle a registration request for the application.
|
||||
*
|
||||
* @param \App\Http\Requests\UserStoreRequest $request
|
||||
* @return \Illuminate\Http\JsonResponse
|
||||
*/
|
||||
public function register(UserStoreRequest $request)
|
||||
@ -49,7 +47,6 @@ public function register(UserStoreRequest $request)
|
||||
/**
|
||||
* Create a new user instance after a valid registration.
|
||||
*
|
||||
* @param array $data
|
||||
* @return \App\Models\User
|
||||
*/
|
||||
protected function create(array $data)
|
||||
@ -59,7 +56,7 @@ protected function create(array $data)
|
||||
'email' => $data['email'],
|
||||
'password' => Hash::make($data['password']),
|
||||
]);
|
||||
|
||||
|
||||
Log::info(sprintf('User ID #%s created', $user->id));
|
||||
|
||||
if (User::count() == 1) {
|
||||
|
@ -17,7 +17,6 @@ class UserController extends Controller
|
||||
/**
|
||||
* Update the user's profile information.
|
||||
*
|
||||
* @param \App\Http\Requests\UserUpdateRequest $request
|
||||
* @return \App\Api\v1\Resources\UserResource|\Illuminate\Http\JsonResponse
|
||||
*/
|
||||
public function update(UserUpdateRequest $request)
|
||||
@ -45,7 +44,6 @@ public function update(UserUpdateRequest $request)
|
||||
/**
|
||||
* Delete the user's account.
|
||||
*
|
||||
* @param \App\Http\Requests\UserDeleteRequest $request
|
||||
* @return \Illuminate\Http\JsonResponse
|
||||
*/
|
||||
public function delete(UserDeleteRequest $request)
|
||||
|
@ -17,8 +17,6 @@ class WebAuthnDeviceLostController extends Controller
|
||||
/**
|
||||
* Send a recovery email to the user.
|
||||
*
|
||||
* @param \App\Http\Requests\WebauthnDeviceLostRequest $request
|
||||
* @param \App\Extensions\WebauthnCredentialBroker $broker
|
||||
* @return \Illuminate\Http\JsonResponse|\Illuminate\Http\RedirectResponse
|
||||
*
|
||||
* @throws \Illuminate\Validation\ValidationException
|
||||
@ -37,8 +35,6 @@ public function sendRecoveryEmail(WebauthnDeviceLostRequest $request, WebauthnCr
|
||||
/**
|
||||
* Get the response for a failed account recovery link.
|
||||
*
|
||||
* @param \Illuminate\Http\Request $request
|
||||
* @param string $response
|
||||
* @return \Illuminate\Http\JsonResponse
|
||||
*
|
||||
* @throws \Illuminate\Validation\ValidationException
|
||||
@ -51,8 +47,6 @@ protected function sendRecoveryLinkFailedResponse(Request $request, string $resp
|
||||
/**
|
||||
* Get the response for a successful account recovery link.
|
||||
*
|
||||
* @param \Illuminate\Http\Request $request
|
||||
* @param string $response
|
||||
* @return \Illuminate\Http\JsonResponse
|
||||
*/
|
||||
protected function sendRecoveryLinkResponse(Request $request, string $response)
|
||||
|
@ -23,7 +23,7 @@ class WebAuthnLoginController extends Controller
|
||||
/**
|
||||
* The login throttle.
|
||||
*
|
||||
* @var integer
|
||||
* @var int
|
||||
*/
|
||||
protected $maxAttempts;
|
||||
|
||||
@ -40,9 +40,6 @@ class WebAuthnLoginController extends Controller
|
||||
|
||||
/**
|
||||
* Returns the challenge to assertion.
|
||||
*
|
||||
* @param \Laragear\WebAuthn\Http\Requests\AssertionRequest $request
|
||||
* @return \Illuminate\Contracts\Support\Responsable|\Illuminate\Http\JsonResponse
|
||||
*/
|
||||
public function options(AssertionRequest $request) : Responsable|JsonResponse
|
||||
{
|
||||
@ -67,7 +64,6 @@ public function options(AssertionRequest $request) : Responsable|JsonResponse
|
||||
/**
|
||||
* Log the user in.
|
||||
*
|
||||
* @param \App\Http\Requests\WebauthnAssertedRequest $request
|
||||
* @return \Illuminate\Http\Response|\Illuminate\Http\JsonResponse
|
||||
*/
|
||||
public function login(WebauthnAssertedRequest $request)
|
||||
@ -126,7 +122,6 @@ public function login(WebauthnAssertedRequest $request)
|
||||
/**
|
||||
* Attempt to log the user into the application.
|
||||
*
|
||||
* @param \App\Http\Requests\WebauthnAssertedRequest $request
|
||||
* @return bool
|
||||
*/
|
||||
protected function attemptLogin(WebauthnAssertedRequest $request)
|
||||
@ -137,7 +132,6 @@ protected function attemptLogin(WebauthnAssertedRequest $request)
|
||||
/**
|
||||
* Send the response after the user was authenticated.
|
||||
*
|
||||
* @param \App\Http\Requests\WebauthnAssertedRequest $request
|
||||
* @return \Illuminate\Http\JsonResponse
|
||||
*/
|
||||
protected function sendLoginResponse(WebauthnAssertedRequest $request)
|
||||
@ -161,7 +155,6 @@ protected function sendLoginResponse(WebauthnAssertedRequest $request)
|
||||
/**
|
||||
* Get the failed login response instance.
|
||||
*
|
||||
* @param \App\Http\Requests\WebauthnAssertedRequest $request
|
||||
* @return \Illuminate\Http\JsonResponse
|
||||
*/
|
||||
protected function sendFailedLoginResponse(WebauthnAssertedRequest $request)
|
||||
@ -172,7 +165,6 @@ protected function sendFailedLoginResponse(WebauthnAssertedRequest $request)
|
||||
/**
|
||||
* Redirect the user after determining they are locked out.
|
||||
*
|
||||
* @param \App\Http\Requests\WebauthnAssertedRequest $request
|
||||
* @return \Illuminate\Http\JsonResponse
|
||||
*/
|
||||
protected function sendLockoutResponse(WebauthnAssertedRequest $request)
|
||||
@ -197,7 +189,6 @@ public function username()
|
||||
/**
|
||||
* Get the needed authorization credentials from the request.
|
||||
*
|
||||
* @param \App\Http\Requests\WebauthnAssertedRequest $request
|
||||
* @return array
|
||||
*/
|
||||
protected function credentials(WebauthnAssertedRequest $request)
|
||||
|
@ -24,8 +24,6 @@ public function index(Request $request)
|
||||
/**
|
||||
* Rename a WebAuthn credential
|
||||
*
|
||||
* @param \App\Http\Requests\WebauthnRenameRequest $request
|
||||
* @param string $credential
|
||||
* @return \Illuminate\Http\JsonResponse
|
||||
*/
|
||||
public function rename(WebauthnRenameRequest $request, string $credential)
|
||||
@ -42,7 +40,6 @@ public function rename(WebauthnRenameRequest $request, string $credential)
|
||||
/**
|
||||
* Remove the specified credential from storage.
|
||||
*
|
||||
* @param \Illuminate\Http\Request $request
|
||||
* @param string|array $credential
|
||||
* @return \Illuminate\Http\JsonResponse
|
||||
*/
|
||||
@ -61,7 +58,7 @@ public function delete(Request $request, $credential)
|
||||
$request->user()->save();
|
||||
Log::notice(sprintf('No more Webauthn credential for user ID #%s, user Webauthn options reset to default', $user->id));
|
||||
}
|
||||
|
||||
|
||||
Log::info(sprintf('User ID #%s revoked a security device', $user->id));
|
||||
|
||||
return response()->json(null, 204);
|
||||
|
@ -22,8 +22,6 @@ class WebAuthnRecoveryController extends Controller
|
||||
* Let the user regain access to his account using email+password by resetting
|
||||
* the "use webauthn only" setting.
|
||||
*
|
||||
* @param \App\Http\Requests\WebauthnRecoveryRequest $request
|
||||
* @param \App\Extensions\WebauthnCredentialBroker $broker
|
||||
* @return \Illuminate\Http\RedirectResponse|\Illuminate\Http\JsonResponse
|
||||
*
|
||||
* @throws \Illuminate\Validation\ValidationException
|
||||
@ -69,7 +67,6 @@ function ($user) use ($request) {
|
||||
/**
|
||||
* Check if the user has set to revoke all credentials.
|
||||
*
|
||||
* @param \App\Http\Requests\WebauthnRecoveryRequest $request
|
||||
* @return bool|mixed
|
||||
*/
|
||||
protected function shouldRevokeAllCredentials(WebauthnRecoveryRequest $request) : mixed
|
||||
@ -80,10 +77,6 @@ protected function shouldRevokeAllCredentials(WebauthnRecoveryRequest $request)
|
||||
|
||||
/**
|
||||
* Get the response for a successful account recovery.
|
||||
*
|
||||
* @param \Illuminate\Http\Request $request
|
||||
* @param string $response
|
||||
* @return \Illuminate\Http\JsonResponse
|
||||
*/
|
||||
protected function sendRecoveryResponse(Request $request, string $response) : JsonResponse
|
||||
{
|
||||
@ -93,9 +86,6 @@ protected function sendRecoveryResponse(Request $request, string $response) : Js
|
||||
/**
|
||||
* Get the response for a failed account recovery.
|
||||
*
|
||||
* @param \Illuminate\Http\Request $request
|
||||
* @param string $response
|
||||
* @return \Illuminate\Http\JsonResponse
|
||||
*
|
||||
* @throws \Illuminate\Validation\ValidationException
|
||||
*/
|
||||
|
@ -14,9 +14,6 @@ class WebAuthnRegisterController extends Controller
|
||||
{
|
||||
/**
|
||||
* Returns a challenge to be verified by the user device.
|
||||
*
|
||||
* @param \Laragear\WebAuthn\Http\Requests\AttestationRequest $request
|
||||
* @return \Illuminate\Contracts\Support\Responsable
|
||||
*/
|
||||
public function options(AttestationRequest $request) : Responsable
|
||||
{
|
||||
@ -37,14 +34,11 @@ public function options(AttestationRequest $request) : Responsable
|
||||
|
||||
/**
|
||||
* Registers a device for further WebAuthn authentication.
|
||||
*
|
||||
* @param \Laragear\WebAuthn\Http\Requests\AttestedRequest $request
|
||||
* @return \Illuminate\Http\Response
|
||||
*/
|
||||
public function register(AttestedRequest $request) : Response
|
||||
{
|
||||
$request->save();
|
||||
|
||||
|
||||
Log::info(sprintf('User ID #%s registered a new security device', $request->user()->id));
|
||||
|
||||
return response()->noContent();
|
||||
|
@ -12,7 +12,6 @@ class AdminOnly
|
||||
* Handle an incoming request.
|
||||
*
|
||||
* @param \Illuminate\Http\Request $request
|
||||
* @param \Closure $next
|
||||
* @return mixed
|
||||
*/
|
||||
public function handle($request, Closure $next)
|
||||
|
@ -11,7 +11,6 @@ class Authenticate extends Middleware
|
||||
* Determine if the user is logged in to any of the given guards.
|
||||
*
|
||||
* @param \Illuminate\Http\Request $request
|
||||
* @param array $guards
|
||||
* @return void
|
||||
*
|
||||
* @throws \Illuminate\Auth\AuthenticationException
|
||||
|
@ -10,7 +10,6 @@ class ForceJsonResponse
|
||||
* Handle an incoming request.
|
||||
*
|
||||
* @param \Illuminate\Http\Request $request
|
||||
* @param \Closure $next
|
||||
* @return mixed
|
||||
*/
|
||||
public function handle($request, Closure $next)
|
||||
|
@ -14,7 +14,6 @@ class KickOutInactiveUser
|
||||
* Handle an incoming request.
|
||||
*
|
||||
* @param \Illuminate\Http\Request $request
|
||||
* @param \Closure $next
|
||||
* @param string $guards
|
||||
* @return mixed
|
||||
*/
|
||||
|
@ -12,7 +12,6 @@ class LogUserLastSeen
|
||||
* Handle an incoming request.
|
||||
*
|
||||
* @param \Illuminate\Http\Request $request
|
||||
* @param \Closure $next
|
||||
* @param string $guards
|
||||
* @return mixed
|
||||
*/
|
||||
|
@ -11,8 +11,6 @@ class RejectIfAuthenticated
|
||||
/**
|
||||
* Handle an incoming request.
|
||||
*
|
||||
* @param \Illuminate\Http\Request $request
|
||||
* @param \Closure $next
|
||||
* @param string|null ...$guards
|
||||
* @return mixed
|
||||
*/
|
||||
|
@ -12,7 +12,6 @@ class RejectIfDemoMode
|
||||
* Handle an incoming request.
|
||||
*
|
||||
* @param \Illuminate\Http\Request $request
|
||||
* @param \Closure $next
|
||||
* @return mixed
|
||||
*/
|
||||
public function handle($request, Closure $next)
|
||||
|
@ -11,7 +11,6 @@ class RejectIfReverseProxy
|
||||
* Handle an incoming request.
|
||||
*
|
||||
* @param \Illuminate\Http\Request $request
|
||||
* @param \Closure $next
|
||||
* @return mixed
|
||||
*/
|
||||
public function handle($request, Closure $next)
|
||||
|
@ -12,7 +12,6 @@ class SetLanguage
|
||||
* Handle an incoming request.
|
||||
*
|
||||
* @param \Illuminate\Http\Request $request
|
||||
* @param \Closure $next
|
||||
* @return mixed
|
||||
*/
|
||||
public function handle($request, Closure $next)
|
||||
|
@ -11,8 +11,6 @@ class SkipIfAuthenticated
|
||||
/**
|
||||
* Handle an incoming request.
|
||||
*
|
||||
* @param \Illuminate\Http\Request $request
|
||||
* @param \Closure $next
|
||||
* @param string|null ...$guards
|
||||
* @return mixed
|
||||
*/
|
||||
@ -25,8 +23,8 @@ public function handle(Request $request, Closure $next, ...$guards)
|
||||
$user = Auth::guard($guard)->user();
|
||||
|
||||
return response()->json([
|
||||
'message' => 'authenticated',
|
||||
'name' => $user->name,
|
||||
'message' => 'authenticated',
|
||||
'name' => $user->name,
|
||||
'preferences' => $user->preferences,
|
||||
], 200);
|
||||
}
|
||||
|
@ -8,10 +8,8 @@ class WebauthnAssertedRequest extends AssertedRequest
|
||||
{
|
||||
/**
|
||||
* Get the validation rules that apply to the request.
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function rules(): array
|
||||
public function rules() : array
|
||||
{
|
||||
return array_merge(
|
||||
[
|
||||
|
@ -21,7 +21,6 @@ public function __construct()
|
||||
/**
|
||||
* Handle the event.
|
||||
*
|
||||
* @param \App\Events\TwoFAccountDeleted $event
|
||||
* @return void
|
||||
*/
|
||||
public function handle(TwoFAccountDeleted $event)
|
||||
|
@ -21,7 +21,6 @@ public function __construct()
|
||||
/**
|
||||
* Handle the event.
|
||||
*
|
||||
* @param GroupDeleting $event
|
||||
* @return void
|
||||
*/
|
||||
public function handle(GroupDeleting $event)
|
||||
|
@ -20,7 +20,6 @@ public function __construct()
|
||||
/**
|
||||
* Handle the event.
|
||||
*
|
||||
* @param \App\Events\ScanForNewReleaseCalled $event
|
||||
* @return void
|
||||
*/
|
||||
public function handle(ScanForNewReleaseCalled $event)
|
||||
|
@ -21,7 +21,6 @@ public function __construct()
|
||||
/**
|
||||
* Handle the event.
|
||||
*
|
||||
* @param GroupDeleted $event
|
||||
* @return void
|
||||
*/
|
||||
public function handle(GroupDeleted $event)
|
||||
|
@ -14,8 +14,6 @@ trait WebAuthnManageCredentials
|
||||
{
|
||||
/**
|
||||
* Return the handle used to identify his credentials.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function userHandle() : string
|
||||
{
|
||||
@ -30,10 +28,6 @@ public function userHandle() : string
|
||||
|
||||
/**
|
||||
* Saves a new alias for a given WebAuthn credential.
|
||||
*
|
||||
* @param string $id
|
||||
* @param string $alias
|
||||
* @return bool
|
||||
*/
|
||||
public function renameCredential(string $id, string $alias) : bool
|
||||
{
|
||||
@ -44,7 +38,6 @@ public function renameCredential(string $id, string $alias) : bool
|
||||
* Removes one or more credentials previously registered.
|
||||
*
|
||||
* @param string|array $id
|
||||
* @return void
|
||||
*/
|
||||
public function flushCredential($id) : void
|
||||
{
|
||||
@ -63,9 +56,6 @@ public function flushCredential($id) : void
|
||||
|
||||
/**
|
||||
* Sends a webauthn recovery email to the user.
|
||||
*
|
||||
* @param string $token
|
||||
* @return void
|
||||
*/
|
||||
public function sendWebauthnRecoveryNotification(string $token) : void
|
||||
{
|
||||
|
@ -376,7 +376,7 @@ public function getOTP()
|
||||
Log::info(sprintf('New OTP generated for TwoFAccount (%s)', $this->id ? 'id:' . $this->id : 'preview'));
|
||||
|
||||
return $OtpDto;
|
||||
} catch (\Exception | \Throwable $ex) {
|
||||
} catch (\Exception|\Throwable $ex) {
|
||||
Log::error('An error occured, OTP generation aborted');
|
||||
// Currently a secret issue is the only possible exception thrown by OTPHP for this stack
|
||||
// so it is Ok to send the corresponding 2FAuth exception.
|
||||
@ -569,7 +569,7 @@ private function initGenerator() : void
|
||||
} catch (UnsupportedOtpTypeException $exception) {
|
||||
Log::error(sprintf('%s is not an OTP type supported by the current generator', $this->otp_type));
|
||||
throw $exception;
|
||||
} catch (\Exception | \Throwable $exception) {
|
||||
} catch (\Exception|\Throwable $exception) {
|
||||
throw new InvalidOtpParameterException($exception->getMessage());
|
||||
}
|
||||
}
|
||||
@ -623,7 +623,6 @@ private function storeFileDataAsIcon($content, $extension) : string|null
|
||||
/**
|
||||
* Generate a unique filename
|
||||
*
|
||||
* @param string $extension
|
||||
* @return string The filename
|
||||
*/
|
||||
private function getUniqueFilename(string $extension) : string
|
||||
@ -636,7 +635,6 @@ private function getUniqueFilename(string $extension) : string
|
||||
*
|
||||
* @param string $filename
|
||||
* @param string $disk
|
||||
* @return bool
|
||||
*/
|
||||
private function isValidIcon($filename, $disk) : bool
|
||||
{
|
||||
@ -686,7 +684,7 @@ private function storeRemoteImageAsIcon(string $url) : string|null
|
||||
return Storage::disk('icons')->exists($newFilename) ? $newFilename : null;
|
||||
}
|
||||
// @codeCoverageIgnoreStart
|
||||
catch (\Exception | \Throwable $ex) {
|
||||
catch (\Exception|\Throwable $ex) {
|
||||
Log::error(sprintf('Icon storage failed: %s', $ex->getMessage()));
|
||||
|
||||
return null;
|
||||
@ -708,8 +706,6 @@ private function getDefaultIcon()
|
||||
|
||||
/**
|
||||
* Tells if an official icon should be fetched
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
private function shouldGetOfficialIcon() : bool
|
||||
{
|
||||
|
@ -123,9 +123,6 @@ public function setEmailAttribute($value) : void
|
||||
|
||||
/**
|
||||
* Returns an WebAuthnAuthenticatable user from a given Credential ID.
|
||||
*
|
||||
* @param string $id
|
||||
* @return WebAuthnAuthenticatable|null
|
||||
*/
|
||||
public static function getFromCredentialId(string $id) : ?WebAuthnAuthenticatable
|
||||
{
|
||||
|
@ -8,17 +8,11 @@ interface WebAuthnAuthenticatable extends Authenticatable
|
||||
{
|
||||
/**
|
||||
* Return the handle used to identify his credentials.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function userHandle() : string;
|
||||
|
||||
/**
|
||||
* Saves a new alias for a given WebAuthn credential.
|
||||
*
|
||||
* @param string $id
|
||||
* @param string $alias
|
||||
* @return bool
|
||||
*/
|
||||
public function renameCredential(string $id, string $alias) : bool;
|
||||
|
||||
@ -26,15 +20,11 @@ public function renameCredential(string $id, string $alias) : bool;
|
||||
* Removes one or more credentials previously registered.
|
||||
*
|
||||
* @param string|array $id
|
||||
* @return void
|
||||
*/
|
||||
public function flushCredential($id) : void;
|
||||
|
||||
/**
|
||||
* Sends a webauthn recovery email to the user.
|
||||
*
|
||||
* @param string $token
|
||||
* @return void
|
||||
*/
|
||||
public function sendWebauthnRecoveryNotification(string $token) : void;
|
||||
}
|
||||
|
@ -11,8 +11,6 @@ class WebauthnRecoveryNotification extends Notification
|
||||
{
|
||||
/**
|
||||
* Token for account recovery.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected string $token;
|
||||
|
||||
@ -32,8 +30,6 @@ class WebauthnRecoveryNotification extends Notification
|
||||
|
||||
/**
|
||||
* AccountRecoveryNotification constructor.
|
||||
*
|
||||
* @param string $token
|
||||
*/
|
||||
public function __construct(string $token)
|
||||
{
|
||||
|
@ -14,7 +14,6 @@ class GroupPolicy
|
||||
/**
|
||||
* Determine whether the user can view any models.
|
||||
*
|
||||
* @param \App\Models\User $user
|
||||
* @return \Illuminate\Auth\Access\Response|bool
|
||||
*/
|
||||
// public function viewAny(User $user)
|
||||
@ -25,8 +24,6 @@ class GroupPolicy
|
||||
/**
|
||||
* Determine whether the user can view the model.
|
||||
*
|
||||
* @param \App\Models\User $user
|
||||
* @param \App\Models\Group $group
|
||||
* @return \Illuminate\Auth\Access\Response|bool
|
||||
*/
|
||||
public function view(User $user, Group $group)
|
||||
@ -43,7 +40,6 @@ public function view(User $user, Group $group)
|
||||
/**
|
||||
* Determine whether the user can view all provided models.
|
||||
*
|
||||
* @param \App\Models\User $user
|
||||
* @param \App\Models\Group $group
|
||||
* @param \Illuminate\Support\Collection<int, \App\Models\Group> $groups
|
||||
* @return \Illuminate\Auth\Access\Response|bool
|
||||
@ -65,7 +61,6 @@ public function view(User $user, Group $group)
|
||||
/**
|
||||
* Determine whether the user can create models.
|
||||
*
|
||||
* @param \App\Models\User $user
|
||||
* @return \Illuminate\Auth\Access\Response|bool
|
||||
*/
|
||||
public function create(User $user)
|
||||
@ -78,8 +73,6 @@ public function create(User $user)
|
||||
/**
|
||||
* Determine whether the user can update the model.
|
||||
*
|
||||
* @param \App\Models\User $user
|
||||
* @param \App\Models\Group $group
|
||||
* @return \Illuminate\Auth\Access\Response|bool
|
||||
*/
|
||||
public function update(User $user, Group $group)
|
||||
@ -96,8 +89,6 @@ public function update(User $user, Group $group)
|
||||
/**
|
||||
* Determine whether the user can update all provided models.
|
||||
*
|
||||
* @param \App\Models\User $user
|
||||
* @param \App\Models\Group $group
|
||||
* @param \Illuminate\Support\Collection<int, \App\Models\Group> $groups
|
||||
* @return \Illuminate\Auth\Access\Response|bool
|
||||
*/
|
||||
@ -118,8 +109,6 @@ public function update(User $user, Group $group)
|
||||
/**
|
||||
* Determine whether the user can delete the model.
|
||||
*
|
||||
* @param \App\Models\User $user
|
||||
* @param \App\Models\Group $group
|
||||
* @return \Illuminate\Auth\Access\Response|bool
|
||||
*/
|
||||
public function delete(User $user, Group $group)
|
||||
|
@ -9,8 +9,6 @@ trait OwnershipTrait
|
||||
/**
|
||||
* Ownership of single item condition
|
||||
*
|
||||
* @param \App\Models\User $user
|
||||
* @param mixed $item
|
||||
* @return bool
|
||||
*/
|
||||
protected function isOwnerOf(User $user, mixed $item)
|
||||
@ -24,7 +22,6 @@ protected function isOwnerOf(User $user, mixed $item)
|
||||
* @template TKey of array-key
|
||||
* @template TValue
|
||||
*
|
||||
* @param \App\Models\User $user
|
||||
* @param \Illuminate\Contracts\Support\Arrayable<TKey, TValue>|iterable<TKey, TValue> $items
|
||||
* @return bool
|
||||
*/
|
||||
|
@ -14,7 +14,6 @@ class TwoFAccountPolicy
|
||||
/**
|
||||
* Determine whether the user can view any models.
|
||||
*
|
||||
* @param \App\Models\User $user
|
||||
* @return \Illuminate\Auth\Access\Response|bool
|
||||
*/
|
||||
// public function viewAny(User $user)
|
||||
@ -25,8 +24,6 @@ class TwoFAccountPolicy
|
||||
/**
|
||||
* Determine whether the user can view the model.
|
||||
*
|
||||
* @param \App\Models\User $user
|
||||
* @param \App\Models\TwoFAccount $twofaccount
|
||||
* @return \Illuminate\Auth\Access\Response|bool
|
||||
*/
|
||||
public function view(User $user, TwoFAccount $twofaccount)
|
||||
@ -43,8 +40,6 @@ public function view(User $user, TwoFAccount $twofaccount)
|
||||
/**
|
||||
* Determine whether the user can view all provided models.
|
||||
*
|
||||
* @param \App\Models\User $user
|
||||
* @param \App\Models\TwoFAccount $twofaccount
|
||||
* @param \Illuminate\Support\Collection<int, \App\Models\TwoFAccount> $twofaccounts
|
||||
* @return \Illuminate\Auth\Access\Response|bool
|
||||
*/
|
||||
@ -65,7 +60,6 @@ public function viewEach(User $user, TwoFAccount $twofaccount, $twofaccounts)
|
||||
/**
|
||||
* Determine whether the user can create models.
|
||||
*
|
||||
* @param \App\Models\User $user
|
||||
* @return \Illuminate\Auth\Access\Response|bool
|
||||
*/
|
||||
public function create(User $user)
|
||||
@ -78,8 +72,6 @@ public function create(User $user)
|
||||
/**
|
||||
* Determine whether the user can update the model.
|
||||
*
|
||||
* @param \App\Models\User $user
|
||||
* @param \App\Models\TwoFAccount $twofaccount
|
||||
* @return \Illuminate\Auth\Access\Response|bool
|
||||
*/
|
||||
public function update(User $user, TwoFAccount $twofaccount)
|
||||
@ -96,8 +88,6 @@ public function update(User $user, TwoFAccount $twofaccount)
|
||||
/**
|
||||
* Determine whether the user can update all provided models.
|
||||
*
|
||||
* @param \App\Models\User $user
|
||||
* @param \App\Models\TwoFAccount $twofaccount
|
||||
* @param \Illuminate\Support\Collection<int, \App\Models\TwoFAccount> $twofaccounts
|
||||
* @return \Illuminate\Auth\Access\Response|bool
|
||||
*/
|
||||
@ -118,8 +108,6 @@ public function updateEach(User $user, TwoFAccount $twofaccount, $twofaccounts)
|
||||
/**
|
||||
* Determine whether the user can delete the model.
|
||||
*
|
||||
* @param \App\Models\User $user
|
||||
* @param \App\Models\TwoFAccount $twofaccount
|
||||
* @return \Illuminate\Auth\Access\Response|bool
|
||||
*/
|
||||
public function delete(User $user, TwoFAccount $twofaccount)
|
||||
@ -136,8 +124,6 @@ public function delete(User $user, TwoFAccount $twofaccount)
|
||||
/**
|
||||
* Determine whether the user can delete all provided models.
|
||||
*
|
||||
* @param \App\Models\User $user
|
||||
* @param \App\Models\TwoFAccount $twofaccount
|
||||
* @param \Illuminate\Support\Collection<int, \App\Models\TwoFAccount> $twofaccounts
|
||||
* @return \Illuminate\Auth\Access\Response|bool
|
||||
*/
|
||||
|
@ -30,7 +30,6 @@ class AuthServiceProvider extends ServiceProvider
|
||||
/**
|
||||
* Register the service provider.
|
||||
*
|
||||
* @return void
|
||||
*
|
||||
* @throws \Illuminate\Contracts\Container\BindingResolutionException
|
||||
*/
|
||||
|
@ -74,6 +74,7 @@ protected function configureRateLimiting()
|
||||
{
|
||||
RateLimiter::for('api', function (Request $request) {
|
||||
$maxAttempts = config('2fauth.api.throttle');
|
||||
|
||||
return is_null($maxAttempts) ? Limit::none() : Limit::perMinute($maxAttempts)->by($request->ip());
|
||||
});
|
||||
}
|
||||
|
@ -24,7 +24,6 @@ class ReverseProxyGuard implements Guard
|
||||
/**
|
||||
* Create a new authentication guard.
|
||||
*
|
||||
* @param \Illuminate\Contracts\Auth\UserProvider $provider
|
||||
* @return void
|
||||
*/
|
||||
public function __construct(UserProvider $provider)
|
||||
@ -83,7 +82,6 @@ public function user()
|
||||
/**
|
||||
* Validate a user's credentials.
|
||||
*
|
||||
* @param array $credentials
|
||||
* @return bool
|
||||
*
|
||||
* @codeCoverageIgnore
|
||||
|
@ -15,9 +15,7 @@ class GroupService
|
||||
* Assign one or more accounts to a group
|
||||
*
|
||||
* @param array|int $ids accounts ids to assign
|
||||
* @param \App\Models\User $user
|
||||
* @param \App\Models\Group|null $group The group the accounts will be assigned to
|
||||
* @return void
|
||||
*
|
||||
* @throws \Illuminate\Auth\Access\AuthorizationException
|
||||
*/
|
||||
@ -48,7 +46,6 @@ public static function assign($ids, User $user, Group $group = null) : void
|
||||
* Prepends the pseudo group named 'All' to a group collection
|
||||
*
|
||||
* @param Collection<int, Group> $groups
|
||||
* @param \App\Models\User $user
|
||||
* @return Collection<int, Group>
|
||||
*/
|
||||
public static function prependTheAllGroup(Collection $groups, User $user) : Collection
|
||||
@ -66,7 +63,6 @@ public static function prependTheAllGroup(Collection $groups, User $user) : Coll
|
||||
/**
|
||||
* Determines the default group of the given user
|
||||
*
|
||||
* @param \App\Models\User $user
|
||||
* @return \App\Models\Group|null The group or null if it does not exist
|
||||
*/
|
||||
private static function defaultGroup(User $user)
|
||||
|
@ -69,8 +69,6 @@ protected function getLogo($serviceName)
|
||||
|
||||
/**
|
||||
* Build and set the TFA directoy collection
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
protected function setTfaCollection() : void
|
||||
{
|
||||
@ -90,8 +88,6 @@ protected function setTfaCollection() : void
|
||||
|
||||
/**
|
||||
* Fetch and cache fresh TFA.Directory data using the https://2fa.directory API
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
protected function cacheTfaDirectorySource() : void
|
||||
{
|
||||
@ -117,7 +113,6 @@ protected function cacheTfaDirectorySource() : void
|
||||
* Fetch and cache a logo from 2fa.Directory repository
|
||||
*
|
||||
* @param string $logoFile Logo filename to fetch
|
||||
* @return void
|
||||
*/
|
||||
protected function fetchLogo(string $logoFile) : void
|
||||
{
|
||||
@ -138,7 +133,6 @@ protected function fetchLogo(string $logoFile) : void
|
||||
/**
|
||||
* Prepare and make some replacement to optimize logo fetching
|
||||
*
|
||||
* @param string $domain
|
||||
* @return string Optimized domain name
|
||||
*/
|
||||
protected function cleanDomain(string $domain) : string
|
||||
|
@ -33,7 +33,6 @@ class AegisMigrator extends Migrator
|
||||
/**
|
||||
* Convert migration data to a TwoFAccounts collection.
|
||||
*
|
||||
* @param mixed $migrationPayload
|
||||
* @return \Illuminate\Support\Collection<int|string, \App\Models\TwoFAccount> The converted accounts
|
||||
*/
|
||||
public function migrate(mixed $migrationPayload) : Collection
|
||||
|
@ -9,7 +9,6 @@ abstract class Migrator
|
||||
/**
|
||||
* Convert migration data to a 2FAccounts collection.
|
||||
*
|
||||
* @param mixed $migrationPayload
|
||||
* @return \Illuminate\Support\Collection<int|string, \App\Models\TwoFAccount> The converted accounts
|
||||
*/
|
||||
abstract public function migrate(mixed $migrationPayload) : Collection;
|
||||
@ -17,7 +16,6 @@ abstract public function migrate(mixed $migrationPayload) : Collection;
|
||||
/**
|
||||
* Pad a string to 8 chars min
|
||||
*
|
||||
* @param string $string
|
||||
* @return string The padded string
|
||||
*/
|
||||
protected function padToValidBase32Secret(string $string)
|
||||
|
@ -14,7 +14,6 @@ class PlainTextMigrator extends Migrator
|
||||
/**
|
||||
* Convert migration data to a TwoFAccounts collection.
|
||||
*
|
||||
* @param mixed $migrationPayload
|
||||
* @return \Illuminate\Support\Collection<int|string, \App\Models\TwoFAccount> The converted accounts
|
||||
*/
|
||||
public function migrate(mixed $migrationPayload) : Collection
|
||||
|
@ -67,7 +67,6 @@ class TwoFASMigrator extends Migrator
|
||||
/**
|
||||
* Convert migration data to a TwoFAccounts collection.
|
||||
*
|
||||
* @param mixed $migrationPayload
|
||||
* @return \Illuminate\Support\Collection<int|string, \App\Models\TwoFAccount> The converted accounts
|
||||
*/
|
||||
public function migrate(mixed $migrationPayload) : Collection
|
||||
|
@ -36,7 +36,6 @@ class TwoFAuthMigrator extends Migrator
|
||||
/**
|
||||
* Convert migration data to a TwoFAccounts collection.
|
||||
*
|
||||
* @param mixed $migrationPayload
|
||||
* @return \Illuminate\Support\Collection<int|string, \App\Models\TwoFAccount> The converted accounts
|
||||
*/
|
||||
public function migrate(mixed $migrationPayload) : Collection
|
||||
|
@ -32,7 +32,6 @@ public static function encode(string $data)
|
||||
/**
|
||||
* Decode an uploaded QR code image
|
||||
*
|
||||
* @param \Illuminate\Http\UploadedFile $file
|
||||
* @return string
|
||||
*/
|
||||
public static function decode(\Illuminate\Http\UploadedFile $file)
|
||||
|
@ -11,8 +11,6 @@ class ReleaseRadarService
|
||||
{
|
||||
/**
|
||||
* Run a scheduled release scan
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public static function scheduledScan() : void
|
||||
{
|
||||
@ -62,8 +60,6 @@ protected static function newRelease() : false|string
|
||||
|
||||
/**
|
||||
* Fetch releases on Github
|
||||
*
|
||||
* @return string|null
|
||||
*/
|
||||
protected static function getLatestReleaseData() : string|null
|
||||
{
|
||||
|
@ -23,8 +23,6 @@ class SettingService
|
||||
|
||||
/**
|
||||
* Cache duration
|
||||
*
|
||||
* @var int
|
||||
*/
|
||||
private int $minutes = 10;
|
||||
|
||||
@ -109,7 +107,6 @@ public function delete(string $name) : void
|
||||
* Determine if the given setting has been edited
|
||||
*
|
||||
* @param string $key
|
||||
* @return bool
|
||||
*/
|
||||
public function isEdited($key) : bool
|
||||
{
|
||||
@ -148,7 +145,6 @@ private function buildAndCache()
|
||||
/**
|
||||
* Replaces boolean by a patterned string as appstrack/laravel-options package does not support var type
|
||||
*
|
||||
* @param mixed $value
|
||||
* @return string
|
||||
*/
|
||||
private function replaceBoolean(mixed $value)
|
||||
@ -159,7 +155,6 @@ private function replaceBoolean(mixed $value)
|
||||
/**
|
||||
* Replaces patterned string that represent booleans with real booleans
|
||||
*
|
||||
* @param mixed $value
|
||||
* @return mixed
|
||||
*/
|
||||
private function restoreType(mixed $value)
|
||||
@ -180,7 +175,6 @@ private function restoreType(mixed $value)
|
||||
/**
|
||||
* Enable or Disable encryption of 2FAccounts sensible data
|
||||
*
|
||||
* @return void
|
||||
*
|
||||
* @throws DbEncryptionException Something failed, everything have been rolled back
|
||||
*/
|
||||
|
@ -18,7 +18,7 @@
|
||||
/**
|
||||
* DEPRECATED - Unprotected routes
|
||||
*/
|
||||
Route::get('user/name', function() {
|
||||
Route::get('user/name', function () {
|
||||
return response()->json(['deprecation' => true], 200, ['Deprecation' => Date::createFromDate(2023, 03, 21)->toRfc7231String()]);
|
||||
});
|
||||
|
||||
|
@ -316,6 +316,7 @@ public function test_show_twofaccount_of_another_user_is_forbidden()
|
||||
|
||||
/**
|
||||
* @dataProvider accountCreationProvider
|
||||
*
|
||||
* @test
|
||||
*/
|
||||
public function test_store_without_encryption_returns_success_with_consistent_resource_structure($payload, $expected)
|
||||
@ -332,6 +333,7 @@ public function test_store_without_encryption_returns_success_with_consistent_re
|
||||
|
||||
/**
|
||||
* @dataProvider accountCreationProvider
|
||||
*
|
||||
* @test
|
||||
*/
|
||||
public function test_store_with_encryption_returns_success_with_consistent_resource_structure($payload, $expected)
|
||||
@ -655,15 +657,15 @@ public function test_migrate_identify_duplicates_in_authenticated_user_twofaccou
|
||||
])
|
||||
->assertOk()
|
||||
->assertJsonFragment([
|
||||
'id' => 0,
|
||||
'account' => OtpTestData::ACCOUNT,
|
||||
'service' => OtpTestData::SERVICE,
|
||||
'otp_type' => 'totp',
|
||||
'secret' => OtpTestData::SECRET,
|
||||
'algorithm' => OtpTestData::ALGORITHM_DEFAULT,
|
||||
'digits' => OtpTestData::DIGITS_DEFAULT,
|
||||
'period' => OtpTestData::PERIOD_DEFAULT,
|
||||
'icon' => null,
|
||||
'id' => 0,
|
||||
'account' => OtpTestData::ACCOUNT,
|
||||
'service' => OtpTestData::SERVICE,
|
||||
'otp_type' => 'totp',
|
||||
'secret' => OtpTestData::SECRET,
|
||||
'algorithm' => OtpTestData::ALGORITHM_DEFAULT,
|
||||
'digits' => OtpTestData::DIGITS_DEFAULT,
|
||||
'period' => OtpTestData::PERIOD_DEFAULT,
|
||||
'icon' => null,
|
||||
])
|
||||
->assertJsonFragment([
|
||||
'id' => 0,
|
||||
|
@ -143,20 +143,20 @@ public function test_too_many_login_attempts_with_invalid_credentials_returns_to
|
||||
{
|
||||
$throttle = 8;
|
||||
Config::set('auth.throttle.login', $throttle);
|
||||
|
||||
|
||||
$post = [
|
||||
'email' => $this->user->email,
|
||||
'password' => self::WRONG_PASSWORD,
|
||||
];
|
||||
|
||||
for ($i=0; $i < $throttle - 1; $i++) {
|
||||
for ($i = 0; $i < $throttle - 1; $i++) {
|
||||
$this->json('POST', '/user/login', $post);
|
||||
}
|
||||
|
||||
$this->json('POST', '/user/login', $post)
|
||||
->assertUnauthorized();
|
||||
|
||||
$this->json('POST', '/user/login', $post)
|
||||
$this->json('POST', '/user/login', $post)
|
||||
->assertStatus(429);
|
||||
}
|
||||
|
||||
|
@ -34,6 +34,7 @@ public function setUp() : void
|
||||
|
||||
/**
|
||||
* @test
|
||||
*
|
||||
* @covers \App\Models\Traits\WebAuthnManageCredentials
|
||||
*/
|
||||
public function test_sendRecoveryEmail_sends_notification_on_success()
|
||||
|
@ -21,9 +21,6 @@ class WebAuthnRecoveryControllerTest extends FeatureTestCase
|
||||
*/
|
||||
protected $user;
|
||||
|
||||
/**
|
||||
* @var
|
||||
*/
|
||||
protected $now;
|
||||
|
||||
const STORED_TOKEN_VALUE = '$2y$10$P6q8rl8te5QaO1EdpyJcNO0s9VFlVgf62KaItQhrPTskxfyu97mlW';
|
||||
|
@ -4,7 +4,6 @@
|
||||
|
||||
use App\Models\User;
|
||||
use Illuminate\Support\Facades\Config;
|
||||
use Illuminate\Support\Facades\Log;
|
||||
use Laragear\WebAuthn\Http\Requests\AttestationRequest;
|
||||
use Laragear\WebAuthn\Http\Requests\AttestedRequest;
|
||||
use Laragear\WebAuthn\JsonTransport;
|
||||
|
@ -237,6 +237,7 @@ public function test_set_useEncryption_off_decrypts_all_accounts()
|
||||
|
||||
/**
|
||||
* @test
|
||||
*
|
||||
* @dataProvider provideUndecipherableData
|
||||
*/
|
||||
public function test_set_useEncryption_off_returns_exception_when_data_are_undecipherable(array $data)
|
||||
|
@ -11,7 +11,6 @@
|
||||
abstract class ModelTestCase extends TestCase
|
||||
{
|
||||
/**
|
||||
* @param Model $model
|
||||
* @param array $fillable
|
||||
* @param array $guarded
|
||||
* @param array $hidden
|
||||
@ -72,8 +71,6 @@ protected function runConfigurationAssertions(
|
||||
|
||||
/**
|
||||
* @param HasMany $relation
|
||||
* @param Model $model
|
||||
* @param Model $related
|
||||
* @param string $key
|
||||
* @param string $parent
|
||||
* @param \Closure $queryCheck
|
||||
@ -106,8 +103,6 @@ protected function assertHasManyRelation($relation, Model $model, Model $related
|
||||
|
||||
/**
|
||||
* @param BelongsTo $relation
|
||||
* @param Model $model
|
||||
* @param Model $related
|
||||
* @param string $key
|
||||
* @param string $owner
|
||||
* @param \Closure $queryCheck
|
||||
|
@ -19,6 +19,7 @@ class DissociateTwofaccountFromGroupTest extends TestCase
|
||||
* @test
|
||||
*
|
||||
* @runInSeparateProcess
|
||||
*
|
||||
* @preserveGlobalState disabled
|
||||
*/
|
||||
public function test_twofaccount_is_released_on_group_deletion()
|
||||
|
@ -336,6 +336,7 @@ public function migrationWithInvalidAccountsProvider()
|
||||
* @test
|
||||
*
|
||||
* @runInSeparateProcess
|
||||
*
|
||||
* @preserveGlobalState disabled
|
||||
*/
|
||||
public function test_migrate_gauth_returns_fake_accounts()
|
||||
|
@ -118,6 +118,7 @@ public function test_indecipherable_attributes_returns_masked_value(string $attr
|
||||
* @test
|
||||
*
|
||||
* @runInSeparateProcess
|
||||
*
|
||||
* @preserveGlobalState disabled
|
||||
*/
|
||||
public function test_secret_is_uppercased_and_padded_at_setup()
|
||||
|
Loading…
Reference in New Issue
Block a user