public final class NativeMetaClient extends Object implements MetaClient
| Modifier and Type | Class and Description |
|---|---|
static class |
NativeMetaClient.Builder |
| 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.
|
protected void |
finalize() |
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
MetaClient.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.
|
public void restoreAll(Map<String,String> serials) throws MetaClientException
restoreAll in interface MetaClientMetaClientException - 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 public Map<String,String> serializeAll() throws MetaClientException
MetaClientMetaClient.changesWereNotSaved()serializeAll in interface MetaClientnull.MetaClientExceptionpublic void changesWereNotSaved()
MetaClientchangesWereNotSaved in interface MetaClientpublic void requestEmailVerification()
requestEmailVerification in interface MetaClientpublic void sync()
throws MetaClientException
sync in interface MetaClientMetaClientExceptionpublic void askForAsset(String jsonOrUrn) throws MetaClientException
MetaClientaskForAsset in interface MetaClientjsonOrUrn - 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 public String getArchiveDecryptionPassword(String jsonOrUrn) throws MetaClientException
MetaClientgetArchiveDecryptionPassword in interface MetaClientjsonOrUrn - 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.@Nonnull @Deprecated public EncryptionInfo getArchiveEncryptionInfo(@Nullable String jsonOrUrn, @Nullable String password) throws MetaClientException
MetaClientgetArchiveEncryptionInfo in interface MetaClientjsonOrUrn - 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 public List<KnownUser> getXPIDs()
getXPIDs in interface MetaClient@Nonnull public List<KnownUser> lookupUsers(String... userEmails) throws MetaClientException
MetaClientlookupUsers in interface MetaClientMetaClientExceptionpublic boolean isDeviceAllowed()
isDeviceAllowed in interface MetaClientpublic boolean isLicensed()
throws MetaClientException
MetaClientisLicensed in interface MetaClienttrue if the current user is able to acquire a license; otherwise, falseMetaClientException - if there was any non-standard problem. Think network, signature, etc.public boolean isSatellite()
MetaClientisSatellite in interface MetaClienttrue if this instance is known to be communicating with a SMDS rather than a CMDS, otherwise falsepublic boolean switchToDomain(String domainOrEmail) throws MetaClientException
MetaClientMetaClient.switchToCentral(String). Performs
network IO.switchToDomain in interface MetaClientdomainOrEmail - 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.public boolean isAccountManaged(String email) throws MetaClientException
MetaClientisAccountManaged in interface MetaClientemail - 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.public void switchToCentral(String prefix)
switchToCentral in interface MetaClientprefix - The base URL of the central server. For example, https://vcs.pkware.com/mds.public boolean isLoggedIn()
isLoggedIn in interface MetaClientpublic int getSyncInterval()
getSyncInterval in interface MetaClient@Nonnull public String getEntitlement(String name, @Nullable String defaultValue)
getEntitlement in interface MetaClientname - of the entitlementdefaultValue if the entitlement is not foundpublic void changeEmail(String newEmail) throws MetaClientException
changeEmail in interface MetaClientMetaClientExceptionpublic void changeName(String newName) throws MetaClientException
changeName in interface MetaClientMetaClientExceptionpublic void changePassword(String oldPassword, String newPassword) throws MetaClientException
changePassword in interface MetaClientMetaClientExceptionpublic void respondToNotification(String urn, String action) throws MetaClientException
respondToNotification in interface MetaClientMetaClientException@Nonnull public Set<Notification> getNotifications()
getNotifications in interface MetaClientpublic boolean canCreateKey(String kind)
canCreateKey in interface MetaClient@Nonnull public List<SingleAssetManager> getManagedAesKeys()
getManagedAesKeys in interface MetaClient@Nonnull public ManagedAesKey getManagedAesKey(String serialized) throws MetaClientException
getManagedAesKey in interface MetaClientMetaClientException - with MetaClientException.category of MetaClientException.CATEGORY_UPGRADE
if the serialized content cannot be parsed. Also with other categories for other reasons.public void logout()
logout in interface MetaClientpublic void login(String emailWithHost, String password) throws MetaClientException
login in interface MetaClientMetaClientExceptionpublic void loginManagedAccount(String emailWithHost, String password) throws MetaClientException
loginManagedAccount in interface MetaClientMetaClientExceptionpublic void loginImplicitAccount()
MetaClientkinit or a similar utility is used.
When this login method is used, MetaClient.login(String, String) and MetaClient.loginManagedAccount(String, String)
must not be used. Additionally, a custom server URL must be provided using
NativeMetaClient.Builder.server(String).
loginImplicitAccount in interface MetaClientMetaClient.loginManagedAccount(String, String),
MetaClient.login(String, String)public void migrate(String username, String password, String accountPassword, boolean mfaExpected) throws MetaClientException
migrate in interface MetaClientaccountPassword - typically from Active DirectoryMetaClientExceptionpublic void createAccount(String email, @Nullable String name, String password) throws MetaClientException
MetaClientcreateAccount in interface MetaClientname - Can be null in which case this user won't have a nameMetaClientException - if account creation failspublic void requestRecoveryEmail(String email) throws MetaClientException
requestRecoveryEmail in interface MetaClientMetaClientException@Nonnull public String recoverPassword(String code, boolean mfaExpected, @Nullable String cipher) throws MetaClientException
recoverPassword in interface MetaClientMetaClientExceptionpublic boolean canRecoveryBePerformed()
canRecoveryBePerformed in interface MetaClientpublic void requestAccess(String serialized) throws MetaClientException
requestAccess in interface MetaClientMetaClientException - 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 public Logger getLogger()
getLogger in interface MetaClient@Nonnull public EncryptionInfo wrapSessionKeyWithSmartkey(String smartkeyUrn, @Nullable String sessionKey)
MetaClientwrapSessionKeyWithSmartkey in interface MetaClientsmartkeyUrn - of a locally held keysessionKey - may be null or empty@Nonnull public EncryptionInfo wrapSessionKeyWithSmartkey(String smartkeyUrn)
MetaClientwrapSessionKeyWithSmartkey in interface MetaClientsmartkeyUrn - of a locally held key