Compare commits
4 Commits
Author | SHA1 | Date | |
---|---|---|---|
49e8aa43b4
|
|||
35a997774f
|
|||
08734cb82c
|
|||
875301b437
|
6
auth.py
6
auth.py
@ -57,7 +57,7 @@ def getUserEntryFromDB(application: str, login: str):
|
||||
for claimObj in cur:
|
||||
print("DEBUG: getUserEntryFromDB: add claim {} -> {}".format(claimObj["key"], claimObj["value"]))
|
||||
if claimObj["key"] in claims:
|
||||
if isinstance(claimObj["key"], list):
|
||||
if isinstance(claims[claimObj["key"]], list):
|
||||
claims[claimObj["key"]].append(claimObj["value"])
|
||||
else:
|
||||
claims[claimObj["key"]] = [ claims[claimObj["key"]] ]
|
||||
@ -101,9 +101,9 @@ def generateToken(**args):
|
||||
}
|
||||
for claim in userEntry.claims.items():
|
||||
# print("DEBUG: generateToken: add claim {} -> {}".format(claim[0], claim[1]))
|
||||
payload["x-{}".format(claim[0])] = claim[1]
|
||||
payload[claim[0]] = claim[1]
|
||||
|
||||
return jwt.encode(payload, JWT_ISSUER)
|
||||
return jwt.encode(payload, JWT_SECRET, algorithm='RS256')
|
||||
except NoUserException:
|
||||
print("ERROR: generateToken: no user found, login or application wrong")
|
||||
raise werkzeug.exceptions.Unauthorized()
|
||||
|
Reference in New Issue
Block a user