| | |
| | | |
| | | import com.ycl.jxkg.config.property.CookieConfig; |
| | | |
| | | import com.ycl.jxkg.utils.CaffeineUtil; |
| | | import com.ycl.jxkg.utils.JsonUtil; |
| | | import org.slf4j.LoggerFactory; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.security.authentication.UsernamePasswordAuthenticationToken; |
| | | import org.springframework.security.core.Authentication; |
| | | import org.springframework.security.core.AuthenticationException; |
| | |
| | | import javax.servlet.http.HttpServletResponse; |
| | | import java.io.IOException; |
| | | import java.io.InputStream; |
| | | import java.util.Enumeration; |
| | | |
| | | |
| | | /** |
| | |
| | | * @date 2021/12/25 9:45 |
| | | */ |
| | | public class RestLoginAuthenticationFilter extends AbstractAuthenticationProcessingFilter { |
| | | |
| | | private final org.slf4j.Logger logger = LoggerFactory.getLogger(RestLoginAuthenticationFilter.class); |
| | | |
| | | @Autowired |
| | | private CaffeineUtil caffeineUtil; |
| | | |
| | | /** |
| | | * Instantiates a new Rest login authentication filter. |
| | |
| | | try (InputStream is = request.getInputStream()) { |
| | | AuthenticationBean authenticationBean = JsonUtil.toJsonObject(is, AuthenticationBean.class); |
| | | request.setAttribute(TokenBasedRememberMeServices.DEFAULT_PARAMETER, authenticationBean.isRemember()); |
| | | |
| | | authRequest = new UsernamePasswordAuthenticationToken(authenticationBean.getUserName(), authenticationBean.getPassword()); |
| | | } catch (IOException e) { |
| | | logger.error(e.getMessage(), e); |