io.vertx.ext.auth.mongo

## Interface MongoUserUtil

-     public interface MongoUserUtil

  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.

- - ### Method Summary

    All Methods Static Methods Instance Methods Abstract Methods Default Methods
    Modifier and Type | Method and Description
    --- | ---
    `static MongoUserUtil` | `create(MongoClient client)` Create an instance of the user helper.
    `static MongoUserUtil` | `create(MongoClient client, MongoAuthenticationOptions authenticationOptions, MongoAuthorizationOptions authorizationOptions)` Create an instance of the user helper with custom queries.
    `default Future<String>` | `createHashedUser(String username, String hash)`
    `MongoUserUtil` | `createHashedUser(String username, String hash, Handler<AsyncResult<String>> resultHandler)` Insert a user into a database.
    `default Future<String>` | `createUser(String username, String password)`
    `MongoUserUtil` | `createUser(String username, String password, Handler<AsyncResult<String>> resultHandler)` Insert a user into a database.
    `default Future<String>` | `createUserRolesAndPermissions(String user, List<String> roles, List<String> permissions)`
    `MongoUserUtil` | `createUserRolesAndPermissions(String username, List<String> roles, List<String> permissions, Handler<AsyncResult<String>> resultHandler)` Insert a user role into a database.

- - ### Method Detail

    - #### create

          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

          static MongoUserUtil create(MongoClient client,
                                      MongoAuthenticationOptions authenticationOptions,
                                      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

    - #### createUser

          MongoUserUtil createUser(String username,
                                   String password,
                                   Handler<AsyncResult<String>> resultHandler)

      Insert a user into a database.
      Parameters:
        `username` - the username to be set
        `password` - the passsword in clear text, will be adapted following the definitions of the defined strategy
        `resultHandler` - the ResultHandler will be provided with the result of the operation and the created user document identifier
      Returns:
        fluent self

    - #### createUser

          default Future<String> createUser(String username,
                                            String password)

      See Also:
        `createUser(String, String, Handler).`

    - #### createHashedUser

          MongoUserUtil createHashedUser(String username,
                                         String hash,
                                         Handler<AsyncResult<String>> resultHandler)

      Insert a user into a database.
      Parameters:
        `username` - the username to be set
        `hash` - the password hash, as result of `HashingStrategy.hash(String, Map, String, String)`
        `resultHandler` - the ResultHandler will be provided with the result of the operation and the created user document identifier
      Returns:
        fluent self

    - #### createHashedUser

          default Future<String> createHashedUser(String username,
                                                  String hash)

      See Also:
        `createHashedUser(String, String, Handler).`

    - #### createUserRolesAndPermissions

          MongoUserUtil createUserRolesAndPermissions(String username,
                                                      List<String> roles,
                                                      List<String> permissions,
                                                      Handler<AsyncResult<String>> resultHandler)

      Insert a user role into a database.
      Parameters:
        `username` - the username to be set
        `roles` - a to be set
        `permissions` - a to be set
        `resultHandler` - the ResultHandler will be provided with the result of the operation and the created user document identifier
      Returns:
        fluent self

    - #### createUserRolesAndPermissions

          default Future<String> createUserRolesAndPermissions(String user,
                                                               List<String> roles,
                                                               List<String> permissions)

      See Also:
        `createUserRolesAndPermissions(String, List, List, Handler).`

Copyright © 2021 Eclipse. All rights reserved.