保誠-保戶業務員媒合平台
wayne
2022-03-10 e8241decc705f9db3e46aed7b3a3f8b3188cf820
pamapi/src/main/java/com/pollex/pam/web/rest/EServiceResource.java
@@ -1,6 +1,7 @@
package com.pollex.pam.web.rest;
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.business.security.token.EServiceAuthenticationToken;
@@ -29,6 +30,9 @@
    @Autowired
    TokenProvider tokenProvider;
    @Autowired
    ConsultantService consultantService;
    @AuditLoggingInject(type = CONSULTANT_LOGIN)
    @PostMapping("/authenticate")
    public ResponseEntity<UserJWTController.JWTToken> authorize(@RequestBody EServiceLoginVM eServiceLoginVM) {
@@ -38,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);