フォームのログイン
10668 ワード
フォームのログイン
DefaultLoginPageGeneratingFilter
処理
UsernamePasswordAuthenticationFilter
POST/loginを処理します.ProcessingUrlを変更すると、アドレスを変更できます.
form認証の処理に使用されるフィルタは、Spring Securityで最もよく使用されます.
キー設定について
@Override
public Authentication attemptAuthentication(HttpServletRequest request, HttpServletResponse response)
throws AuthenticationException {
if (this.postOnly && !request.getMethod().equals("POST")) {
throw new AuthenticationServiceException("Authentication method not supported: " + request.getMethod());
}
String username = obtainUsername(request);
username = (username != null) ? username : "";
username = username.trim();
String password = obtainPassword(request);
password = (password != null) ? password : "";
UsernamePasswordAuthenticationToken authRequest = new UsernamePasswordAuthenticationToken(username, password);
// Allow subclasses to set the "details" property
setDetails(request, authRequest);
return this.getAuthenticationManager().authenticate(authRequest);
}
DefaultLogoutPageGeneratingFilter
処理
この機能は、
LogoutFilter
POST/logoutを処理します.processiongUrlは変更できます.
ログアウトの処理
削除処理
private void doFilter(HttpServletRequest request, HttpServletResponse response, FilterChain chain)
throws IOException, ServletException {
if (requiresLogout(request, response)) {
Authentication auth = SecurityContextHolder.getContext().getAuthentication();
if (this.logger.isDebugEnabled()) {
this.logger.debug(LogMessage.format("Logging out [%s]", auth));
}
this.handler.logout(request, response, auth);
this.logoutSuccessHandler.onLogoutSuccess(request, response, auth);
return;
}
chain.doFilter(request, response);
}
LogoutHandler
LogoutSuccessHandler
throws IOException, ServletException;
Reference
この問題について(フォームのログイン), 我々は、より多くの情報をここで見つけました https://velog.io/@ysb05222/폼-로그인-3yx549fcテキストは自由に共有またはコピーできます。ただし、このドキュメントのURLは参考URLとして残しておいてください。
Collection and Share based on the CC Protocol