Compare commits
4 Commits
Author | SHA1 | Date | |
---|---|---|---|
309b4c6ba8
|
|||
a921fb6a0f
|
|||
f56db65012
|
|||
ef0793be4e
|
9
auth.py
9
auth.py
@ -32,13 +32,11 @@ UserEntry = namedtuple('UserEntry', ['id', 'login', 'expiry', 'claims'])
|
|||||||
|
|
||||||
JWT_PRIV_KEY = ""
|
JWT_PRIV_KEY = ""
|
||||||
with open('/opt/app/config/authservice.key', 'r') as f:
|
with open('/opt/app/config/authservice.key', 'r') as f:
|
||||||
JWT_PRIV_KEY = f.read().replace('\n','')
|
JWT_PRIV_KEY = f.read()
|
||||||
print("DEBUG PRIVKEY: {}".format(JWT_PRIV_KEY))
|
|
||||||
|
|
||||||
JWT_PUB_KEY = ""
|
JWT_PUB_KEY = ""
|
||||||
with open('/opt/app/config/authservice.pub', 'r') as f:
|
with open('/opt/app/config/authservice.pub', 'r') as f:
|
||||||
JWT_PUB_KEY = f.read().replace('\n','')
|
JWT_PUB_KEY = f.read()
|
||||||
print("DEBUG PUBKEY: {}".format(JWT_PUB_KEY))
|
|
||||||
|
|
||||||
|
|
||||||
def getUserEntryFromDB(application: str, login: str):
|
def getUserEntryFromDB(application: str, login: str):
|
||||||
@ -131,5 +129,8 @@ def generateToken(**args):
|
|||||||
print("ERROR: generateToken: unspecific exception: {}".format(str(e)))
|
print("ERROR: generateToken: unspecific exception: {}".format(str(e)))
|
||||||
raise werkzeug.exceptions.Unauthorized()
|
raise werkzeug.exceptions.Unauthorized()
|
||||||
|
|
||||||
|
def generateTokenFromEnc(content):
|
||||||
|
return content
|
||||||
|
|
||||||
def getPubKey():
|
def getPubKey():
|
||||||
return JWT_PUB_KEY
|
return JWT_PUB_KEY
|
||||||
|
19
openapi.yaml
19
openapi.yaml
@ -7,7 +7,7 @@ paths:
|
|||||||
/auth:
|
/auth:
|
||||||
post:
|
post:
|
||||||
tags: [ "JWT" ]
|
tags: [ "JWT" ]
|
||||||
summary: Return JWT token
|
summary: Accept login and password, return JWT token
|
||||||
operationId: auth.generateToken
|
operationId: auth.generateToken
|
||||||
requestBody:
|
requestBody:
|
||||||
content:
|
content:
|
||||||
@ -21,6 +21,23 @@ paths:
|
|||||||
'text/plain':
|
'text/plain':
|
||||||
schema:
|
schema:
|
||||||
type: string
|
type: string
|
||||||
|
/authe:
|
||||||
|
post:
|
||||||
|
tags: [ "JWT" ]
|
||||||
|
summary: Accept encrypted set of credentials, return JWT token
|
||||||
|
operationId: auth.generateTokenFromEnc
|
||||||
|
requestBody:
|
||||||
|
content:
|
||||||
|
'text/plain':
|
||||||
|
schema:
|
||||||
|
type: string
|
||||||
|
responses:
|
||||||
|
'200':
|
||||||
|
description: JWT token
|
||||||
|
content:
|
||||||
|
'text/plain':
|
||||||
|
schema:
|
||||||
|
type: string
|
||||||
/secret:
|
/secret:
|
||||||
get:
|
get:
|
||||||
tags: [ "JWT" ]
|
tags: [ "JWT" ]
|
||||||
|
Reference in New Issue
Block a user