Reputation: 8932
I m actually creating my first little Spring application, a Rest webservice and I m facing a problem.
In fact, I have a ressource at /users and I dont want people to get the password.
My User object contains a password field.
So what can I do to bypass this ? Can I hide the field ? Can I do something better to manage this ?
Thanks for advance
Upvotes: 0
Views: 59
Reputation: 34826
Assuming that you are returning JSON from your webservice you could mark the password field/getter with @JsonIgnore
annotation, that way it wouldn't be included in the JSON returned by your controller.
If you are returning XML and your object is annotated with JAXB annotations, you can use @XmlTransient
annotation to achieve the same result.
Upvotes: 2