@Override
    public Optional<DuoSecurityUserAccount> modifyDuoSecurityUserAccount(final DuoSecurityUserAccount newAccount) throws Exception {
        val userResponse = (JSONArray) executeAdminEndpoint(CollectionUtils.wrap("uri", "users", "username", newAccount.getUsername()));
        if (userResponse != null && userResponse.length() == 1) {
            val user = mapDuoSecurityUserAccount(userResponse.getJSONObject(0));
            val parameters = CollectionUtils.<String, String>wrap(
                "method", HttpMethod.POST.name(),
                "uri", "users/%s".formatted(user.getUserId()));
            FunctionUtils.doIfNotNull(newAccount.getEmail(), __ -> parameters.put("email", newAccount.getEmail()));
            FunctionUtils.doIfNotNull(newAccount.getFirstName(), __ -> parameters.put("firstname", newAccount.getFirstName()));
            FunctionUtils.doIfNotNull(newAccount.getLastName(), __ -> parameters.put("lastname", newAccount.getLastName()));
            FunctionUtils.doIfNotNull(newAccount.getStatus(), __ -> parameters.put("status", newAccount.getStatus().toValue()));
            val updateResponse = executeAdminEndpoint(parameters);
            val userAccount = (JSONObject) (updateResponse instanceof final JSONArray array ? array.get(0) : updateResponse);
            return Optional.of(mapDuoSecurityUserAccount(userAccount));
        }
        return Optional.empty();
    }
This is {@link DefaultDuoSecurityAdminApiService}.

@author Misagh Moayyed
@since 6.4.0
support/cas-server-support-duo-core/src/main/java/org/apereo/cas/adaptors/duo/authn/DefaultDuoSecurityAdminApiService.java