Skip to content

Commit

Permalink
Add Laravel 10 support (#23)
Browse files Browse the repository at this point in the history
- Add Laravel 10 Support
- Add PHP 8.2 Support
- Improved generator styling, as per Laravel Pint standards
- Improved tests to use translations instead of string matches
- Fixed timing-related test regression
  • Loading branch information
claudiodekker authored Apr 3, 2023
1 parent e31e404 commit 01dfb2e
Show file tree
Hide file tree
Showing 35 changed files with 82 additions and 321 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/app-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@ jobs:
strategy:
fail-fast: true
matrix:
php: [ 8.1 ]
laravel: [ 9 ]
php: [ 8.1, 8.2 ]
laravel: [ 9, 10 ]
stability: [ 'prefer-lowest', 'prefer-stable' ]
variants: [
'',
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/package-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@ jobs:
fail-fast: true
matrix:
package: [ 'core', 'bladebones' ]
php: [ 8.1 ]
laravel: [ 9 ]
php: [ 8.1, 8.2 ]
laravel: [ 9, 10 ]
stability: [ 'prefer-lowest', 'prefer-stable' ]

name: ${{ matrix.package }} - PHP ${{ matrix.php }} L${{ matrix.laravel }} w/ ${{ matrix.stability }}
Expand Down
11 changes: 11 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,22 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

## [Unreleased](https://github.com/claudiodekker/laravel-auth/compare/v0.1.2...HEAD)

### Added

- PHP 8.2 Support ([#23](https://github.com/claudiodekker/laravel-auth/pull/23))
- Laravel 10 Support ([#23](https://github.com/claudiodekker/laravel-auth/pull/23))

### Changed

- Moved `claudiodekker/laravel-auth` v0.1.0 into this monorepo
- Moved `claudiodekker/laravel-auth-bladebones` v0.1.2 into this monorepo
- Updated this `CHANGELOG.md` to reflect previous non-monorepo releases
- Bladebones: Improved generator styling, as per Laravel Pint standards ([#23](https://github.com/claudiodekker/laravel-auth/pull/23))
- Core: Improved tests to use translations instead of string matches ([#23](https://github.com/claudiodekker/laravel-auth/pull/23))

### Fixed

- Core: Fixed timing-related test regression ([#23](https://github.com/claudiodekker/laravel-auth/pull/23))

## [v0.1.2](https://github.com/claudiodekker/laravel-auth-bladebones/compare/v0.1.2...v0.1.1) - 2022-11-30

Expand Down
14 changes: 6 additions & 8 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,18 +3,16 @@
"authors": [
{
"name": "Claudio Dekker",
"email": "[email protected]",
"homepage": "https://ubient.net",
"role": "Developer"
"email": "[email protected]"
}
],
"require": {
"ext-json": "*",
"php": "~8.1.0|~8.2.0",
"laravel/framework": "^9.33|^10.0",
"bacon/bacon-qr-code": "^2.0",
"claudiodekker/word-generator": "^1.0",
"ext-json": "*",
"laravel/framework": "^9.0",
"nyholm/psr7": "^1.5",
"php": "~8.1.0",
"pragmarx/google2fa": "^8.0",
"symfony/psr-http-message-bridge": "^2.1",
"web-auth/webauthn-lib": "^4.0"
Expand Down Expand Up @@ -47,8 +45,8 @@
}
},
"replace": {
"claudiodekker/laravel-auth-core": "self.version",
"claudiodekker/laravel-auth-bladebones": "self.version"
"claudiodekker/laravel-auth-bladebones": "self.version",
"claudiodekker/laravel-auth-core": "self.version"
},
"minimum-stability": "dev",
"prefer-stable": true
Expand Down
4 changes: 2 additions & 2 deletions packages/bladebones/composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,9 @@
}
],
"require": {
"php": "~8.1.0",
"php": "~8.1.0|~8.2.0",
"ext-json": "*",
"laravel/framework": "^9.0",
"laravel/framework": "^9.33|^10.0",
"claudiodekker/laravel-auth-core": "^0.1.3"
},
"require-dev": {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -59,9 +59,6 @@ class AccountRecoveryRequestController extends BaseController
@endif
/**
* Handle an incoming request to view the account recovery page.
*
* {!! '@' !!}param \Illuminate\Http\Request $request
* {!! '@' !!}return \Illuminate\Contracts\View\View
*/
public function create(Request $request): View
{
Expand All @@ -70,9 +67,6 @@ class AccountRecoveryRequestController extends BaseController

/**
* Handle an incoming request to receive an account recovery link.
*
* {!! '@' !!}param \Illuminate\Http\Request $request
* {!! '@' !!}return \Illuminate\Http\RedirectResponse
*/
public function store(Request $request): RedirectResponse
{
Expand All @@ -87,9 +81,6 @@ class AccountRecoveryRequestController extends BaseController
*
* {!! '@' !!}see sendNoSuchUserResponse
* {!! '@' !!}see sendRecoveryAlreadyRequestedResponse
*
* {!! '@' !!}param \Illuminate\Http\Request $request
* {!! '@' !!}return \Illuminate\Http\RedirectResponse
*/
public function sendRecoveryLinkSentResponse(Request $request): RedirectResponse
{
Expand All @@ -101,10 +92,6 @@ class AccountRecoveryRequestController extends BaseController
*
* NOTE: To prevent malicious visitors from probing the system for valid email addresses, this method should not
* indicate that recovery has already been requested. Instead, it should always return the same response.
*
* {!! '@' !!}param \Illuminate\Http\Request $request
* {!! '@' !!}param \Illuminate\Contracts\Auth\Authenticatable $user
* {!! '@' !!}return \Illuminate\Http\RedirectResponse
*/
protected function sendRecoveryAlreadyRequestedResponse(Request $request, Authenticatable $user): RedirectResponse
{
Expand All @@ -116,9 +103,6 @@ class AccountRecoveryRequestController extends BaseController
*
* NOTE: To prevent malicious visitors from probing the system for valid email addresses, this method should not
* indicate that the account was not found. Instead, it should always return the same response.
*
* {!! '@' !!}param \Illuminate\Http\Request $request
* {!! '@' !!}return \Illuminate\Http\RedirectResponse
*/
protected function sendNoSuchUserResponse(Request $request): RedirectResponse
{
Expand All @@ -129,10 +113,6 @@ class AccountRecoveryRequestController extends BaseController
/**
* Sends a response indicating that the user's requests have been rate limited.
*
* {!! '@' !!}param \Illuminate\Http\Request $request
* {!! '@' !!}param int $availableInSeconds
* {!! '@' !!}return void
*
* {!! '@' !!}throws \Illuminate\Validation\ValidationException
*/
protected function sendRateLimitedResponse(Request $request, int $availableInSeconds): void
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,10 +29,6 @@ class AccountRecoveryChallengeController extends BaseController
@endif
/**
* Handle an incoming request to view the account recovery challenge page.
*
* {!! '@' !!}param \Illuminate\Http\Request $request
* {!! '@' !!}param string $token
* {!! '@' !!}return \Illuminate\Contracts\View\View
*/
public function create(Request $request, string $token): View
{
Expand All @@ -41,10 +37,6 @@ class AccountRecoveryChallengeController extends BaseController

/**
* Handle an incoming account recovery challenge response.
*
* {!! '@' !!}param \Illuminate\Http\Request $request
* {!! '@' !!}param string $token
* {!! '@' !!}return \Illuminate\Http\RedirectResponse
*/
public function store(Request $request, string $token): RedirectResponse
{
Expand All @@ -53,10 +45,6 @@ class AccountRecoveryChallengeController extends BaseController

/**
* Sends a response that displays the account recovery challenge page.
*
* {!! '@' !!}param \Illuminate\Http\Request $request
* {!! '@' !!}param string $token
* {!! '@' !!}return \Illuminate\Contracts\View\View
*/
protected function sendChallengePageResponse(Request $request, string $token): View
{
Expand All @@ -68,9 +56,6 @@ class AccountRecoveryChallengeController extends BaseController
/**
* Sends a response indicating that the given recovery link is invalid.
*
* {!! '@' !!}param \Illuminate\Http\Request $request
* {!! '@' !!}return void
*
* {!! '@' !!}throws \Symfony\Component\HttpKernel\Exception\HttpException
*/
protected function sendInvalidRecoveryLinkResponse(Request $request): void
Expand All @@ -81,9 +66,6 @@ class AccountRecoveryChallengeController extends BaseController
/**
* Sends a response indicating that the given recovery code is invalid.
*
* {!! '@' !!}param \Illuminate\Http\Request $request
* {!! '@' !!}return void
*
* {!! '@' !!}throws \Illuminate\Validation\ValidationException
*/
protected function sendInvalidRecoveryCodeResponse(Request $request): void
Expand All @@ -98,10 +80,6 @@ class AccountRecoveryChallengeController extends BaseController
*
* Typically, you'd want this response to redirect the user to their account's security settings page,
* where they can adjust whatever is causing them to be unable to authenticate using normal means.
*
* {!! '@' !!}param \Illuminate\Http\Request $request
* {!! '@' !!}param \Illuminate\Contracts\Auth\Authenticatable $user
* {!! '@' !!}return \Illuminate\Http\RedirectResponse
*/
protected function sendAccountRecoveredResponse(Request $request, Authenticatable $user): RedirectResponse
{
Expand All @@ -112,10 +90,6 @@ class AccountRecoveryChallengeController extends BaseController
/**
* Sends a response indicating that the user's requests have been rate limited.
*
* {!! '@' !!}param \Illuminate\Http\Request $request
* {!! '@' !!}param int $availableInSeconds
* {!! '@' !!}return void
*
* {!! '@' !!}throws \Illuminate\Validation\ValidationException
*/
protected function sendRateLimitedResponse(Request $request, int $availableInSeconds): void
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,9 +43,6 @@ class MultiFactorChallengeController extends BaseController
@endif
/**
* Handle an incoming request to view the multi-factor challenge page.
*
* {!! '@' !!}param \Illuminate\Http\Request $request
* {!! '@' !!}return \Illuminate\Contracts\View\View|\Illuminate\Http\RedirectResponse
*/
public function create(Request $request): View|RedirectResponse
{
Expand All @@ -54,9 +51,6 @@ class MultiFactorChallengeController extends BaseController

/**
* Handle an incoming multi-factor challenge confirmation request.
*
* {!! '@' !!}param \Illuminate\Http\Request $request
* {!! '@' !!}return \Illuminate\Http\JsonResponse
*/
public function store(Request $request): JsonResponse
{
Expand All @@ -65,11 +59,6 @@ class MultiFactorChallengeController extends BaseController

/**
* Sends a response that displays the multi-factor challenge page.
*
* {!! '@' !!}param \Illuminate\Http\Request $request
* {!! '@' !!}param \ClaudioDekker\LaravelAuth\Specifications\WebAuthn\Dictionaries\PublicKeyCredentialRequestOptions|null $options
* {!! '@' !!}param \Illuminate\Support\Collection $availableCredentialTypes
* {!! '@' !!}return \Illuminate\Contracts\View\View
*/
protected function sendChallengePageResponse(Request $request, PublicKeyCredentialRequestOptions|null $options, Collection $availableCredentialTypes): View
{
Expand All @@ -82,11 +71,6 @@ class MultiFactorChallengeController extends BaseController

/**
* Sends a response indicating that the user has been successfully authenticated.
*
* {!! '@' !!}param \Illuminate\Http\Request $request
* {!! '@' !!}param \Illuminate\Contracts\Auth\Authenticatable $user
* {!! '@' !!}param string $intendedUrl
* {!! '@' !!}return \Illuminate\Http\JsonResponse|\Illuminate\Http\RedirectResponse
*/
protected function sendAuthenticatedResponse(Request $request, Authenticatable $user, string $intendedUrl): JsonResponse|RedirectResponse
{
Expand All @@ -104,9 +88,6 @@ class MultiFactorChallengeController extends BaseController
/**
* Sends a response indicating that the public key credential challenge state is invalid.
*
* {!! '@' !!}param \Illuminate\Http\Request $request
* {!! '@' !!}return void
*
* {!! '@' !!}throws \Symfony\Component\HttpKernel\Exception\HttpException
*/
protected function sendInvalidPublicKeyChallengeStateResponse(Request $request): void
Expand All @@ -120,9 +101,6 @@ class MultiFactorChallengeController extends BaseController
* This can be for a large number of reasons, including (but not limited to) a malformed request,
* a non-existent credential, an invalid signature or confirmation code etc.
*
* {!! '@' !!}param \Illuminate\Http\Request $request
* {!! '@' !!}return void
*
* {!! '@' !!}throws \Illuminate\Validation\ValidationException
*/
protected function sendChallengeFailedResponse(Request $request): void
Expand All @@ -142,10 +120,6 @@ class MultiFactorChallengeController extends BaseController
/**
* Sends a response indicating that the user's requests have been rate limited.
*
* {!! '@' !!}param \Illuminate\Http\Request $request
* {!! '@' !!}param int $availableInSeconds
* {!! '@' !!}return void
*
* {!! '@' !!}throws \Illuminate\Validation\ValidationException
*/
protected function sendRateLimitedResponse(Request $request, int $availableInSeconds): void
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,9 +39,6 @@ class SudoModeChallengeController extends BaseController
@endif
/**
* Display the sudo-mode challenge view.
*
* {!! '@' !!}param \Illuminate\Http\Request $request
* {!! '@' !!}return \Illuminate\Contracts\View\View
*/
public function create(Request $request): View
{
Expand All @@ -50,9 +47,6 @@ class SudoModeChallengeController extends BaseController

/**
* Verify the sudo-mode confirmation request.
*
* {!! '@' !!}param \Illuminate\Http\Request $request
* {!! '@' !!}return \Illuminate\Http\JsonResponse
*/
public function store(Request $request): JsonResponse
{
Expand All @@ -61,10 +55,6 @@ class SudoModeChallengeController extends BaseController

/**
* Sends a response that displays the sudo-mode challenge page.
*
* {!! '@' !!}param \Illuminate\Http\Request $request
* {!! '@' !!}param \ClaudioDekker\LaravelAuth\Specifications\WebAuthn\Dictionaries\PublicKeyCredentialRequestOptions|null $options
* {!! '@' !!}return \Illuminate\Contracts\View\View
*/
protected function sendChallengePageResponse(Request $request, PublicKeyCredentialRequestOptions|null $options): View
{
Expand All @@ -76,9 +66,6 @@ class SudoModeChallengeController extends BaseController

/**
* Sends a response indicating that sudo-mode has been enabled.
*
* {!! '@' !!}param \Illuminate\Http\Request $request
* {!! '@' !!}return \Illuminate\Http\JsonResponse
*/
protected function sendSudoModeEnabledResponse(Request $request): JsonResponse
{
Expand All @@ -90,9 +77,6 @@ class SudoModeChallengeController extends BaseController
/**
* Sends a response indicating that sudo-mode is currently not required.
*
* {!! '@' !!}param \Illuminate\Http\Request $request
* {!! '@' !!}return void
*
* {!! '@' !!}throws \Symfony\Component\HttpKernel\Exception\HttpException
*/
protected function sendConfirmationNotRequiredResponse(Request $request): void
Expand All @@ -103,9 +87,6 @@ class SudoModeChallengeController extends BaseController
/**
* Sends a response indicating that the password challenge did not succeed.
*
* {!! '@' !!}param \Illuminate\Http\Request $request
* {!! '@' !!}return void
*
* {!! '@' !!}throws \Illuminate\Validation\ValidationException
*/
protected function sendPasswordChallengeFailedResponse(Request $request): void
Expand All @@ -118,9 +99,6 @@ class SudoModeChallengeController extends BaseController
/**
* Sends a response indicating that the public key challenge state is invalid.
*
* {!! '@' !!}param \Illuminate\Http\Request $request
* {!! '@' !!}return void
*
* {!! '@' !!}throws \Symfony\Component\HttpKernel\Exception\HttpException
*/
protected function sendInvalidPublicKeyChallengeStateResponse(Request $request): void
Expand All @@ -131,9 +109,6 @@ class SudoModeChallengeController extends BaseController
/**
* Sends a response indicating that the public key challenge did not succeed.
*
* {!! '@' !!}param \Illuminate\Http\Request $request
* {!! '@' !!}return void
*
* {!! '@' !!}throws \Illuminate\Validation\ValidationException
*/
protected function sendPublicKeyChallengeFailedResponse(Request $request): void
Expand All @@ -147,10 +122,6 @@ class SudoModeChallengeController extends BaseController
/**
* Sends a response indicating that the user's requests have been rate limited.
*
* {!! '@' !!}param \Illuminate\Http\Request $request
* {!! '@' !!}param int $availableInSeconds
* {!! '@' !!}return void
*
* {!! '@' !!}throws \Illuminate\Validation\ValidationException
*/
protected function sendRateLimitedResponse(Request $request, int $availableInSeconds): void
Expand Down
Loading

0 comments on commit 01dfb2e

Please sign in to comment.