MongoAuthentication
for authentication and MongoAuthorization
for authorizationpublic interface MongoAuth extends AuthProvider
MongoClient
as storeModifier and Type | Field and Description |
---|---|
static String |
DEFAULT_COLLECTION_NAME
Deprecated.
The default name of the collection to be used
|
static String |
DEFAULT_CREDENTIAL_PASSWORD_FIELD
Deprecated.
The default name of the property for the password, like it is transported in credentials by method
AuthenticationProvider.authenticate(JsonObject, Handler) |
static String |
DEFAULT_CREDENTIAL_USERNAME_FIELD
Deprecated.
The default name of the property for the username, like it is transported in credentials by method
AuthenticationProvider.authenticate(JsonObject, Handler) |
static String |
DEFAULT_PASSWORD_FIELD
Deprecated.
The default name of the property for the password, like it is stored in mongodb
|
static String |
DEFAULT_PERMISSION_FIELD
Deprecated.
The default name of the property for the permissions, like it is stored in mongodb.
|
static String |
DEFAULT_ROLE_FIELD
Deprecated.
The default name of the property for the roles, like it is stored in mongodb.
|
static String |
DEFAULT_SALT_FIELD
Deprecated.
The default name of the property for the salt field
|
static String |
DEFAULT_USERNAME_FIELD
Deprecated.
The default name of the property for the username, like it is stored in mongodb
|
static String |
PROPERTY_COLLECTION_NAME
Deprecated.
The property name to be used to set the name of the collection inside the config
|
static String |
PROPERTY_CREDENTIAL_PASSWORD_FIELD
Deprecated.
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
Deprecated.
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
Deprecated.
The property name to be used to set the name of the field, where the password is stored inside
|
static String |
PROPERTY_PERMISSION_FIELD
Deprecated.
The property name to be used to set the name of the field, where the permissions are stored inside
|
static String |
PROPERTY_ROLE_FIELD
Deprecated.
The property name to be used to set the name of the field, where the roles are stored inside
|
static String |
PROPERTY_SALT_FIELD
Deprecated.
The property name to be used to set the name of the field, where the SALT is stored inside
|
static String |
PROPERTY_SALT_STYLE
Deprecated.
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
Deprecated.
The property name to be used to set the name of the field, where the username is stored inside
|
static String |
ROLE_PREFIX
Deprecated.
The prefix which is used by the method
User.isAuthorized(String, Handler) when checking for role access |
Modifier and Type | Method and Description |
---|---|
static MongoAuth |
create(MongoClient mongoClient,
JsonObject config)
Deprecated.
Creates an instance of MongoAuth by using the given
MongoClient and configuration object. |
String |
getCollectionName()
Deprecated.
The name of the collection used to store User objects inside.
|
HashStrategy |
getHashStrategy()
Deprecated.
The HashStrategy which is used by the current instance
|
String |
getPasswordCredentialField()
Deprecated.
Get the name of the field to be used as property for the password of credentials in the method
AuthenticationProvider.authenticate(JsonObject, io.vertx.core.Handler) . |
String |
getPasswordField()
Deprecated.
Get the name of the field to be used for the password Defaults to
DEFAULT_PASSWORD_FIELD |
String |
getPermissionField()
Deprecated.
Get the name of the field to be used for the permissions.
|
String |
getRoleField()
Deprecated.
Get the name of the field to be used for the roles.
|
String |
getSaltField()
Deprecated.
Get the name of the field to be used for the salt.
|
String |
getUsernameCredentialField()
Deprecated.
Get the name of the field to be used as property for the username in the method
AuthenticationProvider.authenticate(JsonObject, io.vertx.core.Handler) . |
String |
getUsernameField()
Deprecated.
Get the name of the field to be used for the username.
|
default Future<String> |
insertUser(String username,
String password,
List<String> roles,
List<String> permissions)
Deprecated.
Insert a new user into mongo in the convenient way
|
void |
insertUser(String username,
String password,
List<String> roles,
List<String> permissions,
Handler<AsyncResult<String>> resultHandler)
Deprecated.
Insert a new user into mongo in the convenient way
|
MongoAuth |
setCollectionName(String collectionName)
Deprecated.
Set the name of the collection to be used.
|
MongoAuth |
setHashAlgorithm(HashAlgorithm hashAlgorithm)
Deprecated.
The Hash Algorithm which is used by the current instance
|
MongoAuth |
setHashStrategy(HashStrategy hashStrategy)
Deprecated.
The HashStrategy which is used by the current instance
|
MongoAuth |
setPasswordCredentialField(String fieldName)
Deprecated.
Set the name of the field to be used as property for the password of credentials in the method
AuthenticationProvider.authenticate(JsonObject, io.vertx.core.Handler) . |
MongoAuth |
setPasswordField(String fieldName)
Deprecated.
Set the name of the field to be used for the password Defaults to
DEFAULT_PASSWORD_FIELD |
MongoAuth |
setPermissionField(String fieldName)
Deprecated.
Set the name of the field to be used for the permissions.
|
MongoAuth |
setRoleField(String fieldName)
Deprecated.
Set the name of the field to be used for the roles.
|
MongoAuth |
setSaltField(String fieldName)
Deprecated.
Set the name of the field to be used for the salt.
|
MongoAuth |
setUsernameCredentialField(String fieldName)
Deprecated.
Set the name of the field to be used as property for the username in the method
AuthenticationProvider.authenticate(JsonObject, io.vertx.core.Handler) . |
MongoAuth |
setUsernameField(String fieldName)
Deprecated.
Set the name of the field to be used for the username.
|
authenticate, authenticate, authenticate, authenticate
static final String PROPERTY_COLLECTION_NAME
static final String PROPERTY_USERNAME_FIELD
static final String PROPERTY_ROLE_FIELD
static final String PROPERTY_PERMISSION_FIELD
static final String PROPERTY_PASSWORD_FIELD
static final String PROPERTY_CREDENTIAL_USERNAME_FIELD
static final String PROPERTY_CREDENTIAL_PASSWORD_FIELD
static final String PROPERTY_SALT_FIELD
static final String PROPERTY_SALT_STYLE
HashSaltStyle
,
Constant Field Valuesstatic final String DEFAULT_COLLECTION_NAME
static final String DEFAULT_USERNAME_FIELD
static final String DEFAULT_PASSWORD_FIELD
static final String DEFAULT_ROLE_FIELD
static final String DEFAULT_PERMISSION_FIELD
static final String DEFAULT_CREDENTIAL_USERNAME_FIELD
AuthenticationProvider.authenticate(JsonObject, Handler)
static final String DEFAULT_CREDENTIAL_PASSWORD_FIELD
AuthenticationProvider.authenticate(JsonObject, Handler)
static final String DEFAULT_SALT_FIELD
static final String ROLE_PREFIX
User.isAuthorized(String, Handler)
when checking for role accessstatic MongoAuth create(MongoClient mongoClient, JsonObject config)
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));
mongoClient
- an instance of MongoClient
to be used for data storage and retrivalconfig
- the configuration object for the current instance. By thisMongoAuth
sMongoAuth setCollectionName(String collectionName)
DEFAULT_COLLECTION_NAME
collectionName
- the name of the collection to be used for storing and reading user dataMongoAuth setUsernameField(String fieldName)
DEFAULT_USERNAME_FIELD
fieldName
- the name of the field to be usedMongoAuth setPasswordField(String fieldName)
DEFAULT_PASSWORD_FIELD
fieldName
- the name of the field to be usedMongoAuth setRoleField(String fieldName)
DEFAULT_ROLE_FIELD
. Roles are expected to
be saved as JsonArrayfieldName
- the name of the field to be usedMongoAuth setPermissionField(String fieldName)
DEFAULT_PERMISSION_FIELD
.
Permissions are expected to be saved as JsonArrayfieldName
- the name of the field to be usedMongoAuth setUsernameCredentialField(String fieldName)
AuthenticationProvider.authenticate(JsonObject, io.vertx.core.Handler)
. Defaults to DEFAULT_CREDENTIAL_USERNAME_FIELD
fieldName
- the name of the field to be usedMongoAuth setPasswordCredentialField(String fieldName)
AuthenticationProvider.authenticate(JsonObject, io.vertx.core.Handler)
. Defaults to DEFAULT_CREDENTIAL_PASSWORD_FIELD
fieldName
- the name of the field to be usedMongoAuth setSaltField(String fieldName)
HashStrategy.setSaltStyle(HashSaltStyle)
is
set to HashSaltStyle.COLUMN
fieldName
- the name of the field to be usedString getCollectionName()
DEFAULT_COLLECTION_NAME
String getUsernameField()
DEFAULT_USERNAME_FIELD
String getPasswordField()
DEFAULT_PASSWORD_FIELD
String getRoleField()
DEFAULT_ROLE_FIELD
. Roles are expected to
be saved as JsonArrayString getPermissionField()
DEFAULT_PERMISSION_FIELD
.
Permissions are expected to be saved as JsonArrayString getUsernameCredentialField()
AuthenticationProvider.authenticate(JsonObject, io.vertx.core.Handler)
. Defaults to DEFAULT_CREDENTIAL_USERNAME_FIELD
String getPasswordCredentialField()
AuthenticationProvider.authenticate(JsonObject, io.vertx.core.Handler)
. Defaults to DEFAULT_CREDENTIAL_PASSWORD_FIELD
String getSaltField()
HashStrategy.setSaltStyle(HashSaltStyle)
is
set to HashSaltStyle.COLUMN
MongoAuth setHashStrategy(HashStrategy hashStrategy)
hashStrategy
- the HashStrategy
to be setHashStrategy getHashStrategy()
HashStrategy
MongoAuth setHashAlgorithm(HashAlgorithm hashAlgorithm)
hashAlgorithm
- the HashAlgorithm
to be setvoid insertUser(String username, String password, List<String> roles, List<String> permissions, Handler<AsyncResult<String>> resultHandler)
username
- the username to be setpassword
- the passsword in clear text, will be adapted following the definitions of the defined HashStrategy
roles
- a list of roles to be setpermissions
- a list of permissions to be setresultHandler
- the ResultHandler will be provided with the id of the generated recorddefault Future<String> insertUser(String username, String password, List<String> roles, List<String> permissions)
username
- the username to be setpassword
- the passsword in clear text, will be adapted following the definitions of the defined HashStrategy
roles
- a list of roles to be setpermissions
- a list of permissions to be setinsertUser(String, String, List, List, Handler)
Copyright © 2022 Eclipse. All rights reserved.