From 242fad1691917c4fd82c7f04b6190a7113628e93 Mon Sep 17 00:00:00 2001 From: wayne <wayne8692wayne8692@gmail.com> Date: 星期五, 11 三月 2022 15:31:04 +0800 Subject: [PATCH] Merge branch 'pollex-dev' into sit --- pamapi/src/main/java/com/pollex/pam/web/rest/EServiceResource.java | 15 ++++++++++----- 1 files changed, 10 insertions(+), 5 deletions(-) diff --git a/pamapi/src/main/java/com/pollex/pam/web/rest/EServiceResource.java b/pamapi/src/main/java/com/pollex/pam/web/rest/EServiceResource.java index e8ac6f1..06a1eab 100644 --- a/pamapi/src/main/java/com/pollex/pam/web/rest/EServiceResource.java +++ b/pamapi/src/main/java/com/pollex/pam/web/rest/EServiceResource.java @@ -1,11 +1,11 @@ package com.pollex.pam.web.rest; -import com.pollex.pam.aop.logging.audit.AuditLoggingInject; -import com.pollex.pam.aop.logging.audit.AuditLoggingType; +import com.pollex.pam.business.aop.logging.audit.AuditLoggingInject; +import com.pollex.pam.business.service.ConsultantService; import com.pollex.pam.security.jwt.JWTFilter; import com.pollex.pam.security.jwt.TokenProvider; -import com.pollex.pam.security.token.EServiceAuthenticationToken; -import com.pollex.pam.web.rest.vm.EServiceLoginVM; +import com.pollex.pam.business.security.token.EServiceAuthenticationToken; +import com.pollex.pam.business.web.vm.EServiceLoginVM; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.http.HttpHeaders; import org.springframework.http.HttpStatus; @@ -18,7 +18,7 @@ import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RestController; -import static com.pollex.pam.aop.logging.audit.AuditLoggingType.CONSULTANT_LOGIN; +import static com.pollex.pam.business.aop.logging.audit.AuditLoggingType.CONSULTANT_LOGIN; @RestController @RequestMapping("/api/eService") @@ -30,6 +30,9 @@ @Autowired TokenProvider tokenProvider; + @Autowired + ConsultantService consultantService; + @AuditLoggingInject(type = CONSULTANT_LOGIN) @PostMapping("/authenticate") public ResponseEntity<UserJWTController.JWTToken> authorize(@RequestBody EServiceLoginVM eServiceLoginVM) { @@ -39,7 +42,9 @@ ); Authentication authentication = authenticationManagerBuilder.getObject().authenticate(authenticationToken); + consultantService.updateLoginTime(eServiceLoginVM.getUsername()); SecurityContextHolder.getContext().setAuthentication(authenticationToken); + String jwt = tokenProvider.createToken(authentication, false); HttpHeaders httpHeaders = new HttpHeaders(); httpHeaders.add(JWTFilter.AUTHORIZATION_HEADER, "Bearer" + jwt); -- Gitblit v1.8.0