Package: io.vertx.groovy.ext.auth.mongo

## [Groovy] Class MongoAuth

- io.vertx.groovy.ext.auth.mongo.MongoAuth

- An extension of AuthProvider which is using as store

- - ### Constructor Summary

    Constructors
    Constructor and description
    `MongoAuth (java.lang.Object delegate)`

  - ### Methods Summary

    Methods
    Type | Name and description
    --- | ---
    `static MongoAuth` | `create(MongoClient mongoClient, java.util.Map<java.lang.String, java.lang.Object> config)` Creates an instance of MongoAuth by using the given and configuration object.
    `java.lang.String` | `getCollectionName()` The name of the collection used to store User objects inside.
    `java.lang.Object` | `getDelegate()`
    `HashStrategy` | `getHashStrategy()` The HashStrategy which is used by the current instance
    `java.lang.String` | `getPasswordCredentialField()` Get the name of the field to be used as property for the password of credentials in the method AuthProvider.authenticate.
    `java.lang.String` | `getPasswordField()` Get the name of the field to be used for the password Defaults to MongoAuth
    `java.lang.String` | `getPermissionField()` Get the name of the field to be used for the permissions.
    `java.lang.String` | `getRoleField()` Get the name of the field to be used for the roles.
    `java.lang.String` | `getSaltField()` Get the name of the field to be used for the salt.
    `java.lang.String` | `getUsernameCredentialField()` Get the name of the field to be used as property for the username in the method AuthProvider.authenticate.
    `java.lang.String` | `getUsernameField()` Get the name of the field to be used for the username.
    `void` | `insertUser(java.lang.String username, java.lang.String password, java.util.List<java.lang.String> roles, java.util.List<java.lang.String> permissions, io.vertx.core.Handler<io.vertx.core.AsyncResult<java.lang.String>> resultHandler)` Insert a new user into mongo in the convenient way
    `MongoAuth` | `setCollectionName(java.lang.String collectionName)` Set the name of the collection to be used.
    `MongoAuth` | `setHashStrategy(HashStrategy hashStrategy)` The HashStrategy which is used by the current instance
    `MongoAuth` | `setPasswordCredentialField(java.lang.String fieldName)` Set the name of the field to be used as property for the password of credentials in the method AuthProvider.authenticate.
    `MongoAuth` | `setPasswordField(java.lang.String fieldName)` Set the name of the field to be used for the password Defaults to MongoAuth
    `MongoAuth` | `setPermissionField(java.lang.String fieldName)` Set the name of the field to be used for the permissions.
    `MongoAuth` | `setRoleField(java.lang.String fieldName)` Set the name of the field to be used for the roles.
    `MongoAuth` | `setSaltField(java.lang.String fieldName)` Set the name of the field to be used for the salt.
    `MongoAuth` | `setUsernameCredentialField(java.lang.String fieldName)` Set the name of the field to be used as property for the username in the method AuthProvider.authenticate.
    `MongoAuth` | `setUsernameField(java.lang.String fieldName)` Set the name of the field to be used for the username.

  - ### Inherited Methods Summary

    Inherited Methods
    Methods inherited from class | Name
    --- | ---
    `class AuthProvider` | `authenticate, getDelegate`
    `class java.lang.Object` | `java.lang.Object#wait(long, int), java.lang.Object#wait(long), java.lang.Object#wait(), java.lang.Object#equals(java.lang.Object), java.lang.Object#toString(), java.lang.Object#hashCode(), java.lang.Object#getClass(), java.lang.Object#notify(), java.lang.Object#notifyAll()`

- - ### Constructor Detail

    - #### MongoAuth(java.lang.Object delegate)

  - ### Method Detail

    - #### static MongoAuth create(MongoClient mongoClient, java.util.Map<java.lang.String, java.lang.Object> 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));

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

    - #### java.lang.String getCollectionName()

      The name of the collection used to store User objects inside. Defaults to MongoAuth

      Returns:
        the collectionName

    - #### java.lang.Object getDelegate()

    - #### HashStrategy getHashStrategy()

      The HashStrategy which is used by the current instance

      Returns:
        the defined instance of HashStrategy

    - #### java.lang.String getPasswordCredentialField()

      Get the name of the field to be used as property for the password of credentials in the method AuthProvider.authenticate. Defaults to MongoAuth

      Returns:
        the passwordCredentialField

    - #### java.lang.String getPasswordField()

      Get the name of the field to be used for the password Defaults to MongoAuth

      Returns:
        the passwordField

    - #### java.lang.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

    - #### java.lang.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

    - #### java.lang.String getSaltField()

      Get the name of the field to be used for the salt. Only used when HashStrategy.setSaltStyle is set to

      Returns:
        the saltField

    - #### java.lang.String getUsernameCredentialField()

      Get the name of the field to be used as property for the username in the method AuthProvider.authenticate. Defaults to MongoAuth

      Returns:
        the usernameCredentialField

    - #### java.lang.String getUsernameField()

      Get the name of the field to be used for the username. Defaults to MongoAuth

      Returns:
        the usernameField

    - #### void insertUser(java.lang.String username, java.lang.String password, java.util.List<java.lang.String> roles, java.util.List<java.lang.String> permissions, io.vertx.core.Handler<io.vertx.core.AsyncResult<java.lang.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

    - #### MongoAuth setCollectionName(java.lang.String collectionName)

      Set the name of the collection to be used. Defaults to MongoAuth

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

    - #### MongoAuth setHashStrategy(HashStrategy hashStrategy)

      The HashStrategy which is used by the current instance

      Returns:
        the current instance itself for fluent calls
      Parameters:
        `hashStrategy` - the HashStrategy to be set

    - #### MongoAuth setPasswordCredentialField(java.lang.String fieldName)

      Set the name of the field to be used as property for the password of credentials in the method AuthProvider.authenticate. Defaults to MongoAuth

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

    - #### MongoAuth setPasswordField(java.lang.String fieldName)

      Set the name of the field to be used for the password Defaults to MongoAuth

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

    - #### MongoAuth setPermissionField(java.lang.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

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

    - #### MongoAuth setRoleField(java.lang.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

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

    - #### MongoAuth setSaltField(java.lang.String fieldName)

      Set the name of the field to be used for the salt. Only used when HashStrategy.setSaltStyle is set to

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

    - #### MongoAuth setUsernameCredentialField(java.lang.String fieldName)

      Set the name of the field to be used as property for the username in the method AuthProvider.authenticate. Defaults to MongoAuth

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

    - #### MongoAuth setUsernameField(java.lang.String fieldName)

      Set the name of the field to be used for the username. Defaults to MongoAuth

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