def access_required(config=None):
def _access_required(http_method_handler):<EOL><INDENT>def secure_http_method_handler(self, *args, **kwargs):<EOL><INDENT>if not self.__provider_config__.authentication:<EOL><INDENT>_message = "<STR_LIT>"<EOL>authentication_error = prestans.exception.AuthenticationError(_message)<EOL>authentication_error.request = self.request<EOL>raise authentication_error<EOL><DEDENT>if not self.__provider_config__.authentication.is_authorized_user(config):<EOL><INDENT>_message = "<STR_LIT>"<EOL>authorization_error = prestans.exception.AuthorizationError(_message)<EOL>authorization_error.request = self.request<EOL>raise authorization_error<EOL><DEDENT>http_method_handler(self, *args, **kwargs)<EOL><DEDENT>return wraps(http_method_handler)(secure_http_method_handler)<EOL><DEDENT>return _access_required<EOL>
Authenticates a HTTP method handler based on a custom set of arguments