public class BoxCCGAuth extends Object implements Authentication
| Modifier and Type | Field and Description |
|---|---|
CCGConfig |
config
Configuration object of Client Credentials Grant auth.
|
String |
subjectId
The ID of the user or enterprise to authenticate as.
|
EnumWrapper<PostOAuth2TokenBoxSubjectTypeField> |
subjectType
The type of the subject ID provided.
|
TokenStorage |
tokenStorage
An object responsible for storing token.
|
| Constructor and Description |
|---|
BoxCCGAuth(CCGConfig 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.
|
TokenStorage |
getTokenStorage() |
AccessToken |
refreshToken()
Get a new access token using CCG auth
|
AccessToken |
refreshToken(NetworkSession networkSession)
Get a new access token using CCG auth
|
String |
retrieveAuthorizationHeader() |
String |
retrieveAuthorizationHeader(NetworkSession networkSession) |
AccessToken |
retrieveToken()
Return a current token or get a new one when not available.
|
AccessToken |
retrieveToken(NetworkSession networkSession)
Return a current token or get a new one when not available.
|
void |
revokeToken()
Revoke the current access token and remove it from token storage.
|
void |
revokeToken(NetworkSession networkSession)
Revoke the current access token and remove it from token storage.
|
BoxCCGAuth |
withEnterpriseSubject(String enterpriseId)
Create a new BoxCCGAuth instance that uses the provided enterprise ID as the subject ID.
|
BoxCCGAuth |
withEnterpriseSubject(String enterpriseId,
TokenStorage tokenStorage)
Create a new BoxCCGAuth instance that uses the provided enterprise ID as the subject ID.
|
BoxCCGAuth |
withUserSubject(String userId)
Create a new BoxCCGAuth instance that uses the provided user ID as the subject ID.
|
BoxCCGAuth |
withUserSubject(String userId,
TokenStorage tokenStorage)
Create a new BoxCCGAuth instance that uses the provided user ID as the subject ID.
|
public final TokenStorage tokenStorage
public String subjectId
public EnumWrapper<PostOAuth2TokenBoxSubjectTypeField> subjectType
public BoxCCGAuth(CCGConfig config)
public AccessToken refreshToken()
refreshToken in interface Authenticationpublic AccessToken refreshToken(NetworkSession networkSession)
refreshToken in interface AuthenticationnetworkSession - 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 String retrieveAuthorizationHeader()
retrieveAuthorizationHeader in interface Authenticationpublic String retrieveAuthorizationHeader(NetworkSession networkSession)
retrieveAuthorizationHeader in interface Authenticationpublic BoxCCGAuth withUserSubject(String userId)
userId - The id of the user to authenticatepublic BoxCCGAuth withUserSubject(String userId, TokenStorage tokenStorage)
userId - The id of the user to authenticatetokenStorage - Object responsible for storing token in newly created BoxCCGAuth. If no
custom implementation provided, the token will be stored in memory.public BoxCCGAuth withEnterpriseSubject(String enterpriseId)
enterpriseId - The id of the enterprise to authenticatepublic BoxCCGAuth withEnterpriseSubject(String enterpriseId, TokenStorage tokenStorage)
enterpriseId - The id of the enterprise to authenticatetokenStorage - Object responsible for storing token in newly created BoxCCGAuth. If no
custom implementation provided, the token will be stored in memory.public 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 void revokeToken()
revokeToken in interface Authenticationpublic void revokeToken(NetworkSession networkSession)
revokeToken in interface AuthenticationnetworkSession - An object to keep network session statepublic TokenStorage getTokenStorage()