Interface UpdateServer
Server associated with a given user account.
This is a local-only operation: no network calls are made.
This operation can be used in different scenarios:
- Domain migration: when the domain of the server where the account is stored
changes, the operation can be used to use the new domain (see
newBaseUrl(URI)). - High availability scenarios: when you want to allow the SDK to perform its
out-of-band operations in multiple servers, the operation can be used to define
all the base URLs accepted by the SDK for a given account (see
newAlternativeBaseUrls(Set)). - Use separate domains for out-of-band registration and authentication: by
using
newAlternativeBaseUrls(Set), the SDK will support the case where different domains are used in the redemption URLs defined in nevisFIDO. The SDK will use the redemption URL to perform the out-of-band operation.
Usage example:
private void updateServer(LocalData localData, String username, URI newBaseUrl, Set<URI> alternativeBaseUrls) {
localData.updateServerOperation()
.username(username)
.newBaseUrl(newBaseUrl)
.newAlternativeBaseUrls(alternativeBaseUrls)
.execute();
}
Note that execute() is synchronous and requires IO operations, so it is
recommended to invoke it outside the main/UI thread.
- See Also:
-
Method Summary
Modifier and TypeMethodDescriptionvoidexecute()Executes the update synchronously.newAlternativeBaseUrls(Set<URI> newAlternativeBaseUrls) Specifies the alternative base URLs of the server.newBaseUrl(URI newBaseUrl) Specifies the new base URL of the server.Specifies the username whoseServermust be updated.
-
Method Details
-
username
Specifies the username whoseServermust be updated.Providing the username is required.
- Parameters:
username- the username- Returns:
- this
UpdateServer
-
newBaseUrl
Specifies the new base URL of the server. If not provided, the base URL of theServerassociated with the account will not be changed.The base URL of the server is the URL that the SDK will use to do in-band operations (
Authentication,Deregistration,DeviceInformationChange, etc.)The current base URL will be replaced with the provided base URL. If the backend is still using the old base URL for out-of-band operations, you must include it in the set passed to
newAlternativeBaseUrls(Set).- Parameters:
newBaseUrl- the new base URL- Returns:
- this
UpdateServer
-
newAlternativeBaseUrls
Specifies the alternative base URLs of the server. If not provided, the alternative base URLs of theServerassociated with the account will not be changed. Note that providing a value replaces the entire set rather than merging with it. Callers adding a single URL must therefore provide the complete desired set.The alternative base URLs are used for out-of-band operations. If the
RedeemData.redeemUrl()of theOutOfBandPayload.redeemData()has a base URL matching one of the alternative base URLs, then the SDK will use that base URL to perform the out-of-band operation.The alternative base URLs are also used for in-band registration when there is already an authenticator for the user being registered. The SDK will accept to use any of the alternative base URLs to do the operation (see
Registration.serverUrl(URI)).- Parameters:
newAlternativeBaseUrls- the new alternative base URLs- Returns:
- this
UpdateServer
-
execute
void execute()Executes the update synchronously. Updates theServerassociated with the account of the provided username in the local SDK state.This method requires IO operations, so it is recommended to invoke it outside the main/UI thread.
- Throws:
IllegalArgumentException- if neithernewBaseUrl(URI)nornewAlternativeBaseUrls(Set)was providedIllegalArgumentException- if the provided username does not existNullPointerException- ifusername(String)was not provided
-