TsgcWSAPIServer_WebAuthn이벤트 › OnWebAuthnException

OnWebAuthnException 이벤트

WebAuthn 요청을 처리하는 동안 처리되지 않은 예외가 발생할 때 발생합니다. 애플리케이션이 오류를 로깅하고 HTTP 응답 코드를 재정의할 수 있도록 합니다.

구문

property OnWebAuthnException: TsgcWebAuthnOnExceptionEvent;
// TsgcWebAuthnOnExceptionEvent = procedure(Sender: TObject; E: Exception; var aResponseCode: Integer) of object

기본값

설명

registration 또는 authentication 요청이 처리되지 않은 예외로 실패할 때마다 발생합니다. E는 예외 인스턴스이고 aResponseCode는 서버가 반환할 HTTP 상태 코드(기본값 500)입니다. 적절한 경우 400 또는 403과 같은 더 구체적인 상태로 오류를 매핑하도록 변경하십시오. 중앙 집중식 로깅과 내부 오류를 안정적인 HTTP 계약으로 변환하는 데 유용합니다.

예제

procedure TForm1.sgcWSAPIServer_WebAuthn1WebAuthnException(Sender: TObject;
  E: Exception; var aResponseCode: Integer);
begin
  LogError('WebAuthn: ' + E.ClassName + ' - ' + E.Message);
  if E is EsgcWebAuthn_InvalidRequest then
    aResponseCode := 400;
end;

이벤트로 돌아가기