Files
spring-data-examples/mongodb/security
Oliver Gierke 9a5c270ec2 #139 - Switched to embedded MongoDB for integration tests.
Removed MongoDB dependency by adding Flapdoodle embedded MongoDB. That allows us to get rid of the utility module we had in place for the MongoDB samples guarding the tests to only run when a MongoDB instance is running.

Tweaked Travis setup to not require the MongoDB service anymore.
2015-10-29 17:14:38 +01:00
..
2015-07-16 08:24:43 +02:00

= Spring Data MongoDB - Spring Security integration.

This project contains samples of the Spring Security integration in Spring Data (MongoDB).

== Support for SpEL expression based filtering

[source, java]
----
public interface PersonRepository extends CrudRepository<Person, String> {

  @Override
  List<Person> findAll();

  // Custom query method with filtering based on Spring Security context information
  @Query("{id: ?#{ hasRole('ROLE_ADMIN') ? {$exists:true} : principal.id}}")
  List<Person> findAllForCurrentUserById();
}
----