def post(cls):
     """
     User Logout blacklist's the "jti" which restricts the access.
     """
     jti = get_raw_jwt()["jti"]
     BLACKLIST.add(jti)
     return {"msg": USER_LOGGED_OUT}, 200
예제 #2
0
    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 max_res(USER_LOGGED_OUT.format(user_id=user_id))
예제 #3
0
 def post(self):
     # This uses the get_raw_jwt(), function of Flask-JWT-Extended.
     # It gives us a dictionary of the various properties stored inside the decoded JWT.
     jti = get_raw_jwt()[
         'jti']  # jti is a unique id for a JWT(not for the user!)
     BLACKLIST.add(jti)
     return {'message': 'Successfully logged out.'}, 200
예제 #4
0
 def post(self):
     jti = get_raw_jwt()["jti"]
     user_id = get_jwt_identity()
     BLACKLIST.add(jti)
     return {
         "message": "User <id={}> successfully logged out.".format(user_id)
     }, 200
예제 #5
0
 def post(self):
     # jti = 'JWT Id', a unique identifier for a JWT.
     jti = get_raw_jwt()['jti']
     BLACKLIST.add(jti)
     return {
         'message': 'Successfully logged out!'
     }, 200
 def post(self):
     jti = get_raw_jwt()[
         'jti']  #jti is 'JW IDD' , a unique identifier for a JWT.
     BLACKLIST.add(
         jti
     )  #blackliste ekleyerek çıkış yapıltıkdan sonra bu jwt yi artık geçersiz sayıyoruz
     return {'message': 'Successfully logged out.'}, 200
    def __init__(self, main_window, parent=None):

        gtk.Menu.__init__(self)
        self.main_window = main_window
        self._parent = parent
        self.hide_show_mainwindow = gtk.MenuItem(_('Hide/Show Journal'))
        self.hide_show_mainwindow.connect('activate', self._on_activate)
        self.incognito_enable = gtk.MenuItem(
            _('Start incognito mode (pause event logging)'))
        self.incognito_enable.connect('activate', self._toggle_incognito)
        self.incognito_disable = gtk.MenuItem(
            _('Resume event logging (exit incognito)'))
        self.incognito_disable.connect('activate', self._toggle_incognito)
        self.quit = gtk.ImageMenuItem(gtk.STOCK_QUIT)
        self.quit.connect('activate',
                          lambda *args: self.main_window.quit_and_save())

        self.append(self.hide_show_mainwindow)
        self.append(self.incognito_enable)
        self.append(self.incognito_disable)
        self.append(gtk.SeparatorMenuItem())
        self.append(self.quit)

        self.show_all()

        BLACKLIST.set_incognito_toggle_callback(self._update_incognito)
        if self._update_incognito() is None:
            self.incognito_enable.hide()
            self.incognito_disable.hide()
예제 #8
0
 def post(self):
     # 'logout' == 'invoke' == 'blacklist (only) token (not user_id)'
     # Note: each token has unique id of token call JWT_ID (jti)
     # All we have to do is blacklist jti
     jti = get_raw_jwt()['jti']
     BLACKLIST.add(jti)
     return {'msg': 'Logout successfully.'}
예제 #9
0
 def post(self):
     # blacklist current token, and force user to get a new token by logining-in
     # every token has a unique ID == jti
     jti = get_raw_jwt()[
         'jti']  # jti is "JWT ID", a unique identifier for a JWT.
     BLACKLIST.add(jti)
     return {"message": "Succesfully logged out."}, 200
예제 #10
0
 def post(self):
     # Every time a user logs in an unique 'JWT ID' is created.
     # In order to logout the user we need to blacklist this id and not the
     # 'USER ID', otherwise they wouldn't be able to login again.
     jti = get_raw_jwt()['jti']
     BLACKLIST.add(jti)
     return {'message': 'Successfully logged out.'}, 200
예제 #11
0
    def post(self):
        """Logout and expired token
        @@@

        #### input(Add Authorization to header)
        ```
        {
        "username":"******",
        "password":"******"
        }

        ```

        #### output:
        ```
        {
            "message": "Successfully logged out"
        }
        ```
        @@@
        """
        jti = get_raw_jwt()[
            'jti']  # jti stands fro 'JWT ID' a unique identifier for a JWT
        BLACKLIST.add(jti)
        return {'message': 'Successfully logged out'}, 200
예제 #12
0
 def post(cls):
     jti = get_raw_jwt()['jti']
     BLACKLIST.add(jti)
     user = UserModel.find_by_id(get_jwt_identity())
     return {
         'message': gettext("user_logged_out").format(user.username)
     }, 200
예제 #13
0
 def get(self):
     # jti is JWT ID
     jti = get_raw_jwt()['jti']
     BLACKLIST.add(jti)
     return {
         'message': 'Successfully logged out'
     }, 200
예제 #14
0
    def post(self):
        # Big idea is to blacklist the unique id of a user's access token so that he can't use the same
        # token to log back in since it'll be in the blacklist
        jti = get_raw_jwt()['jti']
        BLACKLIST.add(jti)

        return "Successfully logged out.", 200
예제 #15
0
 def post(cls):
     try:
         jwt_id = get_raw_jwt()["jti"]
         user_id = get_jwt_identity()
         BLACKLIST.add(jwt_id)
         return {"message": gettext("user_logged_out")}, 200
     except:
         return {"message": gettext("user_error_logging_out")}, 500
예제 #16
0
 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": MESSAGES['USER_LOGGED_OUT'].format(user_id=user_id)
     }, 200
예제 #17
0
 def post(self):
     jti = get_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
예제 #18
0
 def get(self):
     jti = get_raw_jwt()['jti']
     BLACKLIST.add(jti)
     return make_response(
         jsonify({
             'message':
             'Logged out (Refresh token revoked) successfully!'
         }), 200)
예제 #19
0
    def get(self):
        user_id = get_jwt_identity()
        #print(user_id)
        jti = get_raw_jwt()['jti']
        # jti is "JWT ID", a unique identyfier for a JWT
        BLACKLIST.add(jti)

        return redirect('/')
예제 #20
0
 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": f"User <id={user_id}> successfully logged out."
     }, 200
예제 #21
0
 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)
     resp = make_response(redirect(f"/logout/{user_id}", code=200))
     unset_jwt_cookies(resp)
     return resp
    def post(self) -> tuple:
        """
        Logouts the user from app.
        """
        jti = get_raw_jwt()['jti']
        BLACKLIST.add(jti)

        return {'message': 'Successfully logged out.'}, 200
예제 #23
0
 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 {
         "success": True,
         "message": USER_LOGGED_OUT.format(user_id)
     }, 200
예제 #24
0
    def post(self):
        # this will later change to accommodate multiple users simultaneously from one enterprise account
        current_user_id = get_jwt_identity()
        if unload_databook(current_user_id, "all"):
            del loaded_databooks[current_user_id]

        jti = get_raw_jwt()["jti"]
        BLACKLIST.add(jti)
        return {"login": False}, 200
예제 #25
0
 def post(
     self
 ):  # to logout you just blacklist their login jwt_token making it non usable again,to get a new token they have to login,essentially logging out
     jti = get_raw_jwt(
     )['jti']  # blacklist the id for the token, which is unique for each token i.e the jti(JWT ID)
     BLACKLIST.add(jti)
     return {
         'message': "Successfully logged out. Login for continued services"
     }, 200
예제 #26
0
 def get(self):
     """ User Logout """
     # JWT ID will be blacklisted once user logout
     jti = get_raw_jwt()['jti']
     BLACKLIST.add(jti)
     return make_response(
         jsonify(
             {'message':
              'Logged out (Access token revoked) successfully!'}), 200)
예제 #27
0
 def post(cls):
     jti = get_raw_jwt()['jti']
     user_id = get_jwt_identity()
     BLACKLIST.add(jti)
     return {
         "message":
         _USER_LOGGED_OUT.format(
             UserModel.find_by_id(user_id).get_full_name())
     }, 200
예제 #28
0
파일: users.py 프로젝트: profxx/azulerosa
    def post(self):
        """
        Realizar Logout para revogar Token de acesso.
        """

        jwt_id = get_raw_jwt()["jti"]
        BLACKLIST.add(jwt_id)

        return jsonify({"message": "Logout realizado com sucesso!"}), 200
예제 #29
0
    def post(self):
        # Want to blacklist the jwt that the user has sent us

        # Get unique identifier for the access token, which
        # they all have (nothing to do with the particular user)
        # jti = jwt identifier
        jti = get_raw_jwt()['jti']
        BLACKLIST.add(jti)
        return {'message': 'Successfully logged out.'}, 200
예제 #30
0
 def delete(cls):
     user = UserModel.find_by_id(get_jwt_identity())
     logger.info(user)
     if not user:
         return {"message": "User not found."}, constant.CODE_NOT_FOUND
     user.delete_from_db()
     jti = get_raw_jwt()["jti"]
     BLACKLIST.add(jti)
     return {"message": "User deleted successfully."}, constant.CODE_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
예제 #32
0
 def post(self):
     jti = get_raw_jwt()['jti']
     BLACKLIST.add(jti)
     return {"message": "Successfully logged out"}, 200