AeroGear Android Libary 1.0.0.M1

org.jboss.aerogear.android.authentication.impl
Class AGSecurityAuthenticationModule

java.lang.Object
  extended by org.jboss.aerogear.android.authentication.AbstractAuthenticationModule
      extended by org.jboss.aerogear.android.authentication.impl.AGSecurityAuthenticationModule
All Implemented Interfaces:
AuthenticationModule

public final class AGSecurityAuthenticationModule
extends AbstractAuthenticationModule

A module for authenticating with restful AG services.

See Also:
AG Security Endpoint Doc

Constructor Summary
AGSecurityAuthenticationModule(URL baseURL, AuthenticationConfig config)
           
 
Method Summary
 void enroll(Map<String,String> userData, Callback<HeaderAndBody> callback)
          Will try to register a user with a service using userData.
 AuthorizationFields getAuthorizationFields()
          This method is called be Pipe implementations when they need security applied to their HttpProvider.
protected  String getAuthToken()
           
 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.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

AGSecurityAuthenticationModule

public AGSecurityAuthenticationModule(URL baseURL,
                                      AuthenticationConfig config)
Parameters:
baseURL -
config -
Throws:
IllegalArgumentException - if an endpoint can not be appended to baseURL
Method Detail

getBaseURL

public URL getBaseURL()

getLoginEndpoint

public String getLoginEndpoint()

getLogoutEndpoint

public String getLogoutEndpoint()

getEnrollEndpoint

public String getEnrollEndpoint()

enroll

public void enroll(Map<String,String> userData,
                   Callback<HeaderAndBody> callback)
Description copied from interface: AuthenticationModule
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

Specified by:
enroll in interface AuthenticationModule
Overrides:
enroll in class AbstractAuthenticationModule

login

public void login(String username,
                  String password,
                  Callback<HeaderAndBody> callback)
Description copied from interface: AuthenticationModule
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

Specified by:
login in interface AuthenticationModule
Overrides:
login in class AbstractAuthenticationModule

logout

public void logout(Callback<Void> callback)
Description copied from interface: AuthenticationModule
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.

Specified by:
logout in interface AuthenticationModule
Overrides:
logout in class AbstractAuthenticationModule

isLoggedIn

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

getAuthToken

protected String getAuthToken()

getAuthorizationFields

public AuthorizationFields getAuthorizationFields()
Description copied from interface: AuthenticationModule
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

AeroGear Android Libary 1.0.0.M1

Copyright © 2012 JBoss, a division of Red Hat, Inc.. All Rights Reserved.