public interface MetaClient
Modifier and Type | Method and Description |
---|---|
void |
askForAsset(String jsonOrUrn)
Requests the specified asset from the Metadata Server.
|
boolean |
canCreateKey(String kind) |
boolean |
canRecoveryBePerformed() |
void |
changeEmail(String newEmail) |
void |
changeName(String newName) |
void |
changePassword(String oldPassword,
String newPassword) |
void |
changesWereNotSaved()
If unable to save serials, this function must be called.
|
void |
createAccount(String email,
String name,
String password)
Does not pay attention to whether or not an account already exists.
|
String |
getArchiveDecryptionPassword(String jsonOrUrn)
Given asset information as described below, extracts a decryption password.
|
EncryptionInfo |
getArchiveEncryptionInfo(String jsonOrUrn,
String password)
Deprecated.
|
String |
getEntitlement(String name,
String defaultValue) |
Logger |
getLogger() |
ManagedAesKey |
getManagedAesKey(String serialized) |
List<SingleAssetManager> |
getManagedAesKeys() |
Set<Notification> |
getNotifications() |
int |
getSyncInterval() |
List<KnownUser> |
getXPIDs() |
boolean |
isAccountManaged(String email)
Query server and find out if this email is a managed account.
|
boolean |
isDeviceAllowed() |
boolean |
isLicensed()
This will perform a network call.
|
boolean |
isLoggedIn() |
boolean |
isSatellite()
Is not valid until a previous call to PKMeta::checkDomain() in native code which happens during typical login flows or
a restore from serialized state.
|
void |
login(String emailWithHost,
String password) |
void |
loginImplicitAccount()
Performs a login using a system user.
|
void |
loginManagedAccount(String emailWithHost,
String password) |
void |
logout() |
List<KnownUser> |
lookupUsers(String... userEmails)
Asks the server for user information for the provided email addresses.
|
void |
migrate(String username,
String password,
String accountPassword,
boolean mfaExpected) |
String |
recoverPassword(String code,
boolean mfaExpected,
String cipher) |
void |
requestAccess(String serialized) |
void |
requestEmailVerification() |
void |
requestRecoveryEmail(String email) |
void |
respondToNotification(String urn,
String action) |
void |
restoreAll(Map<String,String> serials) |
Map<String,String> |
serializeAll()
It is assumed that all data after this call are successfully transformed.
|
void |
switchToCentral(String prefix) |
boolean |
switchToDomain(String domainOrEmail)
May overwrite any previous information passed to
switchToCentral(String) . |
void |
sync() |
EncryptionInfo |
wrapSessionKeyWithSmartkey(String smartkeyUrn)
Generates a new 256 bit session key and wraps it for secure storage and future retrieval.
|
EncryptionInfo |
wrapSessionKeyWithSmartkey(String smartkeyUrn,
String sessionKey)
Expands the existing session key to 256 bits and wraps it for secure storage and future retrieval.
|
void restoreAll(Map<String,String> serials) throws MetaClientException
MetaClientException
- If the data being restored are invalid. Invalid means that there are a different number than expected or that any are different from when we last saw them.@Nonnull Map<String,String> serializeAll() throws MetaClientException
changesWereNotSaved()
null
.MetaClientException
void changesWereNotSaved()
void requestEmailVerification()
void sync() throws MetaClientException
MetaClientException
void askForAsset(String jsonOrUrn) throws MetaClientException
jsonOrUrn
- Whenever possible, the full asset JSON should be provided. The JSON will include all
information to correctly find an asset. If only the URN is provided, the asset may not be found.MetaClientException
- with a MetaClientException.category
of
MetaClientException.CATEGORY_INTERNAL
if the json
provided is in an unrecognized format. Other variations of the exception may be thrown as well.@Nonnull String getArchiveDecryptionPassword(String jsonOrUrn) throws MetaClientException
jsonOrUrn
- Whenever possible, the full asset JSON should be provided. The JSON will include all
information to correctly find an asset. If only the URN is provided, the asset may not be found.MetaClientException
- with a MetaClientException.category
of
MetaClientException.CATEGORY_INTERNAL
if the json
provided is in an unrecognized format, or with MetaClientException.CATEGORY_NOT_FOUND
if the password cannot be
found. Other variations of the exception may be thrown as well.@Deprecated @Nonnull EncryptionInfo getArchiveEncryptionInfo(@Nullable String jsonOrUrn, @Nullable String password) throws MetaClientException
wrapSessionKeyWithSmartkey(String, String)
jsonOrUrn
- optional. Should be null
if no asset is being used.password
- optional. Should be null
if no password is being used.EncryptionInfo.json
will be null
if no asset is being used.
EncryptionInfo.password
will always be valid.MetaClientException
@Nonnull List<KnownUser> getXPIDs()
@Nonnull List<KnownUser> lookupUsers(String... userEmails) throws MetaClientException
MetaClientException
boolean isDeviceAllowed()
boolean isLicensed() throws MetaClientException
true
if the current user is able to acquire a license; otherwise, false
MetaClientException
- if there was any non-standard problem. Think network, signature, etc.boolean isSatellite()
true
if this instance is known to be communicating with a SMDS rather than a CMDS, otherwise false
boolean switchToDomain(String domainOrEmail) throws MetaClientException
switchToCentral(String)
. Performs
network IO.domainOrEmail
- Domain name registered with CMDS or the email address of the current user,
from which the domain will be deduced.true
if now talking to a SMDS. Otherwise, false
.MetaClientException
- primarily for network reasons, but could be others as well.
Best to display to the user.boolean isAccountManaged(String email) throws MetaClientException
email
- of the current usertrue
if the account is managed, otherwise, false
.MetaClientException
- primarily for network reasons, but could be others as well. Best to display to the user.
With MetaClientException.CATEGORY_MIGRATION_REQUIRED
if needing to migrate.void switchToCentral(String prefix)
prefix
- The base URL of the central server. For example, https://vcs.pkware.com/mds
.boolean isLoggedIn()
int getSyncInterval()
@Nullable String getEntitlement(String name, @Nullable String defaultValue)
name
- of the entitlementdefaultValue
if the entitlement is not foundvoid changeEmail(String newEmail) throws MetaClientException
MetaClientException
void changeName(String newName) throws MetaClientException
MetaClientException
void changePassword(String oldPassword, String newPassword) throws MetaClientException
MetaClientException
void respondToNotification(String urn, String action) throws MetaClientException
MetaClientException
@Nonnull Set<Notification> getNotifications()
boolean canCreateKey(String kind)
@Nonnull List<SingleAssetManager> getManagedAesKeys()
@Nonnull ManagedAesKey getManagedAesKey(String serialized) throws MetaClientException
MetaClientException
- with MetaClientException.category
of MetaClientException.CATEGORY_UPGRADE
if the serialized content cannot be parsed. Also with other categories for other reasons.void logout()
void login(String emailWithHost, String password) throws MetaClientException
MetaClientException
void loginManagedAccount(String emailWithHost, String password) throws MetaClientException
MetaClientException
void loginImplicitAccount() throws MetaClientException
kinit
or a similar utility is used.
When this login method is used, login(String, String)
and loginManagedAccount(String, String)
must not be used. Additionally, a custom server URL must be provided using
NativeMetaClient.Builder.server(String)
.
MetaClientException
- for all sorts of reasons.loginManagedAccount(String, String)
,
login(String, String)
void migrate(String username, String password, String accountPassword, boolean mfaExpected) throws MetaClientException
accountPassword
- typically from Active DirectoryMetaClientException
void createAccount(String email, @Nullable String name, String password) throws MetaClientException
name
- Can be null
in which case this user won't have a nameMetaClientException
- if account creation failsvoid requestRecoveryEmail(String email) throws MetaClientException
MetaClientException
@Nonnull String recoverPassword(String code, boolean mfaExpected, @Nullable String cipher) throws MetaClientException
MetaClientException
boolean canRecoveryBePerformed()
void requestAccess(String serialized) throws MetaClientException
MetaClientException
- with MetaClientException.category
of MetaClientException.CATEGORY_UPGRADE
if the serialized content cannot be parsed. May also happen as a results of network problems and other reasons@Nonnull EncryptionInfo wrapSessionKeyWithSmartkey(String smartkeyUrn, @Nullable String sessionKey)
smartkeyUrn
- of a locally held keysessionKey
- may be null
or empty@Nonnull EncryptionInfo wrapSessionKeyWithSmartkey(String smartkeyUrn)
smartkeyUrn
- of a locally held key