Interface AuthManager

All Known Implementing Classes:
BusinessAccountAuthManager, PersonalAccountAuthManager

public interface AuthManager
The interface that defines the manager that is responsible for obtaining and refreshing tokens to interact with a OneDrive account. Note: This does not manage the initial stages of the OAUTH request flow and instead relies on a provided auth code or a pre-existing refresh token.
  • Field Details

  • Method Details

    • isAuthenticated

      boolean isAuthenticated()
      Determines if the current authentication information is up-to-date.
      Returns:
      true if authenticated; else, false
    • isExpired

      boolean isExpired()
      Determines if the current authentication information is expired.
      Returns:
      true if expired; else, false
    • refreshIfExpired

      default void refreshIfExpired()
      Checks to see if the current authentication info is expired and refreshes the tokens accordingly.
    • refreshIfExpiredAndFetchFullToken

      default String refreshIfExpiredAndFetchFullToken()
      Helper method to refresh authentication if expired and return the full token used in request headers.
      Returns:
      the full auth token
    • getAuthInfo

      AuthInfo getAuthInfo()
      Retrieves the current authentication info.
      Returns:
      the authentication info
      See Also:
    • getAuthenticatedEndpoint

      String getAuthenticatedEndpoint()
      Retrieves the associated endpoint to use for OneDrive operations.
    • redeemToken

      AuthInfo redeemToken(String authCode)
      Issues a request to redeem the given authCode in order to retrieve access and refresh tokens as a AuthInfo.
      Parameters:
      authCode - the authorization code
      Returns:
      the authorization information
      See Also:
    • refreshToken

      AuthInfo refreshToken()
      Issues a request to refresh the auth tokens and returns the refreshed tokens as a AuthInfo.
      Returns:
      the authorization information
      See Also:
    • fetchAuthInfo

      static AuthInfo fetchAuthInfo(okhttp3.OkHttpClient httpClient, okhttp3.Request request)
      Helper method to dispatch the request to redeem or refresh authorization tokens.
      Parameters:
      httpClient - the http client
      request - the request
      Returns:
      the authorization information