Best Testsigma code snippet using com.testsigma.security.AjaxLoginSuccessHandler.onAuthenticationSuccess
Source:AjaxLoginSuccessHandler.java
...20 private Boolean httpOnly;21 @Value("#{new Boolean('${server.servlet.session.cookie.secure}')}")22 private Boolean secure;23 @Override24 public void onAuthenticationSuccess(HttpServletRequest request, HttpServletResponse response,25 Authentication authentication) throws IOException, ServletException {26 response.setStatus(HttpServletResponse.SC_OK);27 response.setContentType("application/json;charset=UTF-8");28 response.setHeader("Cache-Control", "no-cache");29 AuthUser authUser = (AuthUser) authentication.getPrincipal();30 CurrentUserService.setCurrentUser(authUser);31 String token = JWTTokenService.generateAuthToken(authUser);32 Cookie cookie = new Cookie(JWTTokenService.JWT_COOKIE_NAME, token);33 cookie.setSecure(secure);34 cookie.setHttpOnly(httpOnly);35 cookie.setPath("/");36 response.addCookie(cookie);37 if (canSendRedirect(authentication))38 response.sendRedirect("/");...
Learn to execute automation testing from scratch with LambdaTest Learning Hub. Right from setting up the prerequisites to run your first automation test, to following best practices and diving deeper into advanced test scenarios. LambdaTest Learning Hubs compile a list of step-by-step guides to help you be proficient with different test automation frameworks i.e. Selenium, Cypress, TestNG etc.
You could also refer to video tutorials over LambdaTest YouTube channel to get step by step demonstration from industry experts.
Get 100 minutes of automation test minutes FREE!!