Skip to content

Commit

Permalink
[#4] OAuth2.0 로그인 시도 실패 Handler
Browse files Browse the repository at this point in the history
  • Loading branch information
jun108059 committed Oct 3, 2021
1 parent ec14662 commit 873aeef
Showing 1 changed file with 33 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
package com.teamnexters.lazy.api.config.auth.handler;

import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.security.core.AuthenticationException;
import org.springframework.security.web.authentication.AuthenticationFailureHandler;
import org.springframework.stereotype.Component;

import javax.servlet.ServletException;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;

@Slf4j
@RequiredArgsConstructor
@Component
public class OAuth2FailureHandler implements AuthenticationFailureHandler {

/**
* Called when an authentication attempt fails.
*
* @param request the request during which the authentication attempt occurred.
* @param response the response.
* @param exception the exception which was thrown to reject the authentication
*/
@Override
public void onAuthenticationFailure(HttpServletRequest request, HttpServletResponse response, AuthenticationException exception)
throws IOException, ServletException {
log.info(">>> Failure Request : {}", request);
log.info(">>> Failure Response : {}", response);
log.error(">>> Error ", exception);
}
}

0 comments on commit 873aeef

Please sign in to comment.