@Test void login() throws Exception { mockMvc.perform(post("/login") .accept(MediaType.APPLICATION_JSON_VALUE) .contentType(MediaType.APPLICATION_JSON_VALUE) .content(getStub("gateway/login-request.json"))) .andDo(print()).andExpect(status().isUnauthorized()).andReturn(); }
@PostMapping public ResponseEntity login(@RequestBody AuthRequestTO loginRequest, HttpServletRequest request, HttpServletResponse response) { logger.info("received login request: {}", loginRequest); AuthRequestBO authRequestBO = converter.toAuthRequestBO(loginRequest); String rootToken = gatewaySecurityService.login(authRequestBO, request, response); logger.info("rootToken: {} was issued for loginRequest: {}", rootToken, loginRequest); Map<String, String> body = new HashMap<>(); body.put("login", "success"); return ResponseEntity.created(null) .body(body); }
LoginResource { @PostMapping public ResponseEntity login(@RequestBody AuthRequestTO loginRequest, HttpServletRequest request, HttpServletResponse response) { logger.info("received login request: {}", loginRequest); AuthRequestBO authRequestBO = converter.toAuthRequestBO(loginRequest); String rootToken = gatewaySecurityService.login(authRequestBO, request, response); logger.info("rootToken: {} was issued for loginRequest: {}", rootToken, loginRequest); Map<String, String> body = new HashMap<>(); body.put("login", "success"); return ResponseEntity.created(null) .body(body); } }
LoginResource { @PostMapping public ResponseEntity login(@RequestBody AuthRequestTO loginRequest, HttpServletRequest request, HttpServletResponse response) { logger.info("received login request: {}", loginRequest); AuthRequestBO authRequestBO = converter.toAuthRequestBO(loginRequest); String rootToken = gatewaySecurityService.login(authRequestBO, request, response); logger.info("rootToken: {} was issued for loginRequest: {}", rootToken, loginRequest); Map<String, String> body = new HashMap<>(); body.put("login", "success"); return ResponseEntity.created(null) .body(body); } @Autowired  LoginResource(GatewaySecurityService gatewaySecurityService,
                         GatewayConverter converter); }
LoginResource { @PostMapping public ResponseEntity login(@RequestBody AuthRequestTO loginRequest, HttpServletRequest request, HttpServletResponse response) { logger.info("received login request: {}", loginRequest); AuthRequestBO authRequestBO = converter.toAuthRequestBO(loginRequest); String rootToken = gatewaySecurityService.login(authRequestBO, request, response); logger.info("rootToken: {} was issued for loginRequest: {}", rootToken, loginRequest); Map<String, String> body = new HashMap<>(); body.put("login", "success"); return ResponseEntity.created(null) .body(body); } @Autowired  LoginResource(GatewaySecurityService gatewaySecurityService,
                         GatewayConverter converter); @PostMapping ResponseEntity login(@RequestBody AuthRequestTO loginRequest,
                                HttpServletRequest request,
                                HttpServletResponse response); }
LoginResource { @PostMapping public ResponseEntity login(@RequestBody AuthRequestTO loginRequest, HttpServletRequest request, HttpServletResponse response) { logger.info("received login request: {}", loginRequest); AuthRequestBO authRequestBO = converter.toAuthRequestBO(loginRequest); String rootToken = gatewaySecurityService.login(authRequestBO, request, response); logger.info("rootToken: {} was issued for loginRequest: {}", rootToken, loginRequest); Map<String, String> body = new HashMap<>(); body.put("login", "success"); return ResponseEntity.created(null) .body(body); } @Autowired  LoginResource(GatewaySecurityService gatewaySecurityService,
                         GatewayConverter converter); @PostMapping ResponseEntity login(@RequestBody AuthRequestTO loginRequest,
                                HttpServletRequest request,
                                HttpServletResponse response);  }