io.vertx.rxjava3.ext.auth.mongo.MongoAuth Maven / Gradle / Ivy
/*
* 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.mongo;
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;
/**
* An extension of AuthProvider which is using as store
*
*
* NOTE: This class has been automatically generated from the {@link io.vertx.ext.auth.mongo.MongoAuth original} non RX-ified interface using Vert.x codegen.
*/
@RxGen(io.vertx.ext.auth.mongo.MongoAuth.class)
public class MongoAuth extends io.vertx.rxjava3.ext.auth.AuthProvider {
@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;
MongoAuth that = (MongoAuth) o;
return delegate.equals(that.delegate);
}
@Override
public int hashCode() {
return delegate.hashCode();
}
public static final TypeArg __TYPE_ARG = new TypeArg<>( obj -> new MongoAuth((io.vertx.ext.auth.mongo.MongoAuth) obj),
MongoAuth::getDelegate
);
private final io.vertx.ext.auth.mongo.MongoAuth delegate;
public MongoAuth(io.vertx.ext.auth.mongo.MongoAuth delegate) {
super(delegate);
this.delegate = delegate;
}
public MongoAuth(Object delegate) {
super((io.vertx.ext.auth.mongo.MongoAuth)delegate);
this.delegate = (io.vertx.ext.auth.mongo.MongoAuth)delegate;
}
public io.vertx.ext.auth.mongo.MongoAuth getDelegate() {
return delegate;
}
/**
* Creates an instance of MongoAuth by using the given and configuration object. An example for a
* configuration object:
*
*
* JsonObject js = new JsonObject();
* js.put(MongoAuth.PROPERTY_COLLECTION_NAME, createCollectionName(MongoAuth.DEFAULT_COLLECTION_NAME));
*
* @param mongoClient an instance of to be used for data storage and retrival
* @param config the configuration object for the current instance. By this
* @return the created instance of {@link io.vertx.rxjava3.ext.auth.mongo.MongoAuth}s
*/
@Deprecated()
public static io.vertx.rxjava3.ext.auth.mongo.MongoAuth create(io.vertx.rxjava3.ext.mongo.MongoClient mongoClient, io.vertx.core.json.JsonObject config) {
io.vertx.rxjava3.ext.auth.mongo.MongoAuth ret = io.vertx.rxjava3.ext.auth.mongo.MongoAuth.newInstance((io.vertx.ext.auth.mongo.MongoAuth)io.vertx.ext.auth.mongo.MongoAuth.create(mongoClient.getDelegate(), config));
return ret;
}
/**
* Set the name of the collection to be used. Defaults to {@link io.vertx.rxjava3.ext.auth.mongo.MongoAuth}
* @param collectionName the name of the collection to be used for storing and reading user data
* @return the current instance itself for fluent calls
*/
@Deprecated()
public io.vertx.rxjava3.ext.auth.mongo.MongoAuth setCollectionName(java.lang.String collectionName) {
delegate.setCollectionName(collectionName);
return this;
}
/**
* Set the name of the field to be used for the username. Defaults to {@link io.vertx.rxjava3.ext.auth.mongo.MongoAuth}
* @param fieldName the name of the field to be used
* @return the current instance itself for fluent calls
*/
@Deprecated()
public io.vertx.rxjava3.ext.auth.mongo.MongoAuth setUsernameField(java.lang.String fieldName) {
delegate.setUsernameField(fieldName);
return this;
}
/**
* Set the name of the field to be used for the password Defaults to {@link io.vertx.rxjava3.ext.auth.mongo.MongoAuth}
* @param fieldName the name of the field to be used
* @return the current instance itself for fluent calls
*/
@Deprecated()
public io.vertx.rxjava3.ext.auth.mongo.MongoAuth setPasswordField(java.lang.String fieldName) {
delegate.setPasswordField(fieldName);
return this;
}
/**
* Set the name of the field to be used for the roles. Defaults to {@link io.vertx.rxjava3.ext.auth.mongo.MongoAuth}. Roles are expected to
* be saved as JsonArray
* @param fieldName the name of the field to be used
* @return the current instance itself for fluent calls
*/
@Deprecated()
public io.vertx.rxjava3.ext.auth.mongo.MongoAuth setRoleField(java.lang.String fieldName) {
delegate.setRoleField(fieldName);
return this;
}
/**
* Set the name of the field to be used for the permissions. Defaults to {@link io.vertx.rxjava3.ext.auth.mongo.MongoAuth}.
* Permissions are expected to be saved as JsonArray
* @param fieldName the name of the field to be used
* @return the current instance itself for fluent calls
*/
@Deprecated()
public io.vertx.rxjava3.ext.auth.mongo.MongoAuth setPermissionField(java.lang.String fieldName) {
delegate.setPermissionField(fieldName);
return this;
}
/**
* Set the name of the field to be used as property for the username in the method
* {@link io.vertx.rxjava3.ext.auth.authentication.AuthenticationProvider#authenticate}. Defaults to {@link io.vertx.rxjava3.ext.auth.mongo.MongoAuth}
* @param fieldName the name of the field to be used
* @return the current instance itself for fluent calls
*/
@Deprecated()
public io.vertx.rxjava3.ext.auth.mongo.MongoAuth setUsernameCredentialField(java.lang.String fieldName) {
delegate.setUsernameCredentialField(fieldName);
return this;
}
/**
* Set the name of the field to be used as property for the password of credentials in the method
* {@link io.vertx.rxjava3.ext.auth.authentication.AuthenticationProvider#authenticate}. Defaults to {@link io.vertx.rxjava3.ext.auth.mongo.MongoAuth}
* @param fieldName the name of the field to be used
* @return the current instance itself for fluent calls
*/
@Deprecated()
public io.vertx.rxjava3.ext.auth.mongo.MongoAuth setPasswordCredentialField(java.lang.String fieldName) {
delegate.setPasswordCredentialField(fieldName);
return this;
}
/**
* Set the name of the field to be used for the salt. Only used when {@link io.vertx.rxjava3.ext.auth.mongo.HashStrategy#setSaltStyle} is
* set to
* @param fieldName the name of the field to be used
* @return the current instance itself for fluent calls
*/
@Deprecated()
public io.vertx.rxjava3.ext.auth.mongo.MongoAuth setSaltField(java.lang.String fieldName) {
delegate.setSaltField(fieldName);
return this;
}
/**
* The name of the collection used to store User objects inside. Defaults to {@link io.vertx.rxjava3.ext.auth.mongo.MongoAuth}
* @return the collectionName
*/
@Deprecated()
public java.lang.String getCollectionName() {
java.lang.String ret = delegate.getCollectionName();
return ret;
}
/**
* Get the name of the field to be used for the username. Defaults to {@link io.vertx.rxjava3.ext.auth.mongo.MongoAuth}
* @return the usernameField
*/
@Deprecated()
public java.lang.String getUsernameField() {
java.lang.String ret = delegate.getUsernameField();
return ret;
}
/**
* Get the name of the field to be used for the password Defaults to {@link io.vertx.rxjava3.ext.auth.mongo.MongoAuth}
* @return the passwordField
*/
@Deprecated()
public java.lang.String getPasswordField() {
java.lang.String ret = delegate.getPasswordField();
return ret;
}
/**
* Get the name of the field to be used for the roles. Defaults to {@link io.vertx.rxjava3.ext.auth.mongo.MongoAuth}. Roles are expected to
* be saved as JsonArray
* @return the roleField
*/
@Deprecated()
public java.lang.String getRoleField() {
java.lang.String ret = delegate.getRoleField();
return ret;
}
/**
* Get the name of the field to be used for the permissions. Defaults to {@link io.vertx.rxjava3.ext.auth.mongo.MongoAuth}.
* Permissions are expected to be saved as JsonArray
* @return the permissionField
*/
@Deprecated()
public java.lang.String getPermissionField() {
java.lang.String ret = delegate.getPermissionField();
return ret;
}
/**
* Get the name of the field to be used as property for the username in the method
* {@link io.vertx.rxjava3.ext.auth.authentication.AuthenticationProvider#authenticate}. Defaults to {@link io.vertx.rxjava3.ext.auth.mongo.MongoAuth}
* @return the usernameCredentialField
*/
@Deprecated()
public java.lang.String getUsernameCredentialField() {
java.lang.String ret = delegate.getUsernameCredentialField();
return ret;
}
/**
* Get the name of the field to be used as property for the password of credentials in the method
* {@link io.vertx.rxjava3.ext.auth.authentication.AuthenticationProvider#authenticate}. Defaults to {@link io.vertx.rxjava3.ext.auth.mongo.MongoAuth}
* @return the passwordCredentialField
*/
@Deprecated()
public java.lang.String getPasswordCredentialField() {
java.lang.String ret = delegate.getPasswordCredentialField();
return ret;
}
/**
* Get the name of the field to be used for the salt. Only used when {@link io.vertx.rxjava3.ext.auth.mongo.HashStrategy#setSaltStyle} is
* set to
* @return the saltField
*/
@Deprecated()
public java.lang.String getSaltField() {
java.lang.String ret = delegate.getSaltField();
return ret;
}
/**
* The HashStrategy which is used by the current instance
* @param hashStrategy the {@link io.vertx.rxjava3.ext.auth.mongo.HashStrategy} to be set
* @return the current instance itself for fluent calls
*/
@Deprecated()
public io.vertx.rxjava3.ext.auth.mongo.MongoAuth setHashStrategy(io.vertx.rxjava3.ext.auth.mongo.HashStrategy hashStrategy) {
delegate.setHashStrategy(hashStrategy.getDelegate());
return this;
}
/**
* The HashStrategy which is used by the current instance
* @return the defined instance of {@link io.vertx.rxjava3.ext.auth.mongo.HashStrategy}
*/
@Deprecated()
public io.vertx.rxjava3.ext.auth.mongo.HashStrategy getHashStrategy() {
io.vertx.rxjava3.ext.auth.mongo.HashStrategy ret = io.vertx.rxjava3.ext.auth.mongo.HashStrategy.newInstance((io.vertx.ext.auth.mongo.HashStrategy)delegate.getHashStrategy());
return ret;
}
/**
* The Hash Algorithm which is used by the current instance
* @param hashAlgorithm the {@link io.vertx.ext.auth.mongo.HashAlgorithm} to be set
* @return the current instance itself for fluent calls
*/
@Deprecated()
public io.vertx.rxjava3.ext.auth.mongo.MongoAuth setHashAlgorithm(io.vertx.ext.auth.mongo.HashAlgorithm hashAlgorithm) {
delegate.setHashAlgorithm(hashAlgorithm);
return this;
}
/**
* @param username the username to be set
* @param password the passsword in clear text, will be adapted following the definitions of the defined {@link io.vertx.rxjava3.ext.auth.mongo.HashStrategy}
* @param roles a list of roles to be set
* @param permissions a list of permissions to be set
* @return
*/
@Deprecated()
public io.reactivex.rxjava3.core.Single insertUser(java.lang.String username, java.lang.String password, java.util.List roles, java.util.List permissions) {
io.reactivex.rxjava3.core.Single ret = rxInsertUser(username, password, roles, permissions);
ret = ret.cache();
ret.subscribe(io.vertx.rxjava3.SingleHelper.nullObserver());
return ret;
}
/**
* @param username the username to be set
* @param password the passsword in clear text, will be adapted following the definitions of the defined {@link io.vertx.rxjava3.ext.auth.mongo.HashStrategy}
* @param roles a list of roles to be set
* @param permissions a list of permissions to be set
* @return
*/
@Deprecated()
public io.reactivex.rxjava3.core.Single rxInsertUser(java.lang.String username, java.lang.String password, java.util.List roles, java.util.List permissions) {
return AsyncResultSingle.toSingle( resultHandler -> {
delegate.insertUser(username, password, roles, permissions, resultHandler);
});
}
/**
* The property name to be used to set the name of the collection inside the config
*/
public static final java.lang.String PROPERTY_COLLECTION_NAME = io.vertx.ext.auth.mongo.MongoAuth.PROPERTY_COLLECTION_NAME;
/**
* The property name to be used to set the name of the field, where the username is stored inside
*/
public static final java.lang.String PROPERTY_USERNAME_FIELD = io.vertx.ext.auth.mongo.MongoAuth.PROPERTY_USERNAME_FIELD;
/**
* The property name to be used to set the name of the field, where the roles are stored inside
*/
public static final java.lang.String PROPERTY_ROLE_FIELD = io.vertx.ext.auth.mongo.MongoAuth.PROPERTY_ROLE_FIELD;
/**
* The property name to be used to set the name of the field, where the permissions are stored inside
*/
public static final java.lang.String PROPERTY_PERMISSION_FIELD = io.vertx.ext.auth.mongo.MongoAuth.PROPERTY_PERMISSION_FIELD;
/**
* The property name to be used to set the name of the field, where the password is stored inside
*/
public static final java.lang.String PROPERTY_PASSWORD_FIELD = io.vertx.ext.auth.mongo.MongoAuth.PROPERTY_PASSWORD_FIELD;
/**
* The property name to be used to set the name of the field, where the username for the credentials is stored inside
*/
public static final java.lang.String PROPERTY_CREDENTIAL_USERNAME_FIELD = io.vertx.ext.auth.mongo.MongoAuth.PROPERTY_CREDENTIAL_USERNAME_FIELD;
/**
* The property name to be used to set the name of the field, where the password for the credentials is stored inside
*/
public static final java.lang.String PROPERTY_CREDENTIAL_PASSWORD_FIELD = io.vertx.ext.auth.mongo.MongoAuth.PROPERTY_CREDENTIAL_PASSWORD_FIELD;
/**
* The property name to be used to set the name of the field, where the SALT is stored inside
*/
public static final java.lang.String PROPERTY_SALT_FIELD = io.vertx.ext.auth.mongo.MongoAuth.PROPERTY_SALT_FIELD;
/**
* The property name to be used to set the name of the field, where the salt style is stored inside
*/
public static final java.lang.String PROPERTY_SALT_STYLE = io.vertx.ext.auth.mongo.MongoAuth.PROPERTY_SALT_STYLE;
/**
* The default name of the collection to be used
*/
public static final java.lang.String DEFAULT_COLLECTION_NAME = io.vertx.ext.auth.mongo.MongoAuth.DEFAULT_COLLECTION_NAME;
/**
* The default name of the property for the username, like it is stored in mongodb
*/
public static final java.lang.String DEFAULT_USERNAME_FIELD = io.vertx.ext.auth.mongo.MongoAuth.DEFAULT_USERNAME_FIELD;
/**
* The default name of the property for the password, like it is stored in mongodb
*/
public static final java.lang.String DEFAULT_PASSWORD_FIELD = io.vertx.ext.auth.mongo.MongoAuth.DEFAULT_PASSWORD_FIELD;
/**
* The default name of the property for the roles, like it is stored in mongodb. Roles are expected to be saved as
* JsonArray
*/
public static final java.lang.String DEFAULT_ROLE_FIELD = io.vertx.ext.auth.mongo.MongoAuth.DEFAULT_ROLE_FIELD;
/**
* The default name of the property for the permissions, like it is stored in mongodb. Permissions are expected to be
* saved as JsonArray
*/
public static final java.lang.String DEFAULT_PERMISSION_FIELD = io.vertx.ext.auth.mongo.MongoAuth.DEFAULT_PERMISSION_FIELD;
/**
* The default name of the property for the username, like it is transported in credentials by method
* {@link io.vertx.rxjava3.ext.auth.authentication.AuthenticationProvider#authenticate}
*/
public static final java.lang.String DEFAULT_CREDENTIAL_USERNAME_FIELD = io.vertx.ext.auth.mongo.MongoAuth.DEFAULT_CREDENTIAL_USERNAME_FIELD;
/**
* The default name of the property for the password, like it is transported in credentials by method
* {@link io.vertx.rxjava3.ext.auth.authentication.AuthenticationProvider#authenticate}
*/
public static final java.lang.String DEFAULT_CREDENTIAL_PASSWORD_FIELD = io.vertx.ext.auth.mongo.MongoAuth.DEFAULT_CREDENTIAL_PASSWORD_FIELD;
/**
* The default name of the property for the salt field
*/
public static final java.lang.String DEFAULT_SALT_FIELD = io.vertx.ext.auth.mongo.MongoAuth.DEFAULT_SALT_FIELD;
/**
* The prefix which is used by the method when checking for role access
*/
public static final java.lang.String ROLE_PREFIX = io.vertx.ext.auth.mongo.MongoAuth.ROLE_PREFIX;
public static MongoAuth newInstance(io.vertx.ext.auth.mongo.MongoAuth arg) {
return arg != null ? new MongoAuth(arg) : null;
}
}
© 2015 - 2024 Weber Informatics LLC | Privacy Policy