public class BoxOAuth extends Object implements Authentication
| Modifier and Type | Field and Description |
|---|---|
OAuthConfig |
config
Configuration object of OAuth.
|
TokenStorage |
tokenStorage
An object responsible for storing token.
|
| Constructor and Description |
|---|
BoxOAuth(OAuthConfig config) |
| Modifier and Type | Method and Description |
|---|---|
AccessToken |
downscopeToken(List<String> scopes,
String resource,
String sharedLink,
NetworkSession networkSession)
Downscope access token to the provided scopes.
|
String |
getAuthorizeUrl()
Get the authorization URL for the app user.
|
String |
getAuthorizeUrl(GetAuthorizeUrlOptions options)
Get the authorization URL for the app user.
|
AccessToken |
getTokensAuthorizationCodeGrant(String authorizationCode)
Acquires token info using an authorization code.
|
AccessToken |
getTokensAuthorizationCodeGrant(String authorizationCode,
NetworkSession networkSession)
Acquires token info using an authorization code.
|
TokenStorage |
getTokenStorage() |
AccessToken |
refreshToken()
Get a new access token for the platform app user.
|
AccessToken |
refreshToken(NetworkSession networkSession)
Get a new access token for the platform app user.
|
String |
retrieveAuthorizationHeader() |
String |
retrieveAuthorizationHeader(NetworkSession networkSession) |
AccessToken |
retrieveToken()
Get the current access token.
|
AccessToken |
retrieveToken(NetworkSession networkSession)
Get the current access token.
|
void |
revokeToken()
Revoke an active Access Token, effectively logging a user out that has been previously
authenticated.
|
void |
revokeToken(NetworkSession networkSession)
Revoke an active Access Token, effectively logging a user out that has been previously
authenticated.
|
public final OAuthConfig config
public final TokenStorage tokenStorage
public BoxOAuth(OAuthConfig config)
public String getAuthorizeUrl()
public String getAuthorizeUrl(GetAuthorizeUrlOptions options)
options - The options parameterpublic AccessToken getTokensAuthorizationCodeGrant(String authorizationCode)
authorizationCode - The authorization code to use to get tokens.public AccessToken getTokensAuthorizationCodeGrant(String authorizationCode, NetworkSession networkSession)
authorizationCode - The authorization code to use to get tokens.networkSession - An object to keep network session statepublic AccessToken retrieveToken()
retrieveToken in interface Authenticationpublic AccessToken retrieveToken(NetworkSession networkSession)
retrieveToken in interface AuthenticationnetworkSession - An object to keep network session statepublic AccessToken refreshToken()
refreshToken in interface Authenticationpublic AccessToken refreshToken(NetworkSession networkSession)
refreshToken in interface AuthenticationnetworkSession - An object to keep network session statepublic String retrieveAuthorizationHeader()
retrieveAuthorizationHeader in interface Authenticationpublic String retrieveAuthorizationHeader(NetworkSession networkSession)
retrieveAuthorizationHeader in interface Authenticationpublic void revokeToken()
revokeToken in interface Authenticationpublic void revokeToken(NetworkSession networkSession)
revokeToken in interface AuthenticationnetworkSession - An object to keep network session statepublic AccessToken downscopeToken(List<String> scopes, String resource, String sharedLink, NetworkSession networkSession)
downscopeToken in interface Authenticationscopes - The scope(s) to apply to the resulting token.resource - The file or folder to get a downscoped token for. If None and shared_link None,
the resulting token will not be scoped down to just a single item. The resource should be a
full URL to an item, e.g. https://api.box.com/2.0/files/123456.sharedLink - The shared link to get a downscoped token for. If None and item None, the
resulting token will not be scoped down to just a single item.networkSession - An object to keep network session statepublic TokenStorage getTokenStorage()