def user(user_uri=None): if not user_uri: return Oauth1Errors.bad_request('You must supply a User URI') else: cons_check = app.auth.authorize_consumer() if isinstance(cons_check, str): return Oauth1Errors.forbidden(cons_check) authorized = app.auth.authorize_request(uri='oauth/access_token') if isinstance(authorized, str): return Oauth1Errors.unauthorized(authorized) return jsonify(uri=user_uri)
def oauth(action=None): if action == 'access_token': cons_check = auth.authorize_consumer() if isinstance(cons_check, str): return Oauth1Errors.bad_request(cons_check) authorized = auth.authorize_request(uri='oauth/access_token') if isinstance(authorized, str): return Oauth1Errors.unauthorized(authorized) # Check username/password from XAuth x_check = auth.authorize_xauth() if isinstance(x_check, str): return Oauth1Errors.bad_request(x_check) return jsonify(status='ok') else: return Oauth1Errors.not_found('There is no valid resource here')
def oauth(action=None): if app.auth is None: return Oauth1Errors.server_error(msg='The auth object is not initialized properly') if action == 'access_token': cons_check = app.auth.authorize_consumer() if isinstance(cons_check, str): return Oauth1Errors.bad_request(cons_check) authorized = app.auth.authorize_request(uri='oauth/access_token') if isinstance(authorized, str): return Oauth1Errors.unauthorized(authorized) # Check username/password from XAuth x_check = app.auth.authorize_xauth() if isinstance(x_check, str): return Oauth1Errors.bad_request(x_check) return jsonify(status='ok') else: return Oauth1Errors.not_found('There is no valid resource here')
def not_found(error): return Oauth1Errors.not_found()