Use the latest and in config, `@JsonCreator`
This commit is contained in:
parent
0a4392f700
commit
31c0c3275f
|
@ -85,7 +85,7 @@ directory:
|
||||||
|
|
||||||
directoryV2:
|
directoryV2:
|
||||||
client: # Configuration for interfacing with Contact Discovery Service v2 cluster
|
client: # Configuration for interfacing with Contact Discovery Service v2 cluster
|
||||||
userAuthenticationTokenSharedSecret: # hex-encoded secret shared with CDS to generate auth tokens for Signal users
|
userAuthenticationTokenSharedSecret: # base64-encoded secret shared with CDS to generate auth tokens for Signal users
|
||||||
|
|
||||||
messageCache: # Redis server configuration for message store cache
|
messageCache: # Redis server configuration for message store cache
|
||||||
persistDelayMinutes:
|
persistDelayMinutes:
|
||||||
|
|
|
@ -4,19 +4,23 @@
|
||||||
*/
|
*/
|
||||||
package org.whispersystems.textsecuregcm.configuration;
|
package org.whispersystems.textsecuregcm.configuration;
|
||||||
|
|
||||||
|
import com.fasterxml.jackson.annotation.JsonCreator;
|
||||||
import com.fasterxml.jackson.annotation.JsonProperty;
|
import com.fasterxml.jackson.annotation.JsonProperty;
|
||||||
import javax.validation.constraints.NotEmpty;
|
import org.whispersystems.textsecuregcm.util.ExactlySize;
|
||||||
import org.apache.commons.codec.DecoderException;
|
|
||||||
import org.apache.commons.codec.binary.Hex;
|
|
||||||
|
|
||||||
public class DirectoryV2ClientConfiguration {
|
public class DirectoryV2ClientConfiguration {
|
||||||
|
|
||||||
@NotEmpty
|
private final byte[] userAuthenticationTokenSharedSecret;
|
||||||
@JsonProperty
|
|
||||||
private String userAuthenticationTokenSharedSecret;
|
|
||||||
|
|
||||||
public byte[] getUserAuthenticationTokenSharedSecret() throws DecoderException {
|
@JsonCreator
|
||||||
return Hex.decodeHex(userAuthenticationTokenSharedSecret.toCharArray());
|
public DirectoryV2ClientConfiguration(
|
||||||
|
@JsonProperty("userAuthenticationTokenSharedSecret") final byte[] userAuthenticationTokenSharedSecret) {
|
||||||
|
this.userAuthenticationTokenSharedSecret = userAuthenticationTokenSharedSecret;
|
||||||
|
}
|
||||||
|
|
||||||
|
@ExactlySize({32})
|
||||||
|
public byte[] getUserAuthenticationTokenSharedSecret() {
|
||||||
|
return userAuthenticationTokenSharedSecret;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -4,18 +4,21 @@
|
||||||
*/
|
*/
|
||||||
package org.whispersystems.textsecuregcm.configuration;
|
package org.whispersystems.textsecuregcm.configuration;
|
||||||
|
|
||||||
|
import com.fasterxml.jackson.annotation.JsonCreator;
|
||||||
import com.fasterxml.jackson.annotation.JsonProperty;
|
import com.fasterxml.jackson.annotation.JsonProperty;
|
||||||
import javax.validation.Valid;
|
import javax.validation.Valid;
|
||||||
import javax.validation.constraints.NotNull;
|
|
||||||
|
|
||||||
public class DirectoryV2Configuration {
|
public class DirectoryV2Configuration {
|
||||||
|
|
||||||
@JsonProperty
|
private final DirectoryV2ClientConfiguration clientConfiguration;
|
||||||
@NotNull
|
|
||||||
@Valid
|
|
||||||
private DirectoryV2ClientConfiguration client;
|
|
||||||
|
|
||||||
|
@JsonCreator
|
||||||
|
public DirectoryV2Configuration(@JsonProperty("client") DirectoryV2ClientConfiguration clientConfiguration) {
|
||||||
|
this.clientConfiguration = clientConfiguration;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Valid
|
||||||
public DirectoryV2ClientConfiguration getDirectoryV2ClientConfiguration() {
|
public DirectoryV2ClientConfiguration getDirectoryV2ClientConfiguration() {
|
||||||
return client;
|
return clientConfiguration;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue