README.adoc 1.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253
  1. = Spring Data Sample
  2. After running this sample like so:
  3. .Java
  4. [source,java,role="primary"]
  5. ----
  6. ./gradlew :bootRun
  7. ----
  8. Then you can query for messages using `luke/password` and `rob/password`.
  9. Because the domain objects are secured, you will see a subset of fields with `luke`.
  10. For example, querying `/` with `luke`, you'll see:
  11. ```json
  12. ...
  13. {
  14. "created": "2014-07-12T16:00:00Z",
  15. "id": 112,
  16. "summary": "Is this secure?",
  17. "text": "This message is for Luke",
  18. "to": {
  19. "email": "luke@example.com",
  20. "id": "luke",
  21. "password": "password"
  22. }
  23. }
  24. ...
  25. ```
  26. However, with `rob`, you'll also see `firstName` and `lastName` like so:
  27. ```json
  28. ...
  29. {
  30. "created": "2014-07-12T04:00:00Z",
  31. "id": 102,
  32. "summary": "Is this secure?",
  33. "text": "This message is for Rob",
  34. "to": {
  35. "email": "rob@example.com",
  36. "firstName": "Rob",
  37. "id": "rob",
  38. "lastName": "Winch",
  39. "password": "password"
  40. }
  41. }
  42. ...
  43. ```
  44. Read more about the https://docs.spring.io/spring-security/reference/servlet/authorization/method-security.html#authorize-object[`@AuthorizeReturnObject`] and https://docs.spring.io/spring-security/reference/servlet/authorization/method-security.html#fallback-values-authorization-denied[]`@DeniedHandler`] in the Spring Security Reference.