def editPerson(): surname = request.form.get('surname') forename = request.form.get('forename') location = request.form.get('location') email = request.form.get('email') url = request.form.get('url') tagline = request.form.get('tagline') is_disabled = request.form.get('is_disabled') nyunetid = request.form.get('nyunetid') # Get person by auth token current_token = get_raw_jwt() jti = current_token['jti'] # email address if request.form.get('person_id') is None: identity = current_token['identity'] else: identity = request.form.get('person_id') try: return makeResponse(payload=PeopleManager.editPerson(identity, forename, surname, location, email, url, tagline, is_disabled, nyunetid), message="") except FindError as e: return makeResponse(error=e) except ValidationError as e: return makeResponse(error=e) except DbError as e: return makeResponse(error=e) except SaveError as e: return makeResponse(error=e) except Exception as e: return makeResponse(error=e)
def getPersonRepos(): identity = request.form.get('person_id') if identity is None: current_token = get_raw_jwt() identity = current_token['identity'] try: return makeResponse(payload=PeopleManager.getReposForPerson(identity)) except FindError as e: return makeResponse(error=e)
def logout(): try: current_token = get_raw_jwt() jti = current_token['jti'] revoke_token(jti) return makeResponse(payload={}, message="Logged out") except KeyError as e: return makeResponse(error=e) except Exception as e: return makeResponse(error=e)
def logout(): """ Logout the user by revoking their token. :rtype: flask.Response """ jwt = get_raw_jwt() # Store the token in the database status of not currently revoked BlacklistedToken.add_token(jwt) return jsonify({'message': 'You were logged out successfully'})
def refresh(body=None, token_info=None, user=None): current_user_id = get_jwt_identity() user = User.query.filter(User.id == current_user_id).first() if user is None: revoke_token(get_raw_jwt()) return Problem( UNAUTHORIZED_ERROR, 'Could not grant access token.', 'User {} from refresh JWT identity could not be found.'.format(current_user_id)) if user.active: return {'access_token': create_access_token(identity=current_user_id, fresh=False)}, OBJECT_CREATED else: return user_deactivated_problem
def setRepoOwner(repo_id): # Get person by auth token current_token = get_raw_jwt() jti = current_token['jti'] # email address identity = current_token['identity'] ident_str = "p.email = {identity}" try: RepoManager.setOwner(int(repo_id), identity, ident_str) return makeResponse(payload={}, message="Set repository owner") except FindError as e: return makeResponse(error=e) except DbError as e: return makeResponse(error=e)
def addRepo(): url = request.form.get('url') name = request.form.get('name') readme = request.form.get('readme') license = request.form.get('license') published = request.form.get('published') # Get person by auth token current_token = get_raw_jwt() jti = current_token['jti'] # email address identity = current_token['identity'] ident_str = "p.email = {identity}" try: return makeResponse(payload=RepoManager.create(url, name, readme, license, published, identity, ident_str), message="Created repository") except ValidationError as e: return makeResponse(error=e)
def getPerson(): if request.method == 'GET': # Get person by auth token current_token = get_raw_jwt() jti = current_token['jti'] # email address identity = current_token['identity'] if request.method == 'POST': identity = int(request.form.get('person_id')) person = PeopleManager.getInfo(identity) ret = {} if person is not None: ret['person'] = person # If request method is GET, then it's our logged in user, get Repos and repo data too! if request.method == 'GET': ret['repos'] = PeopleManager.getRepos(identity) return makeResponse(payload=ret)
def post(self): jti = get_raw_jwt()['jti'] # jti is "JWT ID", a unique identifier for a JWT. BLACKLIST.add(jti) return {"message": "Successfully logged out"}, 200
def delete(self): jti = get_raw_jwt()['jti'] blacklist.add(jti) return response("OK", msg="Successfully logged out")
def post(self): jti = get_raw_jwt()['jti'] BLACKLIST.append(jti) return {"message": "Successfully logged out"}, 200
def dashboard(): user = get_raw_jwt()['identity'] return render_template('dashboard.html', user=user)
def protected(): app.logger.info('Processing default request') username = get_jwt_identity() tt = get_raw_jwt() return jsonify(logged_in_as=tt), 200
def post(cls): # jti is "JWT ID" unique identifier for a JWT jti = get_raw_jwt()["jti"] BLACKLIST.add(jti) return {"message": USER_LOGGED_OUT}, 200
def post(self): access_id = get_raw_jwt()['jti'] BLACKLIST.add(access_id) return {"message": "Logout successful"}
def post(self): jti = get_raw_jwt()['jti'] BLACKLIST.append(jti) return send_success('Success', {'message': 'successfully logged out.'}, status.HTTP_200_OK)
def post(self): jti = get_raw_jwt()[ 'jti'] #jti is jwt id , a unique identifier for a JWT BLACKLIST.add(jti) return {'message': 'Successfully logged out'}, 200
def revoke_access_token(): jti = get_raw_jwt()['jti'] user_identity = get_jwt_identity() revoke_token(jti, user_identity) return jsonify({'message': 'token revoked'}), 200
def post(self): # use balaclist current token instead of user id jti = get_raw_jwt()[ 'jti'] # jti is "JWT ID", an unique identifier for JWT BLACKLIST.add(jti) return {'message': 'Sucessfully logged out.'}, 200
def post(self): jti = get_raw_jwt()['jti'] #jti == JWT ID print(jti) BLACKLIST.add(jti) print(len(BLACKLIST)) return {'message': 'Successfully logged out ✌🏿'}, 200
def claims(): jwt = get_raw_jwt() claims_keys = [claim for claim in jwt] return jsonify(claims_keys), 200
def post(cls): jti = get_raw_jwt()["jti"] # jti is "JWT ID", a unique identifier for a JWT. user_id = get_jwt_identity() BLACKLIST.add(jti) return {"message": USER_LOGGED_OUT.format(user_id)}, 200
def post(self): jwt_id = get_raw_jwt()['jti'] # JWT Token Identifier BLACKLIST.add(jwt_id) return {"message": "Logged out successfully!"}, 200
def post(cls): jti = get_raw_jwt().get('jti') # jti is "JWT ID", a unique identifier for a JWT user_id = get_jwt_identity() BLACKLIST.add(jti) return {'message': gettext('user_logged_out').format(user_id)}, 200
def post(self): jwt_id = get_raw_jwt()['jti'] #JWT Token Identifier BLACKLIST.add(jwt_id) return {'message': 'Até breve'}
def logout(): jti = get_raw_jwt()['jti'] blacklist.add(jti) return 'berhasil logout'
def revoke_refresh_token(): jti = get_raw_jwt()['jti'] user_identity = get_jwt_identity() revoke_token(jti, user_identity) return jsonify({"message": "token revoked"}), 200
def logout(): jti = get_raw_jwt()['jti'] blacklist.add(jti) return jsonify({"msg": "Successfully logged out"}), 200
def post(self): jwt_id = get_raw_jwt()['jti'] BLACKLIST.add(jwt_id) return {'message': 'Logged out successfully!'}, 200
def post(self): jti = get_raw_jwt()["jti"] # jti is "JWT ID", a unique identifier for a JWT. user_id = get_jwt_identity() BLACKLIST.add(jti) return {"message": "User <id={}> successfully logged out.".format(user_id)}, 200
def post(self): jti = get_raw_jwt()['jti'] BLACKLIST.add(jti) return {"message": "Successfully logged out"}, 200
def post(cls): """Blacklist used token""" jti = get_raw_jwt()['jti'] # jti is JWT ID BLACKLIST.add(jti) return {'message': gettext("user_logged_out")}, 200
def post(cls): jti = get_raw_jwt()["jti"] # jti is "JWT ID", a unique identifier for a JWT. user_id = get_jwt_identity() BLACKLIST.add(jti) return {"message": gettext("user_logged_out").format(user_id=user_id)}, 200
def post(self): jti = get_raw_jwt()["jti"] # jti is "JWT ID", a unique identifier for a JWT. blacklist.add_to_blacklist(jti) return {MESSAGE: "Successfully logged out"}, 200
def post(self): revoked_tokens.append(get_raw_jwt()["jti"]) return make_response(jsonify({'message': 'Successfully logged out'}), 200)
def post(self): jti = get_raw_jwt()[ 'jti'] # jit is "JWT ID", a unique identifier for that JWT user = UserModel.find_by_id(get_jwt_identity()).json()['username'] BLACKLIST.add(jti) return {'message': '{} has successfully logged out.'.format(user)}
def post(self): jti = get_raw_jwt()['jti'] revoked_token = RevokedToken(jti=jti) revoked_token.add() return {"success": True}, 200
def logout(): '''Route to logut''' dump = get_raw_jwt()['jti'] blacklist.add(dump) return jsonify({'message': 'Logout successful'}), 200
def _revoke_current_token(): current_token = get_raw_jwt() jti = current_token['jti'] revoke_token(jti)
def get(cls): resp = make_response( render_template("/create_item.html", csrf_token=(get_raw_jwt() or {}).get("csrf"))) return resp
def logout_refresh_token(): blacklist.add(get_raw_jwt()["jti"]) return jsonify(message="Successfully logged out.")