Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature: Implement as Form Request Validation rather than Controller subclass #123

Open
malhal opened this issue May 11, 2016 · 0 comments

Comments

@malhal
Copy link

malhal commented May 11, 2016

Somewhere down the line Laravel supported Form Request Validation where you create a Request subclass and implement an authorise method. That seems to me to be the perfect place to check an API key.
https://laravel.com/docs/master/validation#form-request-validation

Then a controller could look like this, not no subclass of APIGuardController

class PostController extends Controller
{
    public function store(APIGuardRequest $request){
    }
}

Then you could easily choose which methods are guarded and which aren't, by simply omitting the request param. Then you wouldn't need to deal with the cumbersome apiMethods property for turning key auth off and thus would probably reduce code complexity.

Just thought I'd mention this is its the first thing that came to mind when deciding to use api-guard.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant