Package io.vertx.ext.auth.mongo
Interface MongoUserUtil
-
public interface MongoUserUtil
Utility to create users/roles/permissions. This is a helper class and not intended to be a full user management utility. While the standard authentication and authorization interfaces will require usually read only access to the database, in order to use this API a full read/write access must be granted.
-
-
Method Summary
All Methods Static Methods Instance Methods Abstract Methods Modifier and Type Method Description static MongoUserUtil
create(MongoClient client)
Create an instance of the user helper.static MongoUserUtil
create(MongoClient client, MongoAuthenticationOptions authenticationOptions, MongoAuthorizationOptions authorizationOptions)
Create an instance of the user helper with custom queries.Future<String>
createHashedUser(String username, String hash)
Insert a user into a database.Future<String>
createUser(String username, String password)
Insert a user into a database.Future<String>
createUserRolesAndPermissions(String user, List<String> roles, List<String> permissions)
Insert a user role into a database.
-
-
-
Method Detail
-
create
static MongoUserUtil create(MongoClient client)
Create an instance of the user helper.- Parameters:
client
- the client with write rights to the database.- Returns:
- the instance
-
create
static MongoUserUtil create(MongoClient client, MongoAuthenticationOptions authenticationOptions, MongoAuthorizationOptions authorizationOptions)
Create an instance of the user helper with custom queries.- Parameters:
client
- the client with write rights to the database.- Returns:
- the instance
-
createUser
Future<String> createUser(String username, String password)
Insert a user into a database.- Parameters:
username
- the username to be setpassword
- the password in clear text, will be adapted following the definitions of the defined strategy- Returns:
- a future provided with the result of the operation and the created user document identifier
-
createHashedUser
Future<String> createHashedUser(String username, String hash)
Insert a user into a database.- Parameters:
username
- the username to be sethash
- the password hash, as result ofHashingStrategy.hash(String, Map, String, String)
- Returns:
- a future provided with the result of the operation and the created user document identifier
-
createUserRolesAndPermissions
Future<String> createUserRolesAndPermissions(String user, List<String> roles, List<String> permissions)
Insert a user role into a database.- Parameters:
user
- the username to be setroles
- a to be setpermissions
- a to be set- Returns:
- a future provided with the result of the operation and the created user document identifier
-
-