def require_oauth(self, *scopes):
def wrapper(f):<EOL><INDENT>@wraps(f)<EOL>def decorated(*args, **kwargs):<EOL><INDENT>for func in self._before_request_funcs:<EOL><INDENT>func()<EOL><DEDENT>if hasattr(request, '<STR_LIT>') and request.oauth:<EOL><INDENT>return f(*args, **kwargs)<EOL><DEDENT>valid, req = self.verify_request(scopes)<EOL>for func in self._after_request_funcs:<EOL><INDENT>valid, req = func(valid, req)<EOL><DEDENT>if not valid:<EOL><INDENT>if self._invalid_response:<EOL><INDENT>return self._invalid_response(req)<EOL><DEDENT>return abort(<NUM_LIT>)<EOL><DEDENT>request.oauth = req<EOL>return f(*args, **kwargs)<EOL><DEDENT>return decorated<EOL><DEDENT>return wrapper<EOL>
Protect resource with specified scopes.