public class HttpBasicAuthenticationModule extends AbstractAuthenticationModule
Pipe requests. This
module assumes that credentials provided are valid and will never fail on login(java.lang.String, java.lang.String, org.jboss.aerogear.android.core.Callback) or
logout(org.jboss.aerogear.android.core.Callback).
enroll(java.util.Map, org.jboss.aerogear.android.core.Callback) is not
supported and will always fail.PASSWORD_PARAMETER_NAME, THREAD_POOL_EXECUTOR, USERNAME_PARAMETER_NAME| Constructor and Description |
|---|
HttpBasicAuthenticationModule(URL baseURL) |
| Modifier and Type | Method and Description |
|---|---|
void |
enroll(Map<String,String> userData,
org.jboss.aerogear.android.core.Callback<org.jboss.aerogear.android.pipe.http.HeaderAndBody> callback)
Enrolling is not supported using http basic.
|
URL |
getBaseURL() |
String |
getEnrollEndpoint() |
String |
getLoginEndpoint() |
String |
getLogoutEndpoint() |
boolean |
handleError(org.jboss.aerogear.android.pipe.http.HttpException exception) |
boolean |
isLoggedIn() |
org.jboss.aerogear.android.pipe.module.ModuleFields |
loadModule(URI relativeURI,
String httpMethod,
byte[] requestBody) |
void |
login(Map<String,String> loginData,
org.jboss.aerogear.android.core.Callback<org.jboss.aerogear.android.pipe.http.HeaderAndBody> callback)
This will log in the user using the keys "loginName" and "password".
|
void |
login(String username,
String password,
org.jboss.aerogear.android.core.Callback<org.jboss.aerogear.android.pipe.http.HeaderAndBody> callback)
This method stores username and password.
|
void |
logout(org.jboss.aerogear.android.core.Callback<Void> callback)
This method clears the username and password from the module, sets
isLoggedIn to false, and removes all cookies associated with
baseURL
This method always calls Callback.onSuccess(java.lang.Object) |
public HttpBasicAuthenticationModule(URL baseURL)
baseURL - The base URL shared by a Pipe.public URL getBaseURL()
public String getLoginEndpoint()
public String getLogoutEndpoint()
public String getEnrollEndpoint()
public boolean isLoggedIn()
public void login(String username, String password, org.jboss.aerogear.android.core.Callback<org.jboss.aerogear.android.pipe.http.HeaderAndBody> callback)
isLoggedIn to true and calls immediately * .login in interface AuthenticationModulelogin in class AbstractAuthenticationModuleusername - the username of the userpassword - the password of the usercallback - a callback to handle the result.public void logout(org.jboss.aerogear.android.core.Callback<Void> callback)
baseURL
This method always calls Callback.onSuccess(java.lang.Object)logout in interface AuthenticationModulelogout in class AbstractAuthenticationModulecallback - the callback whose onsuccess method will be executedpublic void enroll(Map<String,String> userData, org.jboss.aerogear.android.core.Callback<org.jboss.aerogear.android.pipe.http.HeaderAndBody> callback)
Callback.onFailure(java.lang.Exception) and pass
it a UnsupportedOperationException.enroll in interface AuthenticationModuleenroll in class AbstractAuthenticationModuleuserData - this value is ignored.callback - the callback to be calledpublic void login(Map<String,String> loginData, org.jboss.aerogear.android.core.Callback<org.jboss.aerogear.android.pipe.http.HeaderAndBody> callback)
loginData - a map of data which will be passed to the servercallback - a callback which will handle the server response.public org.jboss.aerogear.android.pipe.module.ModuleFields loadModule(URI relativeURI, String httpMethod, byte[] requestBody)
public boolean handleError(org.jboss.aerogear.android.pipe.http.HttpException exception)
Copyright © 2016 JBoss by Red Hat. All rights reserved.