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