You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
15 lines
405 B
15 lines
405 B
from flask_httpauth import HTTPTokenAuth
|
|
from itsdangerous import TimedJSONWebSignatureSerializer
|
|
from units import consul_kv
|
|
secret_key = consul_kv.get_value('ConsulManager/assets/secret/skey')['sk']
|
|
s = TimedJSONWebSignatureSerializer(secret_key)
|
|
auth = HTTPTokenAuth()
|
|
|
|
@auth.verify_token
|
|
def verify_token(token):
|
|
try:
|
|
data = s.loads(token)
|
|
except:
|
|
return False
|
|
return True
|