Class MongoUserUtil

java.lang.Object
io.vertx.mutiny.ext.auth.mongo.MongoUserUtil
All Implemented Interfaces:
MutinyDelegate

public class MongoUserUtil extends Object implements MutinyDelegate
Utility to create users/roles/permissions. This is a helper class and not intended to be a full user management utility. While the standard authentication and authorization interfaces will require usually read only access to the database, in order to use this API a full read/write access must be granted.

NOTE: This class has been automatically generated from the original non Mutiny-ified interface.

See Also:
  • MongoUserUtil
  • Field Details

  • Constructor Details

    • MongoUserUtil

      public MongoUserUtil(io.vertx.ext.auth.mongo.MongoUserUtil delegate)
      Create a new instance of MongoUserUtil delegating to the given (non-null) instance of MongoUserUtil.
    • MongoUserUtil

      public MongoUserUtil(Object delegate)
  • Method Details

    • getDelegate

      public io.vertx.ext.auth.mongo.MongoUserUtil getDelegate()
      Get the delegate instance.

      This method returns the instance on which this shim is delegating the calls. And so, give you access to the bare API.

      Specified by:
      getDelegate in interface MutinyDelegate
      Returns:
      the delegate instance
    • createUser

      @CheckReturnValue public io.smallrye.mutiny.Uni<String> createUser(String username, String password)
      Insert a user into a database.

      Unlike the bare Vert.x variant, this method returns a Uni. The uni emits the result of the operation as item. If the operation fails, the uni emits the failure.

      Don't forget to subscribe on it to trigger the operation.

      Parameters:
      username - the username to be set
      password - the password in clear text, will be adapted following the definitions of the defined strategy
      Returns:
      A Uni representing the asynchronous result of this operation.
      See Also:
      • MongoUserUtil.createUser(String, String)
    • createUserAndAwait

      public String createUserAndAwait(String username, String password)
      Insert a user into a database.

      Unlike the bare Vert.x variant, this method returns a String. This method awaits indefinitely for the completion of the underlying asynchronous operation. If the operation completes successfully, the result is returned, otherwise the failure is thrown (potentially wrapped in a RuntimeException).

      Parameters:
      username - the username to be set
      password - the password in clear text, will be adapted following the definitions of the defined strategy
      Returns:
      The operation result
      See Also:
      • MongoUserUtil.createUser(String, String)
    • createUserAndForget

      public MongoUserUtil createUserAndForget(String username, String password)
      Insert a user into a database.

      Unlike the bare Vert.x variant, this method ignores the String result or any failure.

      Parameters:
      username - the username to be set
      password - the password in clear text, will be adapted following the definitions of the defined strategy
      Returns:
      The current instance to chain operations if needed.
      See Also:
      • MongoUserUtil.createUser(String, String)
    • createHashedUser

      @CheckReturnValue public io.smallrye.mutiny.Uni<String> createHashedUser(String username, String hash)
      Insert a user into a database.

      Unlike the bare Vert.x variant, this method returns a Uni. The uni emits the result of the operation as item. If the operation fails, the uni emits the failure.

      Don't forget to subscribe on it to trigger the operation.

      Parameters:
      username - the username to be set
      hash - the password hash, as result of HashingStrategy.hash(String, Map, String, String)
      Returns:
      A Uni representing the asynchronous result of this operation.
      See Also:
      • MongoUserUtil.createHashedUser(String, String)
    • createHashedUserAndAwait

      public String createHashedUserAndAwait(String username, String hash)
      Insert a user into a database.

      Unlike the bare Vert.x variant, this method returns a String. This method awaits indefinitely for the completion of the underlying asynchronous operation. If the operation completes successfully, the result is returned, otherwise the failure is thrown (potentially wrapped in a RuntimeException).

      Parameters:
      username - the username to be set
      hash - the password hash, as result of HashingStrategy.hash(String, Map, String, String)
      Returns:
      The operation result
      See Also:
      • MongoUserUtil.createHashedUser(String, String)
    • createHashedUserAndForget

      public MongoUserUtil createHashedUserAndForget(String username, String hash)
      Insert a user into a database.

      Unlike the bare Vert.x variant, this method ignores the String result or any failure.

      Parameters:
      username - the username to be set
      hash - the password hash, as result of HashingStrategy.hash(String, Map, String, String)
      Returns:
      The current instance to chain operations if needed.
      See Also:
      • MongoUserUtil.createHashedUser(String, String)
    • createUserRolesAndPermissions

      @CheckReturnValue public io.smallrye.mutiny.Uni<String> createUserRolesAndPermissions(String user, List<String> roles, List<String> permissions)
      Insert a user role into a database.

      Unlike the bare Vert.x variant, this method returns a Uni. The uni emits the result of the operation as item. If the operation fails, the uni emits the failure.

      Don't forget to subscribe on it to trigger the operation.

      Parameters:
      user - the username to be set
      roles - a to be set
      permissions - a to be set
      Returns:
      A Uni representing the asynchronous result of this operation.
      See Also:
      • MongoUserUtil.createUserRolesAndPermissions(String, List, List)
    • createUserRolesAndPermissionsAndAwait

      public String createUserRolesAndPermissionsAndAwait(String user, List<String> roles, List<String> permissions)
      Insert a user role into a database.

      Unlike the bare Vert.x variant, this method returns a String. This method awaits indefinitely for the completion of the underlying asynchronous operation. If the operation completes successfully, the result is returned, otherwise the failure is thrown (potentially wrapped in a RuntimeException).

      Parameters:
      user - the username to be set
      roles - a to be set
      permissions - a to be set
      Returns:
      The operation result
      See Also:
      • MongoUserUtil.createUserRolesAndPermissions(String, List, List)
    • createUserRolesAndPermissionsAndForget

      public MongoUserUtil createUserRolesAndPermissionsAndForget(String user, List<String> roles, List<String> permissions)
      Insert a user role into a database.

      Unlike the bare Vert.x variant, this method ignores the String result or any failure.

      Parameters:
      user - the username to be set
      roles - a to be set
      permissions - a to be set
      Returns:
      The current instance to chain operations if needed.
      See Also:
      • MongoUserUtil.createUserRolesAndPermissions(String, List, List)
    • create

      public static MongoUserUtil create(MongoClient client)
      Create an instance of the user helper.
      Parameters:
      client - the client with write rights to the database.
      Returns:
      the instance
    • create

      public static MongoUserUtil create(MongoClient client, io.vertx.ext.auth.mongo.MongoAuthenticationOptions authenticationOptions, io.vertx.ext.auth.mongo.MongoAuthorizationOptions authorizationOptions)
      Create an instance of the user helper with custom queries.
      Parameters:
      client - the client with write rights to the database.
      Returns:
      the instance
    • newInstance

      public static MongoUserUtil newInstance(io.vertx.ext.auth.mongo.MongoUserUtil delegate)
      Creates a new instance of the MongoUserUtil.
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class Object
    • equals

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

      public String toString()
      Overrides:
      toString in class Object