in shardingsphere-elasticjob-cloud-ui/shardingsphere-elasticjob-cloud-ui-backend/src/main/java/org/apache/shardingsphere/elasticjob/cloud/ui/security/AuthenticationFilter.java [73:90]
private void handleLogin(final HttpServletRequest httpRequest, final HttpServletResponse httpResponse) {
try {
UserAccount user = objectMapper.readValue(httpRequest.getReader(), UserAccount.class);
AuthenticationResult authenticationResult = userAuthenticationService.checkUser(user);
if (!authenticationResult.isSuccess()) {
respondWithUnauthorized(httpResponse);
return;
}
httpResponse.setContentType("application/json");
httpResponse.setCharacterEncoding("UTF-8");
Map<String, Object> result = new HashMap<>(2, 1);
result.put("username", authenticationResult.getUsername());
result.put("accessToken", userAuthenticationService.getToken(authenticationResult.getUsername()));
objectMapper.writeValue(httpResponse.getWriter(), ResponseResultUtil.build(result));
} catch (IOException e) {
e.printStackTrace();
}
}