Compare commits
6 Commits
Author | SHA1 | Date | |
---|---|---|---|
b500b81d80
|
|||
5937c99eb4
|
|||
dfc5c8421a
|
|||
b30e587c34
|
|||
3d0e602ee6
|
|||
30aa514495
|
@ -57,5 +57,5 @@ deploy:
|
||||
- docker rm $CONTAINER_NAME || echo "$CONTAINER_NAME not exsting, anyway okay"
|
||||
- docker login -u gitlab-ci-token -p $CI_JOB_TOKEN $CI_REGISTRY;
|
||||
- docker pull $IMAGE_NAME:${CI_COMMIT_TAG}
|
||||
- docker run -d --restart always --name "hv2-api" --network docker-server --ip 172.16.10.38 -v $SERVICE_VOLUME:/opt/app/config $IMAGE_NAME:${CI_COMMIT_TAG}
|
||||
- docker run -d --restart always --name $CONTAINER_NAME --network docker-server --ip 172.16.10.38 -v $SERVICE_VOLUME:/opt/app/config $IMAGE_NAME:${CI_COMMIT_TAG}
|
||||
|
||||
|
12
auth.py
12
auth.py
@ -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)
|
||||
}
|
19
openapi.yaml
19
openapi.yaml
@ -2,16 +2,14 @@ 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"
|
||||
server:
|
||||
url: "https://api.hv.nober.de/v1"
|
||||
|
||||
paths:
|
||||
/v1/test:
|
||||
@ -23,9 +21,9 @@ paths:
|
||||
'200':
|
||||
description: secret response
|
||||
content:
|
||||
'text/plain':
|
||||
'application/json':
|
||||
schema:
|
||||
type: string
|
||||
$ref: '#/components/schemas/TestOutput'
|
||||
security:
|
||||
- jwt: ['secret']
|
||||
|
||||
@ -37,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
|
||||
|
Reference in New Issue
Block a user