com.android.volley.toolbox
Class AndroidAuthenticator

java.lang.Object
  extended by com.android.volley.toolbox.AndroidAuthenticator
All Implemented Interfaces:
Authenticator

public class AndroidAuthenticator
extends Object
implements Authenticator

An Authenticator that uses AccountManager to get auth tokens of a specified type for a specified account.


Constructor Summary
AndroidAuthenticator(Context context, Account account, String authTokenType)
          Creates a new authenticator.
AndroidAuthenticator(Context context, Account account, String authTokenType, boolean notifyAuthFailure)
          Creates a new authenticator.
 
Method Summary
 Account getAccount()
          Returns the Account being used by this authenticator.
 String getAuthToken()
          Synchronously retrieves an auth token.
 void invalidateAuthToken(String authToken)
          Invalidates the provided auth token.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

AndroidAuthenticator

public AndroidAuthenticator(Context context,
                            Account account,
                            String authTokenType)
Creates a new authenticator.

Parameters:
context - Context for accessing AccountManager
account - Account to authenticate as
authTokenType - Auth token type passed to AccountManager

AndroidAuthenticator

public AndroidAuthenticator(Context context,
                            Account account,
                            String authTokenType,
                            boolean notifyAuthFailure)
Creates a new authenticator.

Parameters:
context - Context for accessing AccountManager
account - Account to authenticate as
authTokenType - Auth token type passed to AccountManager
notifyAuthFailure - Whether to raise a notification upon auth failure
Method Detail

getAccount

public Account getAccount()
Returns the Account being used by this authenticator.


getAuthToken

public String getAuthToken()
                    throws AuthFailureError
Description copied from interface: Authenticator
Synchronously retrieves an auth token.

Specified by:
getAuthToken in interface Authenticator
Throws:
AuthFailureError - If authentication did not succeed

invalidateAuthToken

public void invalidateAuthToken(String authToken)
Description copied from interface: Authenticator
Invalidates the provided auth token.

Specified by:
invalidateAuthToken in interface Authenticator