{"action":"created","issue":{"url":"https://api.github.com/repos/toymachiner62/hapi-authorization/issues/11","labels_url":"https://api.github.com/repos/toymachiner62/hapi-authorization/issues/11/labels{/name}","comments_url":"https://api.github.com/repos/toymachiner62/hapi-authorization/issues/11/comments","events_url":"https://api.github.com/repos/toymachiner62/hapi-authorization/issues/11/events","html_url":"https://github.com/toymachiner62/hapi-authorization/issues/11","id":119481100,"number":11,"title":"Route validation called after","user":{"login":"tomzaoral","id":1371109,"avatar_url":"https://avatars.githubusercontent.com/u/1371109?v=3","gravatar_id":"","url":"https://api.github.com/users/tomzaoral","html_url":"https://github.com/tomzaoral","followers_url":"https://api.github.com/users/tomzaoral/followers","following_url":"https://api.github.com/users/tomzaoral/following{/other_user}","gists_url":"https://api.github.com/users/tomzaoral/gists{/gist_id}","starred_url":"https://api.github.com/users/tomzaoral/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/tomzaoral/subscriptions","organizations_url":"https://api.github.com/users/tomzaoral/orgs","repos_url":"https://api.github.com/users/tomzaoral/repos","events_url":"https://api.github.com/users/tomzaoral/events{/privacy}","received_events_url":"https://api.github.com/users/tomzaoral/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":1,"created_at":"2015-11-30T12:18:45Z","updated_at":"2015-11-30T16:00:11Z","closed_at":null,"body":"Hello there!\r\nWe are using this Hapi plugin together with Joi validation. The problem is, when using aclQuery, the Joi validation is called after and therefore the parameter which is used in our aclQuery method is invalid (or doesn't exist) and calling this method is pointless.  \r\n\r\nThe solution would be to use Hapi extension point  `onPreHandler` instead of `onPostAuth` ([you can find here](https://github.com/toymachiner62/hapi-authorization/blob/master/lib/index.js#L47)). The difference between these two lifecycle points is that `onPreHandler` is called after path parameters, query and payload is validated.\r\n\r\nI tried to change it manually and it seems it works as expected. If there is no problem with this change, would you accept PR with that?"},"comment":{"url":"https://api.github.com/repos/toymachiner62/hapi-authorization/issues/comments/160670908","html_url":"https://github.com/toymachiner62/hapi-authorization/issues/11#issuecomment-160670908","issue_url":"https://api.github.com/repos/toymachiner62/hapi-authorization/issues/11","id":160670908,"user":{"login":"toymachiner62","id":485782,"avatar_url":"https://avatars.githubusercontent.com/u/485782?v=3","gravatar_id":"","url":"https://api.github.com/users/toymachiner62","html_url":"https://github.com/toymachiner62","followers_url":"https://api.github.com/users/toymachiner62/followers","following_url":"https://api.github.com/users/toymachiner62/following{/other_user}","gists_url":"https://api.github.com/users/toymachiner62/gists{/gist_id}","starred_url":"https://api.github.com/users/toymachiner62/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/toymachiner62/subscriptions","organizations_url":"https://api.github.com/users/toymachiner62/orgs","repos_url":"https://api.github.com/users/toymachiner62/repos","events_url":"https://api.github.com/users/toymachiner62/events{/privacy}","received_events_url":"https://api.github.com/users/toymachiner62/received_events","type":"User","site_admin":false},"created_at":"2015-11-30T16:00:11Z","updated_at":"2015-11-30T16:00:11Z","body":"I would accept a PR with that. I actually haven't messed with the aclQuery stuff much since i forked this project so if you send a PR along with a test/tests for the aclQuery changes you're proposing that'd be great."}}