Class UserSelection

java.lang.Object
org.springframework.data.neo4j.core.UserSelection

@API(status=STABLE, since="6.2") public final class UserSelection extends Object
This is a value object for a Neo4j user, potentially different from the user owning the physical Neo4j connection. To make use of this a minimum version of Neo4j 4.4 and Neo4j-Java-Driver 4.4 is required, otherwise any usage of impersonate(String) together with either the UserSelectionProvider or the ReactiveUserSelectionProvider will lead to runtime errors.

Similar usage pattern like with the dynamic database selection are possible, for example tying a UserSelectionProvider into Spring Security and use the current user as a user to impersonate.

Since:
6.2
Author:
Michael J. Simons
  • Method Details

    • connectedUser

      public static UserSelection connectedUser()
      Returns:
      A user selection that will just use the user owning the physical connection.
    • impersonate

      public static UserSelection impersonate(String value)
      Parameters:
      value - The name of the user to impersonate
      Returns:
      A user selection representing an impersonated user.
    • getValue

      @Nullable public String getValue()
    • equals

      public boolean equals(Object o)
      Overrides:
      equals in class Object
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class Object