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.
    `Future<Void>` | `createHashedUser(String username, String hash)`
    `default SqlUserUtil` | `createHashedUser(String username, String hash, Handler<AsyncResult<Void>> resultHandler)` Insert a user into a database.
    `Future<Void>` | `createRolePermission(String role, String permission)`
    `default SqlUserUtil` | `createRolePermission(String role, String permission, Handler<AsyncResult<Void>> resultHandler)` Insert a role permission into a database.
    `Future<Void>` | `createUser(String username, String password)`
    `default SqlUserUtil` | `createUser(String username, String password, Handler<AsyncResult<Void>> resultHandler)` Insert a user into a database.
    `Future<Void>` | `createUserRole(String user, String role)`
    `default 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

          default 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

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

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

    - #### createHashedUser

          default 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

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

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

    - #### createUserRole

          default 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

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

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

    - #### createRolePermission

          default 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

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

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

Copyright © 2022 Eclipse. All rights reserved.