We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent ab77be7 commit 6696763Copy full SHA for 6696763
examples/jwt_auth.py
@@ -31,10 +31,9 @@
31
using basic HTTP auth on some web-server you will have to.
32
"""
33
34
-
+import hmac
35
from flask import Flask, jsonify, request
36
from flask_jwt import JWT, jwt_required, current_identity, JWTError
37
-from werkzeug.security import safe_str_cmp
38
from flasgger import Swagger
39
40
@@ -58,7 +57,7 @@ def __str__(self):
58
57
59
def authenticate(username, password):
60
user = username_table.get(username, None)
61
- if user and safe_str_cmp(user.password.encode('utf-8'), password.encode('utf-8')):
+ if user and hmac.compare_digest(user.password.encode('utf-8'), password.encode('utf-8')):
62
return user
63
64
0 commit comments