public class MongoAuth extends AuthProvider
original
non RX-ified interface using Vert.x codegen.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.
|
String |
getCollectionName()
The name of the collection used to store User objects inside.
|
Object |
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.rxjava.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.rxjava.ext.auth.User>>) . |
String |
getUsernameField()
Get the name of the field to be used for the username.
|
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
|
Observable<String> |
insertUserObservable(String username,
String password,
List<String> roles,
List<String> permissions)
Insert a new user into mongo in the convenient way
|
static MongoAuth |
newInstance(MongoAuth arg) |
MongoAuth |
setCollectionName(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(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.rxjava.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.rxjava.ext.auth.User>>) . |
MongoAuth |
setUsernameField(String fieldName)
Set the name of the field to be used for the username.
|
authenticate, authenticateObservable, newInstance
public MongoAuth(MongoAuth delegate)
public Object getDelegate()
getDelegate
in class AuthProvider
public static MongoAuth create(MongoClient mongoClient, JsonObject config)
JsonObject js = new JsonObject(); js.put(MongoAuth.PROPERTY_COLLECTION_NAME, createCollectionName(MongoAuth.DEFAULT_COLLECTION_NAME));
mongoClient
- an instance of to be used for data storage and retrivalconfig
- the configuration object for the current instance. By thisMongoAuth
spublic MongoAuth setCollectionName(String collectionName)
MongoAuth
collectionName
- the name of the collection to be used for storing and reading user datapublic MongoAuth setUsernameField(String fieldName)
MongoAuth
fieldName
- the name of the field to be usedpublic MongoAuth setPasswordField(String fieldName)
MongoAuth
fieldName
- the name of the field to be usedpublic MongoAuth setRoleField(String fieldName)
MongoAuth
. Roles are expected to
be saved as JsonArrayfieldName
- the name of the field to be usedpublic MongoAuth setPermissionField(String fieldName)
MongoAuth
.
Permissions are expected to be saved as JsonArrayfieldName
- the name of the field to be usedpublic MongoAuth setUsernameCredentialField(String fieldName)
AuthProvider.authenticate(io.vertx.core.json.JsonObject, io.vertx.core.Handler<io.vertx.core.AsyncResult<io.vertx.rxjava.ext.auth.User>>)
. Defaults to MongoAuth
fieldName
- the name of the field to be usedpublic MongoAuth setPasswordCredentialField(String fieldName)
AuthProvider.authenticate(io.vertx.core.json.JsonObject, io.vertx.core.Handler<io.vertx.core.AsyncResult<io.vertx.rxjava.ext.auth.User>>)
. Defaults to MongoAuth
fieldName
- the name of the field to be usedpublic MongoAuth setSaltField(String fieldName)
HashStrategy.setSaltStyle(io.vertx.ext.auth.mongo.HashSaltStyle)
is
set tofieldName
- the name of the field to be usedpublic String getCollectionName()
MongoAuth
public String getUsernameField()
MongoAuth
public String getPasswordField()
MongoAuth
public String getRoleField()
MongoAuth
. Roles are expected to
be saved as JsonArraypublic String getPermissionField()
MongoAuth
.
Permissions are expected to be saved as JsonArraypublic String getUsernameCredentialField()
AuthProvider.authenticate(io.vertx.core.json.JsonObject, io.vertx.core.Handler<io.vertx.core.AsyncResult<io.vertx.rxjava.ext.auth.User>>)
. Defaults to MongoAuth
public String getPasswordCredentialField()
AuthProvider.authenticate(io.vertx.core.json.JsonObject, io.vertx.core.Handler<io.vertx.core.AsyncResult<io.vertx.rxjava.ext.auth.User>>)
. Defaults to MongoAuth
public String getSaltField()
HashStrategy.setSaltStyle(io.vertx.ext.auth.mongo.HashSaltStyle)
is
set topublic MongoAuth setHashStrategy(HashStrategy hashStrategy)
hashStrategy
- the HashStrategy
to be setpublic HashStrategy getHashStrategy()
HashStrategy
public void 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 recordpublic Observable<String> insertUserObservable(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 setCopyright © 2016. All rights reserved.