Skip to content

Commit

Permalink
Added signed headers validation to /checklogin. Updated github actions
Browse files Browse the repository at this point in the history
  • Loading branch information
aydarng committed Jan 21, 2025
1 parent dbdcc8c commit 46e6e67
Show file tree
Hide file tree
Showing 5 changed files with 46 additions and 4 deletions.
5 changes: 5 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,9 +31,14 @@ See: [reg-pilot-webapp](https://github.com/GLEIF-IT/reg-pilot-webapp)
The verifier uses [keripy](https://github.com/WebOfTRust/keripy) for verifying the requests:
See: [vlei-verifier](https://github.com/GLEIF-IT/vlei-verifier)

### Filer
Filer service for report uploads:
See: [reg-pilot-filer](https://github.com/GLEIF-IT/reg-pilot-filer)

### Additional service
* KERI Witness Network
* vLEI Verifier
* Reg Pilot Filer
* KERI Agent

#### REST API
Expand Down
4 changes: 2 additions & 2 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@

setup(
name="reg-pilot-api",
version="0.0.2", # also change in src/regps/__init__.py
version="0.0.3", # also change in src/regps/__init__.py
license="Apache Software License 2.0",
description="RegPS: Regulation Portal Service API.",
long_description="RegPS: A Regulation Portal Service to orchestate web app, vLEI validation, etc.",
Expand Down Expand Up @@ -95,7 +95,7 @@
setup_requires=[],
entry_points={
"console_scripts": [
"regps = regps.app.cli.regps:main",
"reg-pilot-api = regps.app.cli.regps:main",
]
},
)
1 change: 1 addition & 0 deletions src/regps/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
__version__ = '0.0.3'
4 changes: 3 additions & 1 deletion src/regps/app/cli/regps.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,13 @@
import logging
import multicommand
import regps.app.fastapi_app as fastapi_app
import commands
from regps import __version__
from regps.app.cli import commands


def main():
parser = multicommand.create_parser(commands)
parser.add_argument('--version', action='version', version=f"%(prog)s {__version__}")
args = parser.parse_args()

if not hasattr(args, "handler"):
Expand Down
36 changes: 35 additions & 1 deletion src/regps/app/fastapi_app.py
Original file line number Diff line number Diff line change
Expand Up @@ -151,6 +151,7 @@ async def add_root_of_trust(

@app.get("/checklogin/{aid}", response_model=CheckLoginResponse)
async def check_login_route(
request: Request,
response: Response,
aid: str = Path(
...,
Expand All @@ -162,12 +163,45 @@ async def check_login_route(
}
},
),
signature: str = Header(
openapi_examples={
"default": {
"summary": "Default signature",
"value": upload_examples["request"]["headers"]["signature"],
}
}
),
signature_input: str = Header(
openapi_examples={
"default": {
"summary": "Default signature_input",
"value": upload_examples["request"]["headers"]["signature_input"],
}
}
),
signify_resource: str = Header(
openapi_examples={
"default": {
"summary": "Default signify_resource",
"value": upload_examples["request"]["headers"]["signify_resource"],
}
}
),
signify_timestamp: str = Header(
openapi_examples={
"default": {
"summary": "Default signify_timestamp",
"value": upload_examples["request"]["headers"]["signify_timestamp"],
}
}
),
):
"""
Given an AID returns information about the login
"""
try:
logger.info(f"CheckLogin: sending aid {aid}")
verify_signed_headers.process_request(request, aid)
resp = api_controller.check_login(aid)
lei = resp.get("lei")
aid = resp.get("aid")
Expand Down Expand Up @@ -601,7 +635,7 @@ def clear_status_route(


def main():
logger.info("Starting RegPS...")
logger.info("Starting Reg-Pilot-API")
import uvicorn

uvicorn.run(app, host="0.0.0.0", port=8000)
Expand Down

0 comments on commit 46e6e67

Please sign in to comment.