@PutMapping
    @Secured(resource = AuthConstants.UPDATE_PASSWORD_ENTRY_POINT, action = ActionTypes.WRITE)
    public Object updateUser(@RequestParam String username, @RequestParam String newPassword,
            HttpServletResponse response, HttpServletRequest request) throws IOException {
        // admin or same user
        try {
            if (!hasPermission(username, request)) {
                response.sendError(HttpServletResponse.SC_FORBIDDEN, "authorization failed!");
                return null;
            }
        } catch (HttpSessionRequiredException e) {
            response.sendError(HttpServletResponse.SC_UNAUTHORIZED, "session expired!");
            return null;
        } catch (AccessException exception) {
            response.sendError(HttpServletResponse.SC_FORBIDDEN, "authorization failed!");
            return null;
        }
        
        User user = userDetailsService.getUserFromDatabase(username);
        if (user == null) {
            throw new IllegalArgumentException("user " + username + " not exist!");
        }
        
        userDetailsService.updateUserPassword(username, PasswordEncoderUtil.encode(newPassword));
        
        return RestResultUtils.success("update user ok!");
    }
@Test
    void testUpdateUser4() throws IOException {
        RequestContextHolder.getContext().getAuthContext().getIdentityContext()
                .setParameter(AuthConstants.NACOS_USER_KEY, user);
        when(authConfigs.isAuthEnabled()).thenReturn(true);
        when(userDetailsService.getUserFromDatabase(anyString())).thenReturn(new User());
        MockHttpServletRequest mockHttpServletRequest = new MockHttpServletRequest();
        MockHttpServletResponse mockHttpServletResponse = new MockHttpServletResponse();
        RestResult<String> result = (RestResult<String>) userController.updateUser("nacos", "test",
                mockHttpServletResponse, mockHttpServletRequest);
        assertEquals(200, result.getCode());
        
    }