add better auth

This commit is contained in:
2025-03-25 11:45:09 -03:00
parent 2218a6f867
commit 317c79cee2
11 changed files with 912 additions and 46 deletions

View File

@@ -5,28 +5,16 @@ from aws_lambda_powertools.event_handler.api_gateway import (
content_types,
)
from aws_lambda_powertools.event_handler.exceptions import ServiceError
from aws_lambda_powertools.event_handler.openapi.models import (
HTTPBearer,
Server,
)
from aws_lambda_powertools.logging import correlation_paths
from aws_lambda_powertools.utilities.typing import LambdaContext
from middlewares import CorrelationIdMiddleware
from routes import courses, enrollments, orders, users, webhooks
tracer = Tracer()
logger = Logger(__name__)
app = APIGatewayHttpResolver(enable_validation=True)
app.enable_swagger(
servers=[Server(url='https://api.saladeaula.digital/v2')],
title='EDUSEG® Public API',
path='/_swagger',
compress=True,
security_schemes={'bearerAuth': HTTPBearer()},
security=[{'bearerAuth': []}],
persist_authorization=True,
)
app.use(middlewares=[CorrelationIdMiddleware('workspace')])
app.include_router(users.router, prefix='/users')
app.include_router(enrollments.router, prefix='/enrollments')
app.include_router(orders.router, prefix='/orders')
@@ -50,9 +38,3 @@ def exc_error(exc: ServiceError):
@tracer.capture_lambda_handler
def lambda_handler(event: dict, context: LambdaContext) -> dict:
return app.resolve(event, context)
# if __name__ == '__main__':
# print(
# app.get_openapi_json_schema(),
# )