vertx / io.vertx.ext.auth.mongo / MongoAuth

MongoAuth

interface MongoAuth : AuthProvider

An extension of AuthProvider which is using MongoClient as store

Author
mremme

Properties

DEFAULT_COLLECTION_NAME

static val DEFAULT_COLLECTION_NAME: String

The default name of the collection to be used

DEFAULT_CREDENTIAL_PASSWORD_FIELD

static val DEFAULT_CREDENTIAL_PASSWORD_FIELD: String

The default name of the property for the password, like it is transported in credentials by method #authenticate(JsonObject, Handler)

DEFAULT_CREDENTIAL_USERNAME_FIELD

static val DEFAULT_CREDENTIAL_USERNAME_FIELD: String

The default name of the property for the username, like it is transported in credentials by method #authenticate(JsonObject, Handler)

DEFAULT_PASSWORD_FIELD

static val DEFAULT_PASSWORD_FIELD: String

The default name of the property for the password, like it is stored in mongodb

DEFAULT_PERMISSION_FIELD

static val DEFAULT_PERMISSION_FIELD: String

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

DEFAULT_ROLE_FIELD

static val DEFAULT_ROLE_FIELD: String

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

DEFAULT_SALT_FIELD

static val DEFAULT_SALT_FIELD: String

The default name of the property for the salt field

DEFAULT_USERNAME_FIELD

static val DEFAULT_USERNAME_FIELD: String

The default name of the property for the username, like it is stored in mongodb

PROPERTY_COLLECTION_NAME

static val PROPERTY_COLLECTION_NAME: String

The property name to be used to set the name of the collection inside the config

PROPERTY_CREDENTIAL_PASSWORD_FIELD

static val PROPERTY_CREDENTIAL_PASSWORD_FIELD: String

The property name to be used to set the name of the field, where the password for the credentials is stored inside

PROPERTY_CREDENTIAL_USERNAME_FIELD

static val PROPERTY_CREDENTIAL_USERNAME_FIELD: String

The property name to be used to set the name of the field, where the username for the credentials is stored inside

PROPERTY_PASSWORD_FIELD

static val PROPERTY_PASSWORD_FIELD: String

The property name to be used to set the name of the field, where the password is stored inside

PROPERTY_PERMISSION_FIELD

static val PROPERTY_PERMISSION_FIELD: String

The property name to be used to set the name of the field, where the permissions are stored inside

PROPERTY_ROLE_FIELD

static val PROPERTY_ROLE_FIELD: String

The property name to be used to set the name of the field, where the roles are stored inside

PROPERTY_SALT_FIELD

static val PROPERTY_SALT_FIELD: String

The property name to be used to set the name of the field, where the SALT is stored inside

PROPERTY_SALT_STYLE

static val PROPERTY_SALT_STYLE: String

The property name to be used to set the name of the field, where the salt style is stored inside

PROPERTY_USERNAME_FIELD

static val PROPERTY_USERNAME_FIELD: String

The property name to be used to set the name of the field, where the username is stored inside

ROLE_PREFIX

static val ROLE_PREFIX: String

The prefix which is used by the method User#isAuthorised(String, Handler) when checking for role access

Functions

create

open static fun create(mongoClient: MongoClient, config: JsonObject): MongoAuth

Creates an instance of MongoAuth by using the given MongoClient and configuration object. An example for a configuration object:

 JsonObject js = new JsonObject(); js.put(MongoAuth.PROPERTY_COLLECTION_NAME, createCollectionName(MongoAuth.DEFAULT_COLLECTION_NAME)); 

getCollectionName

abstract fun getCollectionName(): String

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

getHashStrategy

abstract fun getHashStrategy(): HashStrategy

The HashStrategy which is used by the current instance

getPasswordCredentialField

abstract fun getPasswordCredentialField(): String

Get the name of the field to be used as property for the password of credentials in the method #authenticate(JsonObject, io.vertx.core.Handler). Defaults to #DEFAULT_CREDENTIAL_PASSWORD_FIELD

getPasswordField

abstract fun getPasswordField(): String

Get the name of the field to be used for the password Defaults to #DEFAULT_PASSWORD_FIELD

getPermissionField

abstract fun getPermissionField(): String

Get the name of the field to be used for the permissions. Defaults to #DEFAULT_PERMISSION_FIELD. Permissions are expected to be saved as JsonArray

getRoleField

abstract fun getRoleField(): String

Get the name of the field to be used for the roles. Defaults to #DEFAULT_ROLE_FIELD. Roles are expected to be saved as JsonArray

getSaltField

abstract fun getSaltField(): String

Get the name of the field to be used for the salt. Only used when HashStrategy#setSaltStyle(HashSaltStyle) is set to HashSaltStyle#COLUMN

getUsernameCredentialField

abstract fun getUsernameCredentialField(): String

Get the name of the field to be used as property for the username in the method #authenticate(JsonObject, io.vertx.core.Handler). Defaults to #DEFAULT_CREDENTIAL_USERNAME_FIELD

getUsernameField

abstract fun getUsernameField(): String

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

insertUser

abstract fun insertUser(username: String, password: String, roles: MutableList<String>, permissions: MutableList<String>, resultHandler: Handler<AsyncResult<String>>): Unit

Insert a new user into mongo in the convenient way

setCollectionName

abstract fun setCollectionName(collectionName: String): MongoAuth

Set the name of the collection to be used. Defaults to #DEFAULT_COLLECTION_NAME

setHashStrategy

abstract fun setHashStrategy(hashStrategy: HashStrategy): MongoAuth

The HashStrategy which is used by the current instance

setPasswordCredentialField

abstract fun setPasswordCredentialField(fieldName: String): MongoAuth

Set the name of the field to be used as property for the password of credentials in the method #authenticate(JsonObject, io.vertx.core.Handler). Defaults to #DEFAULT_CREDENTIAL_PASSWORD_FIELD

setPasswordField

abstract fun setPasswordField(fieldName: String): MongoAuth

Set the name of the field to be used for the password Defaults to #DEFAULT_PASSWORD_FIELD

setPermissionField

abstract fun setPermissionField(fieldName: String): MongoAuth

Set the name of the field to be used for the permissions. Defaults to #DEFAULT_PERMISSION_FIELD. Permissions are expected to be saved as JsonArray

setRoleField

abstract fun setRoleField(fieldName: String): MongoAuth

Set the name of the field to be used for the roles. Defaults to #DEFAULT_ROLE_FIELD. Roles are expected to be saved as JsonArray

setSaltField

abstract fun setSaltField(fieldName: String): MongoAuth

Set the name of the field to be used for the salt. Only used when HashStrategy#setSaltStyle(HashSaltStyle) is set to HashSaltStyle#COLUMN

setUsernameCredentialField

abstract fun setUsernameCredentialField(fieldName: String): MongoAuth

Set the name of the field to be used as property for the username in the method #authenticate(JsonObject, io.vertx.core.Handler). Defaults to #DEFAULT_CREDENTIAL_USERNAME_FIELD

setUsernameField

abstract fun setUsernameField(fieldName: String): MongoAuth

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