I have a class named Order shown below.
class Order{
private int id;
private String name;
private String amount;
//getters and setters
}
Using Spring security, I need to be able to control the data that is being returned as a response from Spring Controller. For say, Admin can view all the data of Order, but customer can see only name and amount. How can I filter the JSON data with Spring Security.So, final output for admin should be
[{id:1,name:order1,amount:100}, {id:2,name:order2,amount:200}]
and output for customer should be
[{name:order1,amount:100}, {name:order2,amount:200}].
Is there any way to do this