java.lang.Object
com.amazon.A3L.authentication.api.client.extensions.fos.auth.FOSAccountCredential
All Implemented Interfaces:
com.google.api.client.http.HttpRequestInitializer, com.google.api.client.http.HttpUnsuccessfulResponseHandler

public class FOSAccountCredential extends Object implements com.google.api.client.http.HttpRequestInitializer, com.google.api.client.http.HttpUnsuccessfulResponseHandler
FOSAccountCredential class uses a credential to provide access to Google API Client libraries
  • Constructor Details

    • FOSAccountCredential

      public FOSAccountCredential(Context context, String scope)
      Default constructor for FOSAccountCredential.
      Parameters:
      context - - A Context * used to provide information about the application's environment.
      scope - - the scope for the
  • Method Details

    • usingOAuth2

      public static FOSAccountCredential usingOAuth2(Context context, Collection<String> scopes)
      Static method which can be used to create an instance of new FOSAccountCredential
      Parameters:
      context - : A Context * * used to provide information about the application's environment.
      scopes - : Collection of OAuth 2.0 scope list which are authorized during sign-in
      Returns:
      FOSAccountCredential
    • setSelectedAccount

      public FOSAccountCredential setSelectedAccount(Account account)
      Method to set the current account, it checks if the account passed is the same as the signed in account
      Parameters:
      account - : Account which is signed in.
      Returns:
      FOSAccountCredential
    • setSelectedAccountName

      public FOSAccountCredential setSelectedAccountName(String accountName)
      Method to set the selected account name, it checks if the account name is same as the signed in account name
      Parameters:
      accountName - : name of the account which is signed in
      Returns:
      FOSAccountCredential
    • getContext

      public final Context getContext()
      Getter for context
      Returns:
      Context
    • getScope

      public final String getScope()
      Getter for scope
      Returns:
      String - containing list of all the provided OAuth 2.0 scopes which are part of granted scopes
    • getAllAccounts

      public final Account[] getAllAccounts()
      Method to return the current account which is signed in
      Returns:
      Account[] - a list containing only the current signed in account
    • getSelectedAccount

      public final Account getSelectedAccount()
      Method to return the current account which is signed in
      Returns:
      Account - the current signed in account
    • getBackOff

      public com.google.api.client.util.BackOff getBackOff()
      Method for getting the BackOff value. It is a no-op method.
      Returns:
      BackOff
    • setBackOff

      public FOSAccountCredential setBackOff(com.google.api.client.util.BackOff backOff)
      Method for setting the BackOff value. It is a no-op method.
      Parameters:
      backOff -
      Returns:
      FOSAccountCredential
    • getSleeper

      public final com.google.api.client.util.Sleeper getSleeper()
      Getter for Sleeper. It is a no-op method.
      Returns:
      Sleeper
    • setSleeper

      public final FOSAccountCredential setSleeper(com.google.api.client.util.Sleeper sleeper)
      Method for setting sleeper value. It is a no-op method.
      Parameters:
      sleeper -
      Returns:
      FOSAccountCredential
    • getSelectedAccountName

      public final String getSelectedAccountName()
      It returns the account name if the selected account name was the same as signed in account
      Returns:
      String - the account name
    • getToken

      public String getToken()
      method to get the current access_token
      Returns:
      String
    • initialize

      public void initialize(com.google.api.client.http.HttpRequest request) throws IOException
      Initializes a http request prior to execution
      Specified by:
      initialize in interface com.google.api.client.http.HttpRequestInitializer
      Parameters:
      request - : HTTP request
      Throws:
      IOException
    • handleResponse

      public boolean handleResponse(com.google.api.client.http.HttpRequest request, com.google.api.client.http.HttpResponse response, boolean supportsRetry)
      Handler method which is invoked in case of unsuccessful response.
      Specified by:
      handleResponse in interface com.google.api.client.http.HttpUnsuccessfulResponseHandler
      Parameters:
      request - : Request object that can be read from for context or modified before retry
      response - : Response to process
      supportsRetry - : Boolean
      Returns:
      Boolean