Add option to use custom responses for authorization exceptions.

In the main branch, it's possible to return custom output for authorization problems while processing a request, which is very useful for e.g. authorization as an OAuth provider and needing to return certain headers as required by the OAuth spec. This is missing with the enhanced authorization hooks in the perms branch but can be added back relatively easily.