io.vertx.ext.auth.sqlclient

## Interface SqlUserUtil

-     public interface SqlUserUtil

  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 SqlUserUtil` | `create(SqlClient client)` Create an instance of the user helper.
    `static SqlUserUtil` | `create(SqlClient client, String insertUserSQL, String insertUserRoleSQL, String insertRolePermissionSQL)` Create an instance of the user helper with custom queries.
    `default Future<Void>` | `createHashedUser(String username, String hash)`
    `SqlUserUtil` | `createHashedUser(String username, String hash, Handler<AsyncResult<Void>> resultHandler)` Insert a user into a database.
    `default Future<Void>` | `createRolePermission(String role, String permission)`
    `SqlUserUtil` | `createRolePermission(String role, String permission, Handler<AsyncResult<Void>> resultHandler)` Insert a role permission into a database.
    `default Future<Void>` | `createUser(String username, String password)`
    `SqlUserUtil` | `createUser(String username, String password, Handler<AsyncResult<Void>> resultHandler)` Insert a user into a database.
    `default Future<Void>` | `createUserRole(String user, String role)`
    `SqlUserUtil` | `createUserRole(String username, String role, Handler<AsyncResult<Void>> resultHandler)` Insert a user role into a database.

- - ### Method Detail

    - #### create

          static SqlUserUtil create(SqlClient client)

      Create an instance of the user helper.
      Parameters:
        `client` - the client with write rights to the database.
      Returns:
        the instance

    - #### create

          static SqlUserUtil create(SqlClient client,
                                    String insertUserSQL,
                                    String insertUserRoleSQL,
                                    String insertRolePermissionSQL)

      Create an instance of the user helper with custom queries.
      Parameters:
        `client` - the client with write rights to the database.
      Returns:
        the instance

    - #### createUser

          SqlUserUtil createUser(String username,
                                 String password,
                                 Handler<AsyncResult<Void>> 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
      Returns:
        fluent self

    - #### createUser

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

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

    - #### createHashedUser

          SqlUserUtil createHashedUser(String username,
                                       String hash,
                                       Handler<AsyncResult<Void>> 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
      Returns:
        fluent self

    - #### createHashedUser

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

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

    - #### createUserRole

          SqlUserUtil createUserRole(String username,
                                     String role,
                                     Handler<AsyncResult<Void>> resultHandler)

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

    - #### createUserRole

          default Future<Void> createUserRole(String user,
                                              String role)

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

    - #### createRolePermission

          SqlUserUtil createRolePermission(String role,
                                           String permission,
                                           Handler<AsyncResult<Void>> resultHandler)

      Insert a role permission into a database.
      Parameters:
        `role` - a to be set
        `permission` - the permission to be set
        `resultHandler` - the ResultHandler will be provided with the result of the operation
      Returns:
        fluent self

    - #### createRolePermission

          default Future<Void> createRolePermission(String role,
                                                    String permission)

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

Copyright © 2021 Eclipse. All rights reserved.