public class ClientManager
extends java.lang.Object
Modifier and Type | Class and Description |
---|---|
static class |
ClientManager.AccMgrAuthTokenProvider
AuthTokenProvider implementation that calls out to the AccountManager to get a new access token.
|
static class |
ClientManager.AccountInfoNotFoundException
Exception thrown when no account could be found (during a
peekRestClient call) |
static class |
ClientManager.LoginOptions
Class encapsulating login options.
|
static interface |
ClientManager.RestClientCallback
RestClientCallback interface.
|
Modifier and Type | Field and Description |
---|---|
static java.lang.String |
ACCESS_TOKEN_REFRESH_INTENT |
static java.lang.String |
ACCESS_TOKEN_REVOKE_INTENT |
static java.lang.String |
INSTANCE_URL_UPDATE_INTENT |
Constructor and Description |
---|
ClientManager(Context ctx,
java.lang.String accountType,
ClientManager.LoginOptions loginOptions,
boolean revokedTokenShouldLogout)
Construct a ClientManager using a custom account type.
|
Modifier and Type | Method and Description |
---|---|
Bundle |
createNewAccount(java.lang.String accountName,
java.lang.String username,
java.lang.String refreshToken,
java.lang.String authToken,
java.lang.String instanceUrl,
java.lang.String loginUrl,
java.lang.String idUrl,
java.lang.String clientId,
java.lang.String orgId,
java.lang.String userId,
java.lang.String communityId,
java.lang.String communityUrl,
java.lang.String firstName,
java.lang.String lastName,
java.lang.String displayName,
java.lang.String email,
java.lang.String photoUrl,
java.lang.String thumbnailUrl,
java.util.Map<java.lang.String,java.lang.String> additionalOauthValues,
java.lang.String lightningDomain,
java.lang.String lightningSid,
java.lang.String vfDomain,
java.lang.String vfSid,
java.lang.String contentDomain,
java.lang.String contentSid,
java.lang.String csrfToken,
java.lang.Boolean nativeLogin,
java.lang.String language,
java.lang.String locale)
Deprecated.
|
Bundle |
createNewAccount(UserAccount userAccount)
Creates a new account and returns the parameters as a Bundle.
|
Account |
getAccount()
Returns the user account that is currently active.
|
Account |
getAccountByName(java.lang.String name) |
AccountManager |
getAccountManager() |
Account[] |
getAccounts() |
java.lang.String |
getAccountType()
Should match the value in authenticator.xml.12
|
void |
getRestClient(Activity activityContext,
ClientManager.RestClientCallback restClientCallback)
Method to create a RestClient asynchronously.
|
void |
getUnauthenticatedRestClient(Activity activityContext,
ClientManager.RestClientCallback restClientCallback)
Method to created an unauthenticated RestClient asynchronously
|
void |
invalidateToken(java.lang.String lastNewAuthToken)
Invalidate current auth token.
|
RestClient |
peekRestClient() |
RestClient |
peekRestClient(Account acc) |
RestClient |
peekRestClient(UserAccount user)
Method to create RestClient synchronously.
|
RestClient |
peekUnauthenticatedRestClient()
Method to create an unauthenticated RestClient.
|
void |
removeAccount(Account acc)
Removes the user account from the account manager.
|
void |
removeAccounts(Account[] accounts)
Remove all of the accounts passed in.
|
public static final java.lang.String ACCESS_TOKEN_REVOKE_INTENT
public static final java.lang.String ACCESS_TOKEN_REFRESH_INTENT
public static final java.lang.String INSTANCE_URL_UPDATE_INTENT
public ClientManager(Context ctx, java.lang.String accountType, ClientManager.LoginOptions loginOptions, boolean revokedTokenShouldLogout)
ctx
- Context.accountType
- Account type.loginOptions
- Login options.revokedTokenShouldLogout
- True - if the SDK should logout when the access token is revoked, False - otherwise.public void getRestClient(Activity activityContext, ClientManager.RestClientCallback restClientCallback)
activityContext
- current activityrestClientCallback
- callback invoked once the RestClient is readyAuthenticatorService
public void getUnauthenticatedRestClient(Activity activityContext, ClientManager.RestClientCallback restClientCallback)
activityContext
- restClientCallback
- public RestClient peekUnauthenticatedRestClient()
public RestClient peekRestClient()
public RestClient peekRestClient(UserAccount user)
public RestClient peekRestClient(Account acc)
public void invalidateToken(java.lang.String lastNewAuthToken)
getRestClient
will do a refresh.public Account getAccount()
public Account getAccountByName(java.lang.String name)
name
- The name associated with the account.public Account[] getAccounts()
public void removeAccounts(Account[] accounts)
accounts
- The array of accounts to remove.public Bundle createNewAccount(UserAccount userAccount)
@Deprecated public Bundle createNewAccount(java.lang.String accountName, java.lang.String username, java.lang.String refreshToken, java.lang.String authToken, java.lang.String instanceUrl, java.lang.String loginUrl, java.lang.String idUrl, java.lang.String clientId, java.lang.String orgId, java.lang.String userId, java.lang.String communityId, java.lang.String communityUrl, java.lang.String firstName, java.lang.String lastName, java.lang.String displayName, java.lang.String email, java.lang.String photoUrl, java.lang.String thumbnailUrl, java.util.Map<java.lang.String,java.lang.String> additionalOauthValues, java.lang.String lightningDomain, java.lang.String lightningSid, java.lang.String vfDomain, java.lang.String vfSid, java.lang.String contentDomain, java.lang.String contentSid, java.lang.String csrfToken, java.lang.Boolean nativeLogin, java.lang.String language, java.lang.String locale)
accountName
- Account nameusername
- Username.refreshToken
- Refresh token.authToken
- Access token.instanceUrl
- Instance URL.loginUrl
- Login URL.idUrl
- Identity URL.clientId
- Client ID.orgId
- Org ID.userId
- User ID.communityId
- Community ID.communityUrl
- Community URL.firstName
- First name.lastName
- Last name.displayName
- Display name.email
- Email.photoUrl
- Photo URL.thumbnailUrl
- Thumbnail URL.additionalOauthValues
- Additional OAuth values.public java.lang.String getAccountType()
public AccountManager getAccountManager()
public void removeAccount(Account acc)
acc
- Account to be removed.