com.google.api.client.auth.oauth2
Interface CredentialStore

All Known Implementing Classes:
MemoryCredentialStore

public interface CredentialStore

OAuth 2.0 credential persistence store interface to provide a fully pluggable storage mechanism.

The user ID should be used as the primary key for storage, and the rest of the data consists of the access token, refresh token, and expiration time.

Implementations should be thread safe.

Since:
1.7
Author:
Yaniv Inbar

Method Summary
 void delete(String userId, Credential credential)
          Deletes the credential of the given user ID.
 boolean load(String userId, Credential credential)
          Loads the credential for the given user ID.
 void store(String userId, Credential credential)
          Stores the credential of the given user ID.
 

Method Detail

load

boolean load(String userId,
             Credential credential)
             throws IOException
Loads the credential for the given user ID.

Upgrade warning: since version 1.10 this method throws an IOException. This was not done prior to 1.10.

Parameters:
userId - user ID whose credential needs to be loaded
credential - credential whose access token, refresh token, and expiration time need to be set if the credential already exists in storage
Returns:
true if the credential has been successfully found and loaded or false otherwise
Throws:
IOException

store

void store(String userId,
           Credential credential)
           throws IOException
Stores the credential of the given user ID.

Upgrade warning: since version 1.10 this method throws an IOException. This was not done prior to 1.10.

Parameters:
userId - user ID whose credential needs to be stored
credential - credential whose access token, refresh token, and expiration time need to be stored
Throws:
IOException

delete

void delete(String userId,
            Credential credential)
            throws IOException
Deletes the credential of the given user ID.

Upgrade warning: since version 1.10 this method throws an IOException. This was not done prior to 1.10.

Parameters:
userId - user ID whose credential needs to be deleted
credential - credential to be deleted
Throws:
IOException


Copyright © 2011-2012 Google. All Rights Reserved.