Interface OneDriveAuthManager
- All Superinterfaces:
com.amilesend.client.connection.auth.AuthManager<OneDriveAuthInfo>
- All Known Implementing Classes:
BusinessAccountAuthManager
,PersonalAccountAuthManager
public interface OneDriveAuthManager
extends com.amilesend.client.connection.auth.AuthManager<OneDriveAuthInfo>
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 Summary
Fields -
Method Summary
Modifier and TypeMethodDescriptiondefault okhttp3.Request.Builder
addAuthentication
(okhttp3.Request.Builder requestBuilder) static OneDriveAuthInfo
fetchAuthInfo
(okhttp3.OkHttpClient httpClient, okhttp3.Request request) Helper method to dispatch the request to redeem or refresh authorization tokens.Retrieves the associated endpoint to use for OneDrive operations.boolean
Determines if the current authentication information is expired.redeemToken
(String authCode) Issues a request to redeem the givenauthCode
in order to retrieve access and refresh tokens as aOneDriveAuthInfo
.default void
Checks to see if the current authentication info is expired and refreshes the tokens accordingly.default String
Helper method to refresh authentication if expired and return the full token used in request headers.Issues a request to refresh the auth tokens and returns the refreshed tokens as aOneDriveAuthInfo
.Methods inherited from interface com.amilesend.client.connection.auth.AuthManager
getAuthInfo, isAuthenticated
-
Field Details
-
AUTH_TOKEN_URL
- See Also:
-
FORM_DATA_CONTENT_TYPE
-
CLIENT_ID_BODY_PARAM
- See Also:
-
CLIENT_SECRET_BODY_PARAM
- See Also:
-
REDIRECT_URI_BODY_PARAM
- See Also:
-
AUTH_CODE_BODY_ARAM
- See Also:
-
REFRESH_TOKEN_BODY_PARAM
- See Also:
-
GRANT_TYPE_BODY_PARAM
- See Also:
-
AUTH_CODE_GRANT_TYPE_BODY_PARAM_VALUE
- See Also:
-
REFRESH_TOKEN_GRANT_TYPE_BODY_PARAM_VALUE
- See Also:
-
-
Method Details
-
addAuthentication
default okhttp3.Request.Builder addAuthentication(okhttp3.Request.Builder requestBuilder) - Specified by:
addAuthentication
in interfacecom.amilesend.client.connection.auth.AuthManager<OneDriveAuthInfo>
-
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
Helper method to refresh authentication if expired and return the full token used in request headers.- Returns:
- the full auth token
-
getAuthenticatedEndpoint
String getAuthenticatedEndpoint()Retrieves the associated endpoint to use for OneDrive operations. -
redeemToken
Issues a request to redeem the givenauthCode
in order to retrieve access and refresh tokens as aOneDriveAuthInfo
.- Parameters:
authCode
- the authorization code- Returns:
- the authorization information
- See Also:
-
refreshToken
OneDriveAuthInfo refreshToken()Issues a request to refresh the auth tokens and returns the refreshed tokens as aOneDriveAuthInfo
.- Returns:
- the authorization information
- See Also:
-
fetchAuthInfo
Helper method to dispatch the request to redeem or refresh authorization tokens.- Parameters:
httpClient
- the http clientrequest
- the request- Returns:
- the authorization information
-