-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
1 changed file
with
33 additions
and
0 deletions.
There are no files selected for viewing
33 changes: 33 additions & 0 deletions
33
api/src/main/java/com/teamnexters/lazy/api/config/auth/handler/OAuth2FailureHandler.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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); | ||
} | ||
} |