refactor(api): Switch to dify_config (#6750)
Signed-off-by: -LAN- <laipz8200@outlook.com>
This commit is contained in:
parent
daa31b2cb3
commit
a98284b1ef
5 changed files with 21 additions and 19 deletions
|
|
@ -1,15 +1,16 @@
|
|||
import jwt
|
||||
from flask import current_app
|
||||
from werkzeug.exceptions import Unauthorized
|
||||
|
||||
from configs import dify_config
|
||||
|
||||
|
||||
class PassportService:
|
||||
def __init__(self):
|
||||
self.sk = current_app.config.get('SECRET_KEY')
|
||||
|
||||
self.sk = dify_config.SECRET_KEY
|
||||
|
||||
def issue(self, payload):
|
||||
return jwt.encode(payload, self.sk, algorithm='HS256')
|
||||
|
||||
|
||||
def verify(self, token):
|
||||
try:
|
||||
return jwt.decode(token, self.sk, algorithms=['HS256'])
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue