mirror of
https://github.com/github/codeql.git
synced 2026-05-05 13:45:19 +02:00
Add Authlib modeling and tests
This commit is contained in:
@@ -0,0 +1,18 @@
|
||||
from authlib.jose import jwt # It is already a JsonWebToken object
|
||||
from authlib.jose import JsonWebToken
|
||||
|
||||
# Encoding
|
||||
|
||||
# good - key and algorithm supplied
|
||||
jwt.encode({"alg": "HS256"}, token, "key")
|
||||
JsonWebToken().encode({"alg": "HS256"}, token, "key")
|
||||
|
||||
# bad - empty key
|
||||
jwt.encode({"alg": "HS256"}, token, "")
|
||||
JsonWebToken().encode({"alg": "HS256"}, token, "")
|
||||
|
||||
# Decoding
|
||||
|
||||
# good - "it will raise BadSignatureError when signature doesn’t match"
|
||||
jwt.decode(token, key)
|
||||
JsonWebToken().decode(token, key)
|
||||
Reference in New Issue
Block a user