io.vertx.reactivex.ext.auth.mongo

## Class MongoAuth

- java.lang.Object
- - io.vertx.reactivex.ext.auth.AuthProvider
  - - io.vertx.reactivex.ext.auth.mongo.MongoAuth

-     public class MongoAuth
      extends AuthProvider

  An extension of AuthProvider which is using as store

  NOTE: This class has been automatically generated from the `original` non RX-ified interface using Vert.x codegen.

- - ### Field Summary

    Fields
    Modifier and Type | Field and Description
    --- | ---
    `static io.vertx.lang.rx.TypeArg<MongoAuth>` | `__TYPE_ARG`
    `static String` | `DEFAULT_COLLECTION_NAME` The default name of the collection to be used
    `static String` | `DEFAULT_CREDENTIAL_PASSWORD_FIELD` The default name of the property for the password, like it is transported in credentials by method `AuthProvider.authenticate(io.vertx.core.json.JsonObject, io.vertx.core.Handler<io.vertx.core.AsyncResult<io.vertx.reactivex.ext.auth.User>>)`
    `static String` | `DEFAULT_CREDENTIAL_USERNAME_FIELD` The default name of the property for the username, like it is transported in credentials by method `AuthProvider.authenticate(io.vertx.core.json.JsonObject, io.vertx.core.Handler<io.vertx.core.AsyncResult<io.vertx.reactivex.ext.auth.User>>)`
    `static String` | `DEFAULT_PASSWORD_FIELD` The default name of the property for the password, like it is stored in mongodb
    `static String` | `DEFAULT_PERMISSION_FIELD` The default name of the property for the permissions, like it is stored in mongodb.
    `static String` | `DEFAULT_ROLE_FIELD` The default name of the property for the roles, like it is stored in mongodb.
    `static String` | `DEFAULT_SALT_FIELD` The default name of the property for the salt field
    `static String` | `DEFAULT_USERNAME_FIELD` The default name of the property for the username, like it is stored in mongodb
    `static String` | `PROPERTY_COLLECTION_NAME` The property name to be used to set the name of the collection inside the config
    `static String` | `PROPERTY_CREDENTIAL_PASSWORD_FIELD` The property name to be used to set the name of the field, where the password for the credentials is stored inside
    `static String` | `PROPERTY_CREDENTIAL_USERNAME_FIELD` The property name to be used to set the name of the field, where the username for the credentials is stored inside
    `static String` | `PROPERTY_PASSWORD_FIELD` The property name to be used to set the name of the field, where the password is stored inside
    `static String` | `PROPERTY_PERMISSION_FIELD` The property name to be used to set the name of the field, where the permissions are stored inside
    `static String` | `PROPERTY_ROLE_FIELD` The property name to be used to set the name of the field, where the roles are stored inside
    `static String` | `PROPERTY_SALT_FIELD` The property name to be used to set the name of the field, where the SALT is stored inside
    `static String` | `PROPERTY_SALT_STYLE` The property name to be used to set the name of the field, where the salt style is stored inside
    `static String` | `PROPERTY_USERNAME_FIELD` The property name to be used to set the name of the field, where the username is stored inside
    `static String` | `ROLE_PREFIX` The prefix which is used by the method when checking for role access

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `MongoAuth(MongoAuth delegate)`
    `MongoAuth(Object delegate)`

  - ### Method Summary

    All Methods Static Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `static MongoAuth` | `create(MongoClient mongoClient, JsonObject config)` Creates an instance of MongoAuth by using the given and configuration object.
    `boolean` | `equals(Object o)`
    `String` | `getCollectionName()` The name of the collection used to store User objects inside.
    `MongoAuth` | `getDelegate()`
    `HashStrategy` | `getHashStrategy()` The HashStrategy which is used by the current instance
    `String` | `getPasswordCredentialField()` Get the name of the field to be used as property for the password of credentials in the method `AuthProvider.authenticate(io.vertx.core.json.JsonObject, io.vertx.core.Handler<io.vertx.core.AsyncResult<io.vertx.reactivex.ext.auth.User>>)`.
    `String` | `getPasswordField()` Get the name of the field to be used for the password Defaults to `MongoAuth`
    `String` | `getPermissionField()` Get the name of the field to be used for the permissions.
    `String` | `getRoleField()` Get the name of the field to be used for the roles.
    `String` | `getSaltField()` Get the name of the field to be used for the salt.
    `String` | `getUsernameCredentialField()` Get the name of the field to be used as property for the username in the method `AuthProvider.authenticate(io.vertx.core.json.JsonObject, io.vertx.core.Handler<io.vertx.core.AsyncResult<io.vertx.reactivex.ext.auth.User>>)`.
    `String` | `getUsernameField()` Get the name of the field to be used for the username.
    `int` | `hashCode()`
    `void` | `insertUser(String username, String password, List<String> roles, List<String> permissions, Handler<AsyncResult<String>> resultHandler)` Insert a new user into mongo in the convenient way
    `static MongoAuth` | `newInstance(MongoAuth arg)`
    `Single<String>` | `rxInsertUser(String username, String password, List<String> roles, List<String> permissions)` Insert a new user into mongo in the convenient way
    `MongoAuth` | `setCollectionName(String collectionName)` Set the name of the collection to be used.
    `MongoAuth` | `setHashAlgorithm(HashAlgorithm hashAlgorithm)` The Hash Algorithm which is used by the current instance
    `MongoAuth` | `setHashStrategy(HashStrategy hashStrategy)` The HashStrategy which is used by the current instance
    `MongoAuth` | `setPasswordCredentialField(String fieldName)` Set the name of the field to be used as property for the password of credentials in the method `AuthProvider.authenticate(io.vertx.core.json.JsonObject, io.vertx.core.Handler<io.vertx.core.AsyncResult<io.vertx.reactivex.ext.auth.User>>)`.
    `MongoAuth` | `setPasswordField(String fieldName)` Set the name of the field to be used for the password Defaults to `MongoAuth`
    `MongoAuth` | `setPermissionField(String fieldName)` Set the name of the field to be used for the permissions.
    `MongoAuth` | `setRoleField(String fieldName)` Set the name of the field to be used for the roles.
    `MongoAuth` | `setSaltField(String fieldName)` Set the name of the field to be used for the salt.
    `MongoAuth` | `setUsernameCredentialField(String fieldName)` Set the name of the field to be used as property for the username in the method `AuthProvider.authenticate(io.vertx.core.json.JsonObject, io.vertx.core.Handler<io.vertx.core.AsyncResult<io.vertx.reactivex.ext.auth.User>>)`.
    `MongoAuth` | `setUsernameField(String fieldName)` Set the name of the field to be used for the username.
    `String` | `toString()`

    - ### Methods inherited from class io.vertx.reactivex.ext.auth.AuthProvider

      `authenticate, newInstance, rxAuthenticate`

    - ### Methods inherited from class java.lang.Object

      `clone, finalize, getClass, notify, notifyAll, wait, wait, wait`

- - ### Field Detail

    - #### __TYPE_ARG

          public static final io.vertx.lang.rx.TypeArg<MongoAuth> __TYPE_ARG

    - #### PROPERTY_COLLECTION_NAME

          public static final String PROPERTY_COLLECTION_NAME

      The property name to be used to set the name of the collection inside the config
      See Also:
        Constant Field Values

    - #### PROPERTY_USERNAME_FIELD

          public static final String PROPERTY_USERNAME_FIELD

      The property name to be used to set the name of the field, where the username is stored inside
      See Also:
        Constant Field Values

    - #### PROPERTY_ROLE_FIELD

          public static final String PROPERTY_ROLE_FIELD

      The property name to be used to set the name of the field, where the roles are stored inside
      See Also:
        Constant Field Values

    - #### PROPERTY_PERMISSION_FIELD

          public static final String PROPERTY_PERMISSION_FIELD

      The property name to be used to set the name of the field, where the permissions are stored inside
      See Also:
        Constant Field Values

    - #### PROPERTY_PASSWORD_FIELD

          public static final String PROPERTY_PASSWORD_FIELD

      The property name to be used to set the name of the field, where the password is stored inside
      See Also:
        Constant Field Values

    - #### PROPERTY_CREDENTIAL_USERNAME_FIELD

          public static final String PROPERTY_CREDENTIAL_USERNAME_FIELD

      The property name to be used to set the name of the field, where the username for the credentials is stored inside
      See Also:
        Constant Field Values

    - #### PROPERTY_CREDENTIAL_PASSWORD_FIELD

          public static final String PROPERTY_CREDENTIAL_PASSWORD_FIELD

      The property name to be used to set the name of the field, where the password for the credentials is stored inside
      See Also:
        Constant Field Values

    - #### PROPERTY_SALT_FIELD

          public static final String PROPERTY_SALT_FIELD

      The property name to be used to set the name of the field, where the SALT is stored inside
      See Also:
        Constant Field Values

    - #### PROPERTY_SALT_STYLE

          public static final String PROPERTY_SALT_STYLE

      The property name to be used to set the name of the field, where the salt style is stored inside
      See Also:
        Constant Field Values

    - #### DEFAULT_COLLECTION_NAME

          public static final String DEFAULT_COLLECTION_NAME

      The default name of the collection to be used
      See Also:
        Constant Field Values

    - #### DEFAULT_USERNAME_FIELD

          public static final String DEFAULT_USERNAME_FIELD

      The default name of the property for the username, like it is stored in mongodb
      See Also:
        Constant Field Values

    - #### DEFAULT_PASSWORD_FIELD

          public static final String DEFAULT_PASSWORD_FIELD

      The default name of the property for the password, like it is stored in mongodb
      See Also:
        Constant Field Values

    - #### DEFAULT_ROLE_FIELD

          public static final String DEFAULT_ROLE_FIELD

      The default name of the property for the roles, like it is stored in mongodb. Roles are expected to be saved as JsonArray
      See Also:
        Constant Field Values

    - #### DEFAULT_PERMISSION_FIELD

          public static final String DEFAULT_PERMISSION_FIELD

      The default name of the property for the permissions, like it is stored in mongodb. Permissions are expected to be saved as JsonArray
      See Also:
        Constant Field Values

    - #### DEFAULT_CREDENTIAL_USERNAME_FIELD

          public static final String DEFAULT_CREDENTIAL_USERNAME_FIELD

      The default name of the property for the username, like it is transported in credentials by method `AuthProvider.authenticate(io.vertx.core.json.JsonObject, io.vertx.core.Handler<io.vertx.core.AsyncResult<io.vertx.reactivex.ext.auth.User>>)`
      See Also:
        Constant Field Values

    - #### DEFAULT_CREDENTIAL_PASSWORD_FIELD

          public static final String DEFAULT_CREDENTIAL_PASSWORD_FIELD

      The default name of the property for the password, like it is transported in credentials by method `AuthProvider.authenticate(io.vertx.core.json.JsonObject, io.vertx.core.Handler<io.vertx.core.AsyncResult<io.vertx.reactivex.ext.auth.User>>)`
      See Also:
        Constant Field Values

    - #### DEFAULT_SALT_FIELD

          public static final String DEFAULT_SALT_FIELD

      The default name of the property for the salt field
      See Also:
        Constant Field Values

    - #### ROLE_PREFIX

          public static final String ROLE_PREFIX

      The prefix which is used by the method when checking for role access
      See Also:
        Constant Field Values

  - ### Constructor Detail

    - #### MongoAuth

          public MongoAuth(MongoAuth delegate)

    - #### MongoAuth

          public MongoAuth(Object delegate)

  - ### Method Detail

    - #### toString

          public String toString()

      Overrides:
        `toString` in class `AuthProvider`

    - #### equals

          public boolean equals(Object o)

      Overrides:
        `equals` in class `AuthProvider`

    - #### hashCode

          public int hashCode()

      Overrides:
        `hashCode` in class `AuthProvider`

    - #### getDelegate

          public MongoAuth getDelegate()

      Overrides:
        `getDelegate` in class `AuthProvider`

    - #### create

          public static MongoAuth create(MongoClient mongoClient,
                                         JsonObject config)

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

      Parameters:
        `mongoClient` - an instance of to be used for data storage and retrival
        `config` - the configuration object for the current instance. By this
      Returns:
        the created instance of `MongoAuth`s

    - #### setCollectionName

          public MongoAuth setCollectionName(String collectionName)

      Set the name of the collection to be used. Defaults to `MongoAuth`
      Parameters:
        `collectionName` - the name of the collection to be used for storing and reading user data
      Returns:
        the current instance itself for fluent calls

    - #### setUsernameField

          public MongoAuth setUsernameField(String fieldName)

      Set the name of the field to be used for the username. Defaults to `MongoAuth`
      Parameters:
        `fieldName` - the name of the field to be used
      Returns:
        the current instance itself for fluent calls

    - #### setPasswordField

          public MongoAuth setPasswordField(String fieldName)

      Set the name of the field to be used for the password Defaults to `MongoAuth`
      Parameters:
        `fieldName` - the name of the field to be used
      Returns:
        the current instance itself for fluent calls

    - #### setRoleField

          public MongoAuth setRoleField(String fieldName)

      Set the name of the field to be used for the roles. Defaults to `MongoAuth`. Roles are expected to be saved as JsonArray
      Parameters:
        `fieldName` - the name of the field to be used
      Returns:
        the current instance itself for fluent calls

    - #### setPermissionField

          public MongoAuth setPermissionField(String fieldName)

      Set the name of the field to be used for the permissions. Defaults to `MongoAuth`. Permissions are expected to be saved as JsonArray
      Parameters:
        `fieldName` - the name of the field to be used
      Returns:
        the current instance itself for fluent calls

    - #### setUsernameCredentialField

          public MongoAuth setUsernameCredentialField(String fieldName)

      Set the name of the field to be used as property for the username in the method `AuthProvider.authenticate(io.vertx.core.json.JsonObject, io.vertx.core.Handler<io.vertx.core.AsyncResult<io.vertx.reactivex.ext.auth.User>>)`. Defaults to `MongoAuth`
      Parameters:
        `fieldName` - the name of the field to be used
      Returns:
        the current instance itself for fluent calls

    - #### setPasswordCredentialField

          public MongoAuth setPasswordCredentialField(String fieldName)

      Set the name of the field to be used as property for the password of credentials in the method `AuthProvider.authenticate(io.vertx.core.json.JsonObject, io.vertx.core.Handler<io.vertx.core.AsyncResult<io.vertx.reactivex.ext.auth.User>>)`. Defaults to `MongoAuth`
      Parameters:
        `fieldName` - the name of the field to be used
      Returns:
        the current instance itself for fluent calls

    - #### setSaltField

          public MongoAuth setSaltField(String fieldName)

      Set the name of the field to be used for the salt. Only used when `HashStrategy.setSaltStyle(io.vertx.ext.auth.mongo.HashSaltStyle)` is set to
      Parameters:
        `fieldName` - the name of the field to be used
      Returns:
        the current instance itself for fluent calls

    - #### getCollectionName

          public String getCollectionName()

      The name of the collection used to store User objects inside. Defaults to `MongoAuth`
      Returns:
        the collectionName

    - #### getUsernameField

          public String getUsernameField()

      Get the name of the field to be used for the username. Defaults to `MongoAuth`
      Returns:
        the usernameField

    - #### getPasswordField

          public String getPasswordField()

      Get the name of the field to be used for the password Defaults to `MongoAuth`
      Returns:
        the passwordField

    - #### getRoleField

          public String getRoleField()

      Get the name of the field to be used for the roles. Defaults to `MongoAuth`. Roles are expected to be saved as JsonArray
      Returns:
        the roleField

    - #### getPermissionField

          public String getPermissionField()

      Get the name of the field to be used for the permissions. Defaults to `MongoAuth`. Permissions are expected to be saved as JsonArray
      Returns:
        the permissionField

    - #### getUsernameCredentialField

          public String getUsernameCredentialField()

      Get the name of the field to be used as property for the username in the method `AuthProvider.authenticate(io.vertx.core.json.JsonObject, io.vertx.core.Handler<io.vertx.core.AsyncResult<io.vertx.reactivex.ext.auth.User>>)`. Defaults to `MongoAuth`
      Returns:
        the usernameCredentialField

    - #### getPasswordCredentialField

          public String getPasswordCredentialField()

      Get the name of the field to be used as property for the password of credentials in the method `AuthProvider.authenticate(io.vertx.core.json.JsonObject, io.vertx.core.Handler<io.vertx.core.AsyncResult<io.vertx.reactivex.ext.auth.User>>)`. Defaults to `MongoAuth`
      Returns:
        the passwordCredentialField

    - #### getSaltField

          public String getSaltField()

      Get the name of the field to be used for the salt. Only used when `HashStrategy.setSaltStyle(io.vertx.ext.auth.mongo.HashSaltStyle)` is set to
      Returns:
        the saltField

    - #### setHashStrategy

          public MongoAuth setHashStrategy(HashStrategy hashStrategy)

      The HashStrategy which is used by the current instance
      Parameters:
        `hashStrategy` - the `HashStrategy` to be set
      Returns:
        the current instance itself for fluent calls

    - #### getHashStrategy

          public HashStrategy getHashStrategy()

      The HashStrategy which is used by the current instance
      Returns:
        the defined instance of `HashStrategy`

    - #### setHashAlgorithm

          public MongoAuth setHashAlgorithm(HashAlgorithm hashAlgorithm)

      The Hash Algorithm which is used by the current instance
      Parameters:
        `hashAlgorithm` - the `HashAlgorithm` to be set
      Returns:
        the current instance itself for fluent calls

    - #### insertUser

          public void insertUser(String username,
                                 String password,
                                 List<String> roles,
                                 List<String> permissions,
                                 Handler<AsyncResult<String>> resultHandler)

      Insert a new user into mongo in the convenient way
      Parameters:
        `username` - the username to be set
        `password` - the passsword in clear text, will be adapted following the definitions of the defined `HashStrategy`
        `roles` - a list of roles to be set
        `permissions` - a list of permissions to be set
        `resultHandler` - the ResultHandler will be provided with the id of the generated record

    - #### rxInsertUser

          public Single<String> rxInsertUser(String username,
                                             String password,
                                             List<String> roles,
                                             List<String> permissions)

      Insert a new user into mongo in the convenient way
      Parameters:
        `username` - the username to be set
        `password` - the passsword in clear text, will be adapted following the definitions of the defined `HashStrategy`
        `roles` - a list of roles to be set
        `permissions` - a list of permissions to be set
      Returns:

    - #### newInstance

          public static MongoAuth newInstance(MongoAuth arg)

Copyright © 2021 Eclipse. All rights reserved.