diff --git a/auth.py b/auth.py index 4f96cfd..c088db0 100755 --- a/auth.py +++ b/auth.py @@ -19,9 +19,10 @@ 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": token_info + } diff --git a/openapi.yaml b/openapi.yaml index 388fb6c..3e7ecc5 100644 --- a/openapi.yaml +++ b/openapi.yaml @@ -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: object