백엔드
-
hmac 을 이용하여 FastAPI의 middle에 암호화 적용하기Backend/암호화관련 2023. 6. 13. 21:32
필자는 앞 글에서 hmac을 이용하여, 암호화 생성 방법을 제시하였다. 그리고 기존의 FastAPI를 이용한 백엔드 통신에서 미들 웨어 부분에 적용하였다. def init_middleware(_app: FastAPI) -> None: """ 미들웨어 초기값 설정 """ @_app.middleware("http") async def request_middleware(request: Request, call_next): try: request_id = str(uuid.uuid4()) request_id_contextvar.set(request_id) start_time = time.time() # ===== 암호화 관련 ===== # # print("Start") if "/docs" in str(reques..