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 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

        Future<Void> createUser​(String username,
                                String password)
        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
        Returns:
        a future notified with the result of the operation
      • createHashedUser

        Future<Void> createHashedUser​(String username,
                                      String hash)
        Insert a user into a database.
        Parameters:
        username - the username to be set
        hash - the password hash, as result of io.vertx.ext.auth.HashingStrategy#hash(String, Map, String, String)
        Returns:
        a future notified with the result of the operation
      • createUserRole

        Future<Void> createUserRole​(String username,
                                    String role)
        Insert a user role into a database.
        Parameters:
        username - the username to be set
        role - a to be set
        Returns:
        a future notified with the result of the operation
      • createRolePermission

        Future<Void> createRolePermission​(String role,
                                          String permission)
        Insert a role permission into a database.
        Parameters:
        role - a to be set
        permission - the permission to be set
        Returns:
        a future notified with the result of the operation