All Downloads are FREE. Search and download functionalities are using the official Maven repository.

io.vertx.rxjava3.ext.auth.sqlclient.SqlUserUtil Maven / Gradle / Ivy

There is a newer version: 5.0.0.CR2
Show newest version
/*
 * Copyright 2014 Red Hat, Inc.
 *
 * Red Hat licenses this file to you under the Apache License, version 2.0
 * (the "License"); you may not use this file except in compliance with the
 * License.  You may obtain a copy of the License at:
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
 * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.  See the
 * License for the specific language governing permissions and limitations
 * under the License.
 */

package io.vertx.rxjava3.ext.auth.sqlclient;

import io.vertx.rxjava3.RxHelper;
import io.vertx.rxjava3.ObservableHelper;
import io.vertx.rxjava3.FlowableHelper;
import io.vertx.rxjava3.impl.AsyncResultMaybe;
import io.vertx.rxjava3.impl.AsyncResultSingle;
import io.vertx.rxjava3.impl.AsyncResultCompletable;
import io.vertx.rxjava3.WriteStreamObserver;
import io.vertx.rxjava3.WriteStreamSubscriber;
import java.util.Map;
import java.util.Set;
import java.util.List;
import java.util.Iterator;
import java.util.function.Function;
import java.util.stream.Collectors;
import io.vertx.core.Handler;
import io.vertx.core.AsyncResult;
import io.vertx.core.json.JsonObject;
import io.vertx.core.json.JsonArray;
import io.vertx.lang.rx.RxGen;
import io.vertx.lang.rx.TypeArg;
import io.vertx.lang.rx.MappingIterator;

/**
 * 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 {@link io.vertx.ext.auth.sqlclient.SqlUserUtil original} non RX-ified interface using Vert.x codegen. */ @RxGen(io.vertx.ext.auth.sqlclient.SqlUserUtil.class) public class SqlUserUtil { @Override public String toString() { return delegate.toString(); } @Override public boolean equals(Object o) { if (this == o) return true; if (o == null || getClass() != o.getClass()) return false; SqlUserUtil that = (SqlUserUtil) o; return delegate.equals(that.delegate); } @Override public int hashCode() { return delegate.hashCode(); } public static final TypeArg __TYPE_ARG = new TypeArg<>( obj -> new SqlUserUtil((io.vertx.ext.auth.sqlclient.SqlUserUtil) obj), SqlUserUtil::getDelegate ); private final io.vertx.ext.auth.sqlclient.SqlUserUtil delegate; public SqlUserUtil(io.vertx.ext.auth.sqlclient.SqlUserUtil delegate) { this.delegate = delegate; } public SqlUserUtil(Object delegate) { this.delegate = (io.vertx.ext.auth.sqlclient.SqlUserUtil)delegate; } public io.vertx.ext.auth.sqlclient.SqlUserUtil getDelegate() { return delegate; } /** * Create an instance of the user helper. * @param client the client with write rights to the database. * @return the instance */ public static io.vertx.rxjava3.ext.auth.sqlclient.SqlUserUtil create(io.vertx.rxjava3.sqlclient.SqlClient client) { io.vertx.rxjava3.ext.auth.sqlclient.SqlUserUtil ret = io.vertx.rxjava3.ext.auth.sqlclient.SqlUserUtil.newInstance((io.vertx.ext.auth.sqlclient.SqlUserUtil)io.vertx.ext.auth.sqlclient.SqlUserUtil.create(client.getDelegate())); return ret; } /** * Create an instance of the user helper with custom queries. * @param client the client with write rights to the database. * @param insertUserSQL * @param insertUserRoleSQL * @param insertRolePermissionSQL * @return the instance */ public static io.vertx.rxjava3.ext.auth.sqlclient.SqlUserUtil create(io.vertx.rxjava3.sqlclient.SqlClient client, java.lang.String insertUserSQL, java.lang.String insertUserRoleSQL, java.lang.String insertRolePermissionSQL) { io.vertx.rxjava3.ext.auth.sqlclient.SqlUserUtil ret = io.vertx.rxjava3.ext.auth.sqlclient.SqlUserUtil.newInstance((io.vertx.ext.auth.sqlclient.SqlUserUtil)io.vertx.ext.auth.sqlclient.SqlUserUtil.create(client.getDelegate(), insertUserSQL, insertUserRoleSQL, insertRolePermissionSQL)); return ret; } /** * Insert a user into a database. * @param username the username to be set * @param password the passsword in clear text, will be adapted following the definitions of the defined strategy * @return fluent self */ public io.reactivex.rxjava3.core.Completable createUser(java.lang.String username, java.lang.String password) { io.reactivex.rxjava3.core.Completable ret = rxCreateUser(username, password); ret = ret.cache(); ret.subscribe(io.vertx.rxjava3.CompletableHelper.nullObserver()); return ret; } /** * Insert a user into a database. * @param username the username to be set * @param password the passsword in clear text, will be adapted following the definitions of the defined strategy * @return fluent self */ public io.reactivex.rxjava3.core.Completable rxCreateUser(java.lang.String username, java.lang.String password) { return AsyncResultCompletable.toCompletable( resultHandler -> { delegate.createUser(username, password, resultHandler); }); } /** * Insert a user into a database. * @param username the username to be set * @param hash the password hash, as result of {@link io.vertx.rxjava3.ext.auth.HashingStrategy#hash} * @return fluent self */ public io.reactivex.rxjava3.core.Completable createHashedUser(java.lang.String username, java.lang.String hash) { io.reactivex.rxjava3.core.Completable ret = rxCreateHashedUser(username, hash); ret = ret.cache(); ret.subscribe(io.vertx.rxjava3.CompletableHelper.nullObserver()); return ret; } /** * Insert a user into a database. * @param username the username to be set * @param hash the password hash, as result of {@link io.vertx.rxjava3.ext.auth.HashingStrategy#hash} * @return fluent self */ public io.reactivex.rxjava3.core.Completable rxCreateHashedUser(java.lang.String username, java.lang.String hash) { return AsyncResultCompletable.toCompletable( resultHandler -> { delegate.createHashedUser(username, hash, resultHandler); }); } /** * Insert a user role into a database. * @param username the username to be set * @param role a to be set * @return fluent self */ public io.reactivex.rxjava3.core.Completable createUserRole(java.lang.String username, java.lang.String role) { io.reactivex.rxjava3.core.Completable ret = rxCreateUserRole(username, role); ret = ret.cache(); ret.subscribe(io.vertx.rxjava3.CompletableHelper.nullObserver()); return ret; } /** * Insert a user role into a database. * @param username the username to be set * @param role a to be set * @return fluent self */ public io.reactivex.rxjava3.core.Completable rxCreateUserRole(java.lang.String username, java.lang.String role) { return AsyncResultCompletable.toCompletable( resultHandler -> { delegate.createUserRole(username, role, resultHandler); }); } /** * Insert a role permission into a database. * @param role a to be set * @param permission the permission to be set * @return fluent self */ public io.reactivex.rxjava3.core.Completable createRolePermission(java.lang.String role, java.lang.String permission) { io.reactivex.rxjava3.core.Completable ret = rxCreateRolePermission(role, permission); ret = ret.cache(); ret.subscribe(io.vertx.rxjava3.CompletableHelper.nullObserver()); return ret; } /** * Insert a role permission into a database. * @param role a to be set * @param permission the permission to be set * @return fluent self */ public io.reactivex.rxjava3.core.Completable rxCreateRolePermission(java.lang.String role, java.lang.String permission) { return AsyncResultCompletable.toCompletable( resultHandler -> { delegate.createRolePermission(role, permission, resultHandler); }); } public static SqlUserUtil newInstance(io.vertx.ext.auth.sqlclient.SqlUserUtil arg) { return arg != null ? new SqlUserUtil(arg) : null; } }





© 2015 - 2024 Weber Informatics LLC | Privacy Policy