Commit 3709f65e by chenzy

[新增]单点登录用户增加logstash日志

parent 0b75b62a
......@@ -4,6 +4,8 @@ import com.auth0.jwt.JWT;
import com.auth0.jwt.interfaces.Claim;
import com.auth0.jwt.interfaces.DecodedJWT;
import com.keymobile.auth.common.security.CustomizedUserDetailService;
import com.keymobile.login.logging.LogConstants;
import com.keymobile.login.logging.LogManager;
import com.keymobile.login.oauth2.Oauth2Properties;
import com.keymobile.login.service.AuthService;
import com.keymobile.login.util.Utils;
......@@ -142,6 +144,7 @@ public class LoginManagement {
authService.addDataRole(oauth2Properties.getInitRoleId(),Long.parseLong(newUser.get(0).get("id").toString()));
log.info("初始化权限id:{},新增用户{}权限初始化成功。", oauth2Properties.getInitRoleId(), userDetailByTokenInfo.get("given_name"));
}
LogManager.logInfo(LogConstants.AUTH_AUDIT, "用户 " + userDetailByTokenInfo.get("unique_name") + " : " + userDetailByTokenInfo.get("given_name") + " 登录。");
UserDetails userDetails = customizedUserDetailService.loadUserByUsername(userDetailByTokenInfo.get("unique_name"));
UsernamePasswordAuthenticationToken authentication =
new UsernamePasswordAuthenticationToken(userDetails, userDetails.getPassword(),userDetails.getAuthorities());
......
......@@ -2,5 +2,6 @@ package com.keymobile.login.logging;
public interface LogConstants {
public static final String CTX_API = "sso.API";
public static final String AUTH_AUDIT = "auth.AUDIT";
}
......@@ -32,5 +32,7 @@
<root level="INFO">
<appender-ref ref="stdout" />
</root>
</configuration>
\ No newline at end of file
<logger name="auth.AUDIT">
<appender-ref ref="logstash" />
</logger>
</configuration>
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment