Skip to content

3.1.3 #27

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 11 commits into from
Oct 28, 2023
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
add postHandle
  • Loading branch information
xlorne committed Oct 27, 2023
commit c901b429fced6a6cd2f850c7e6ab2fdbfa4f4d15
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,12 @@

import com.codingapi.springboot.security.configurer.HttpSecurityConfigurer;
import com.codingapi.springboot.security.controller.VersionController;
import com.codingapi.springboot.security.dto.request.LoginRequest;
import com.codingapi.springboot.security.filter.*;
import com.codingapi.springboot.security.jwt.Jwt;
import com.codingapi.springboot.security.properties.SecurityJwtProperties;
import jakarta.servlet.http.HttpServletRequest;
import jakarta.servlet.http.HttpServletResponse;
import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean;
import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.context.annotation.Bean;
Expand Down Expand Up @@ -57,8 +60,17 @@ public PasswordEncoder passwordEncoder() {
@Bean
@ConditionalOnMissingBean
public SecurityLoginHandler securityLoginHandler(){
return (request, response, handler) -> {
};
return new SecurityLoginHandler() {
@Override
public void preHandle(HttpServletRequest request, HttpServletResponse response, LoginRequest handler) throws Exception {

}

@Override
public void postHandle(HttpServletRequest request, HttpServletResponse response, LoginRequest handler) {

}
};
}


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,9 @@ protected void successfulAuthentication(HttpServletRequest request, HttpServletR
String content = JSONObject.toJSONString(SingleResponse.of(login));
IOUtils.write(content, response.getOutputStream(), StandardCharsets.UTF_8);

loginHandler.postHandle(request,response,loginRequest);
LoginRequestContext.getInstance().clean();

}


Expand Down
Original file line number Diff line number Diff line change
@@ -1,11 +1,13 @@
package com.codingapi.springboot.security.filter;

import com.codingapi.springboot.security.dto.request.LoginRequest;

import jakarta.servlet.http.HttpServletRequest;
import jakarta.servlet.http.HttpServletResponse;

public interface SecurityLoginHandler {

void preHandle(HttpServletRequest request, HttpServletResponse response, LoginRequest handler) throws Exception;
void preHandle(HttpServletRequest request, HttpServletResponse response, LoginRequest handler) throws Exception;

void postHandle(HttpServletRequest request, HttpServletResponse response, LoginRequest handler);

}