AeroGear Android Library 1.1.0

org.jboss.aerogear.android.authentication
Interface AuthenticationModule

All Known Subinterfaces:
LoaderAuthenticationModule
All Known Implementing Classes:
AbstractAuthenticationModule, AGSecurityAuthenticationModule, AuthenticationModuleAdapter, HttpBasicAuthenticationModule, HttpDigestAuthenticationModule, SupportAuthenticationModuleAdapter

public interface AuthenticationModule

A module which can authenticate a user. It also provides the necessary tools to log a user in, out, and modify requests from a Pipe so they are seen as authenticated.


Method Summary
 void enroll(Map<String,String> userData, Callback<HeaderAndBody> callback)
          Will try to register a user with a service using userData.
 AuthorizationFields getAuthorizationFields()
          Deprecated. This method has been superseded by getAuthorizationFields(java.net.URI, String, byte[])
 AuthorizationFields getAuthorizationFields(URI requestUri, String method, byte[] requestBody)
          This method is called be Pipe implementations when they need security applied to their HttpProvider.
 URL getBaseURL()
           
 String getEnrollEndpoint()
           
 String getLoginEndpoint()
           
 String getLogoutEndpoint()
           
 boolean isLoggedIn()
           
 void login(String username, String password, Callback<HeaderAndBody> callback)
          Will try to log in a user using username and password.
 void logout(Callback<Void> callback)
          Performs a logout of the current user.
 boolean retryLogin()
          Some authorization schemes (HTTP Digest, OAUTH) have a mechanism for retrying a login to fetch fresh credentials after the credentials expire.
 

Method Detail

getBaseURL

URL getBaseURL()

getLoginEndpoint

String getLoginEndpoint()

getLogoutEndpoint

String getLogoutEndpoint()

getEnrollEndpoint

String getEnrollEndpoint()

enroll

void enroll(Map<String,String> userData,
            Callback<HeaderAndBody> callback)
Will try to register a user with a service using userData.

It will call the callbacks onSuccess with a parameter of a Map of the values returned by the enroll service or onFailure if there is an error

Parameters:
userData -
callback -

login

void login(String username,
           String password,
           Callback<HeaderAndBody> callback)
Will try to log in a user using username and password.

It will call the callbacks onSuccess with a parameter of a Map of the values returned by the enroll service or onFailure if there is an error

Parameters:
username -
password -
callback -

logout

void logout(Callback<Void> callback)
Performs a logout of the current user.

It will call callback.onSuccess with no value on success and callback.onFailure if there is an error.

Parameters:
callback -

isLoggedIn

boolean isLoggedIn()
Returns:
true if the module has been logged in successfully

getAuthorizationFields

@Deprecated
AuthorizationFields getAuthorizationFields()
Deprecated. This method has been superseded by getAuthorizationFields(java.net.URI, String, byte[])

This method is called be Pipe implementations when they need security applied to their HttpProvider. The headers/data/query parameters returned should be applied to the Url and HttpProvider directly before a call.

Returns:
the current AuthorizationFields for security

getAuthorizationFields

AuthorizationFields getAuthorizationFields(URI requestUri,
                                           String method,
                                           byte[] requestBody)
This method is called be Pipe implementations when they need security applied to their HttpProvider. The headers/data/query parameters returned should be applied to the Url and HttpProvider directly before a call.

Parameters:
requestUri - the Request-Line URI.
method - the HTTP method being used
requestBody - the body of the request. This method promises to not modify the body.
Returns:
the current AuthorizationFields for security

retryLogin

boolean retryLogin()
                   throws HttpException
Some authorization schemes (HTTP Digest, OAUTH) have a mechanism for retrying a login to fetch fresh credentials after the credentials expire. In the event of a 401 error, this method should retry the login. If the system does not support retrying or if the retry fails then it will return false. Otherwise it returns true and refreshes the various credentials. This method is blocking and it should NOT be called by the user directly.

Returns:
whether or not retrying the login succeeded.
Throws:
HttpException

AeroGear Android Library 1.1.0

Copyright © 2013 JBoss by Red Hat. All Rights Reserved.