3 Commits

2 changed files with 19 additions and 9 deletions

11
auth.py
View File

@ -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": JSON.stringify(token_info)
}

View File

@ -2,13 +2,13 @@ openapi: 3.0.0
info:
title: hv2-api
version: "1"
description: "REST-API for the nober.de Hausverwaltungs-Software"
description: "REST-API for the Nober Grundbesitz GbR Hausverwaltungs-Software"
termsOfService: "https://home.hottis.de/dokuwiki/doku.php?id=hv2pub:termsofuse"
contact:
name: "Wolfgang Hottgenroth"
email: "wolfgang.hottgenroth@icloud.com"
externalDocs:
description: "Find more details on this API here"
description: "Find more details here"
url: "https://home.hottis.de/dokuwiki/doku.php?id=hv2pub:externaldocs"
paths:
@ -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