3 Commits

Author SHA1 Message Date
5937c99eb4 change testoutput format 2021-06-17 19:10:18 +02:00
dfc5c8421a change testoutput format 2021-06-17 19:05:35 +02:00
b30e587c34 change testoutput format 2021-06-17 19:01:12 +02:00
2 changed files with 17 additions and 8 deletions

12
auth.py
View File

@ -2,7 +2,7 @@ from jose import JWTError, jwt
import werkzeug
import os
from loguru import logger
import json
JWT_PUB_KEY = ""
try:
@ -19,9 +19,9 @@ def decodeToken(token):
logger.error("{}".format(e))
raise werkzeug.exceptions.Unauthorized()
def testToken(user, token_info):
return '''
You are user_id {user} and the provided token has been signed by this issuers. Fine.'.
Decoded token claims: {token_info}.
'''.format(user=user, token_info=token_info)
def testToken(user, token_info):
return {
"message": f"You are user_id {user} and the provided token has been signed by this issuers. Fine.",
"details": json.dumps(token_info)
}

View File

@ -21,9 +21,9 @@ paths:
'200':
description: secret response
content:
'text/plain':
'application/json':
schema:
type: string
$ref: '#/components/schemas/TestOutput'
security:
- jwt: ['secret']
@ -35,3 +35,12 @@ components:
scheme: bearer
bearerFormat: JWT
x-bearerInfoFunc: auth.decodeToken
schemas:
TestOutput:
description: Test Output
type: object
properties:
message:
type: string
details:
type: string