OCT 1. 操作日志记录正确的login用户ID
This commit is contained in:
parent
60e4dd94db
commit
b507206bb8
src/main/java/com/cmhi/cf/authentication/impl
|
@ -13,6 +13,7 @@ import com.cmhi.cf.common.ErrorCode;
|
|||
import com.cmhi.cf.database.common.service.OperationLogDataBaseService;
|
||||
import com.cmhi.cf.misc.HelperUtils;
|
||||
import com.cmhi.cf.restapi.config.ProtocolConfigure;
|
||||
import com.cmhi.cf.restapi.misc.ApiContextUtils;
|
||||
import com.cmhi.cf.restapi.pojo.base.BaseRespStatus;
|
||||
import com.cmhi.cf.restapi.pojo.dto.ProtocolReq;
|
||||
import com.cmhi.cf.validation.group.ValidGroups;
|
||||
|
@ -159,7 +160,8 @@ public class JwtCustomUsernamePassword extends UsernamePasswordAuthenticationFil
|
|||
.username(authResult.getName())
|
||||
.token(jc.getJwt())
|
||||
.logTime(System.currentTimeMillis())
|
||||
.expireTime(System.currentTimeMillis() + ProtocolConfigure.TIMEOUT_OF_SECONDS * 1000L)
|
||||
.expireTime(
|
||||
System.currentTimeMillis() + ProtocolConfigure.TIMEOUT_OF_SECONDS * 1000L)
|
||||
.build();
|
||||
loginRsp.setMessage(new String[] {ErrorCode.ERR_OK.getDescription()});
|
||||
loginRsp.setStatus(ErrorCode.ERR_OK.getCode());
|
||||
|
@ -170,7 +172,15 @@ public class JwtCustomUsernamePassword extends UsernamePasswordAuthenticationFil
|
|||
eventPublisher.publishEvent(new InteractiveAuthenticationSuccessEvent(authResult, this.getClass()));
|
||||
}
|
||||
|
||||
SecurityResponseUtils.authenticationResponse(request, response, loginRsp,
|
||||
"[" + authResult.getName() + "] login", optLogDbService);
|
||||
// 缓存 JWT 以及用户信息
|
||||
ApiContextUtils.setJwtUserInfo(jwt, au.getUsername(), au.getUserId());
|
||||
|
||||
try {
|
||||
SecurityResponseUtils.authenticationResponse(request, response, loginRsp,
|
||||
"[" + authResult.getName() + "] login", optLogDbService);
|
||||
} finally {
|
||||
ApiContextUtils.clear();
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue