How to make request correctly?

Hi there. In one of my view classes, I have a method which updates a grid of some items. However, I’d like the grid to have different items updated depending on the role of the logged-in user.

        if (loggedUser.getAuthorities().contains(new SimpleGrantedAuthority(Roles.ADMIN.toString()))) {
            ResponseEntity<List<EntityResponseDTO>> response = ResponseUtils.getAllEntitiesRequest(loggedUser);
            this.grid.setItems(response.getBody());
        } else {
            this.grid.setItems(Collections.EMPTY_LIST);
        }
    }```

The `ResponseUtils.getAllEntitiesRequest(loggedUser);` is just a helper method for making a request to an endpoint using `RestTemplate` and its parameter is `loggeduser` of `UserDetails` class. Problem is that the endpoint is secured and can be accessed only when provided credentials of admin user. I have no clue how to set basic auth for the `RestTemplate` request.

I can't retrieve `HttpHeaders`; I don't want to explicitly use password in code... Could someone please help me? 🥲

Is this even the right pattern? Or should I avoid making such requests in Vaadin view class? If so, how else should I approach this problem?

I may use service to do so obviously, but I assume that the high-level approach is recommended?