public class AuthService extends Object
Handles authentication and role/permission based authorisation.
NOTE: This class has been automatically generated from theoriginal non RX-ified interface using Vert.x codegen.| Constructor and Description |
|---|
AuthService(AuthService delegate) |
| Modifier and Type | Method and Description |
|---|---|
static AuthService |
createEventBusProxy(Vertx vertx,
String address)
Create a proxy to an auth service that is deployed somwehere on the event bus.
|
static AuthService |
createFromClassName(Vertx vertx,
String className)
Create an auth service instance using the specified auth provider class name.
|
Object |
getDelegate() |
AuthService |
hasPermission(String loginID,
String permission,
Handler<AsyncResult<Boolean>> resultHandler)
Does the user have the specified permission?
|
rx.Observable<Boolean> |
hasPermissionObservable(String loginID,
String permission)
Does the user have the specified permission?
|
AuthService |
hasPermissions(String loginID,
Set<String> permissions,
Handler<AsyncResult<Boolean>> resultHandler)
Does the user have the specified permissions?
|
rx.Observable<Boolean> |
hasPermissionsObservable(String loginID,
Set<String> permissions)
Does the user have the specified permissions?
|
AuthService |
hasRole(String loginID,
String role,
Handler<AsyncResult<Boolean>> resultHandler)
Does the user have the specified role?
|
rx.Observable<Boolean> |
hasRoleObservable(String loginID,
String role)
Does the user have the specified role?
|
AuthService |
hasRoles(String loginID,
Set<String> roles,
Handler<AsyncResult<Boolean>> resultHandler)
Does the user have the specified roles?
|
rx.Observable<Boolean> |
hasRolesObservable(String loginID,
Set<String> roles)
Does the user have the specified roles?
|
AuthService |
login(JsonObject principal,
JsonObject credentials,
Handler<AsyncResult<String>> resultHandler)
Authenticate (login) using the specified credentials.
|
rx.Observable<String> |
loginObservable(JsonObject principal,
JsonObject credentials)
Authenticate (login) using the specified credentials.
|
AuthService |
loginWithTimeout(JsonObject principal,
JsonObject credentials,
long timeout,
Handler<AsyncResult<String>> resultHandler)
Authenticate (login) using the specified credentials.
|
rx.Observable<String> |
loginWithTimeoutObservable(JsonObject principal,
JsonObject credentials,
long timeout)
Authenticate (login) using the specified credentials.
|
AuthService |
logout(String loginID,
Handler<AsyncResult<Void>> resultHandler)
Logout the user
|
rx.Observable<Void> |
logoutObservable(String loginID)
Logout the user
|
static AuthService |
newInstance(AuthService arg) |
AuthService |
refreshLoginSession(String loginID,
Handler<AsyncResult<Void>> resultHandler)
Refresh an existing login ID so it doesn't expire
|
rx.Observable<Void> |
refreshLoginSessionObservable(String loginID)
Refresh an existing login ID so it doesn't expire
|
AuthService |
setReaperPeriod(long reaperPeriod)
Set the reaper period - how often to check for expired logins, in ms.
|
void |
start()
Start the service
|
void |
stop()
Stop the service
|
public AuthService(AuthService delegate)
public Object getDelegate()
public static AuthService createFromClassName(Vertx vertx, String className)
vertx - the Vert.x instanceclassName - the fully qualified class name of the auth provider implementation classpublic static AuthService createEventBusProxy(Vertx vertx, String address)
vertx - the vert.x instanceaddress - the address on the event bus where the auth service is listeningpublic AuthService login(JsonObject principal, JsonObject credentials, Handler<AsyncResult<String>> resultHandler)
principal - represents the unique id (e.g. username) of the user being logged incredentials - the credentials - e.g. passwordresultHandler - will be passed a failed result if login failed or will be passed a succeeded result containing the login ID (a string) if login was successful.public rx.Observable<String> loginObservable(JsonObject principal, JsonObject credentials)
principal - represents the unique id (e.g. username) of the user being logged incredentials - the credentials - e.g. passwordpublic AuthService loginWithTimeout(JsonObject principal, JsonObject credentials, long timeout, Handler<AsyncResult<String>> resultHandler)
principal - represents the unique id (e.g. username) of the user being logged incredentials - the credentialstimeout - the login timeout to use, in msresultHandler - will be passed a failed result if login failed or will be passed a succeeded result containing the login ID (a string) if login was successful.public rx.Observable<String> loginWithTimeoutObservable(JsonObject principal, JsonObject credentials, long timeout)
principal - represents the unique id (e.g. username) of the user being logged incredentials - the credentialstimeout - the login timeout to use, in mspublic AuthService logout(String loginID, Handler<AsyncResult<Void>> resultHandler)
loginID - the login ID as provided by login(io.vertx.core.json.JsonObject, io.vertx.core.json.JsonObject, io.vertx.core.Handler<io.vertx.core.AsyncResult<java.lang.String>>).resultHandler - will be called with success or failurepublic rx.Observable<Void> logoutObservable(String loginID)
loginID - the login ID as provided by login(io.vertx.core.json.JsonObject, io.vertx.core.json.JsonObject, io.vertx.core.Handler<io.vertx.core.AsyncResult<java.lang.String>>).public AuthService refreshLoginSession(String loginID, Handler<AsyncResult<Void>> resultHandler)
loginID - the login ID as provided by login(io.vertx.core.json.JsonObject, io.vertx.core.json.JsonObject, io.vertx.core.Handler<io.vertx.core.AsyncResult<java.lang.String>>).resultHandler - will be called with success or failurepublic rx.Observable<Void> refreshLoginSessionObservable(String loginID)
loginID - the login ID as provided by login(io.vertx.core.json.JsonObject, io.vertx.core.json.JsonObject, io.vertx.core.Handler<io.vertx.core.AsyncResult<java.lang.String>>).public AuthService hasRole(String loginID, String role, Handler<AsyncResult<Boolean>> resultHandler)
loginID - the login ID as provided by login(io.vertx.core.json.JsonObject, io.vertx.core.json.JsonObject, io.vertx.core.Handler<io.vertx.core.AsyncResult<java.lang.String>>).role - the roleresultHandler - will be called with the result - true if has role, false if notpublic rx.Observable<Boolean> hasRoleObservable(String loginID, String role)
loginID - the login ID as provided by login(io.vertx.core.json.JsonObject, io.vertx.core.json.JsonObject, io.vertx.core.Handler<io.vertx.core.AsyncResult<java.lang.String>>).role - the rolepublic AuthService hasRoles(String loginID, Set<String> roles, Handler<AsyncResult<Boolean>> resultHandler)
loginID - the login ID as provided by login(io.vertx.core.json.JsonObject, io.vertx.core.json.JsonObject, io.vertx.core.Handler<io.vertx.core.AsyncResult<java.lang.String>>).roles - the set of rolesresultHandler - will be called with the result - true if has roles, false if notpublic rx.Observable<Boolean> hasRolesObservable(String loginID, Set<String> roles)
loginID - the login ID as provided by login(io.vertx.core.json.JsonObject, io.vertx.core.json.JsonObject, io.vertx.core.Handler<io.vertx.core.AsyncResult<java.lang.String>>).roles - the set of rolespublic AuthService hasPermission(String loginID, String permission, Handler<AsyncResult<Boolean>> resultHandler)
loginID - the login ID as provided by login(io.vertx.core.json.JsonObject, io.vertx.core.json.JsonObject, io.vertx.core.Handler<io.vertx.core.AsyncResult<java.lang.String>>).permission - the permissionresultHandler - will be called with the result - true if has permission, false if notpublic rx.Observable<Boolean> hasPermissionObservable(String loginID, String permission)
loginID - the login ID as provided by login(io.vertx.core.json.JsonObject, io.vertx.core.json.JsonObject, io.vertx.core.Handler<io.vertx.core.AsyncResult<java.lang.String>>).permission - the permissionpublic AuthService hasPermissions(String loginID, Set<String> permissions, Handler<AsyncResult<Boolean>> resultHandler)
loginID - the login ID as provided by login(io.vertx.core.json.JsonObject, io.vertx.core.json.JsonObject, io.vertx.core.Handler<io.vertx.core.AsyncResult<java.lang.String>>).permissions - the set of permissionsresultHandler - will be called with the result - true if has permissions, false if notpublic rx.Observable<Boolean> hasPermissionsObservable(String loginID, Set<String> permissions)
loginID - the login ID as provided by login(io.vertx.core.json.JsonObject, io.vertx.core.json.JsonObject, io.vertx.core.Handler<io.vertx.core.AsyncResult<java.lang.String>>).permissions - the set of permissionspublic AuthService setReaperPeriod(long reaperPeriod)
reaperPeriod - the reaper period, in mspublic void start()
public void stop()
public static AuthService newInstance(AuthService arg)
Copyright © 2015. All Rights Reserved.