HostValidator.Builder
public final class HostValidator.Builder
Builder of HostValidator.
Allows applications to customize the HostValidator that will be used to verify whether a caller is a valid templates host.
Summary
Public methods |
|
|---|---|
@NonNull HostValidator.Builder |
addAllowedHost(@NonNull String packageName, @NonNull String digest)Adds a host to the allow list. |
@NonNull HostValidator.Builder |
addAllowedHosts(@ArrayRes int allowListedHostsRes)Adds a hosts to the allow list. |
@NonNull HostValidator |
build()Returns a new |
Public constructors
Public methods
addAllowedHost
public @NonNull HostValidator.Builder addAllowedHost(@NonNull String packageName, @NonNull String digest)
Adds a host to the allow list.
| Parameters | |
|---|---|
@NonNull String packageName |
host package name (as reported by |
@NonNull String digest |
SHA256 digest of the DER encoding of the allow-listed host certificate, formatted as 32 lowercase 2 digits hexadecimal values separated by colon (e.g.:"000102030405060708090a0b0c0d0e0f101112131415 161718191a1b1c1d1e1f"). When using signature rotation, this digest should correspond to the initial signing certificate |
addAllowedHosts
public @NonNull HostValidator.Builder addAllowedHosts(@ArrayRes int allowListedHostsRes)
Adds a hosts to the allow list.
Allow-listed hosts are retrieved from a string-array resource, encoded as [digest,package-name] pairs separated by comma. See addAllowedHost for details on signature digest and package-name formatting.
| Parameters | |
|---|---|
@ArrayRes int allowListedHostsRes |
string-array resource identifier |
| Throws | |
|---|---|
java.lang.IllegalArgumentException |
if the provided resource doesn't exist or if the entries in the given resource are not formatted as expected |