Skip to content

Commit

Permalink
0001820: Add property that instructs symmetric to keep the same node_…
Browse files Browse the repository at this point in the history
…password for a node on re-registration
  • Loading branch information
chenson42 committed Jul 19, 2014
1 parent 186c29f commit 28e00d0
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 2 deletions.
Expand Up @@ -74,6 +74,7 @@ private ParameterConstants() {
public final static String JOB_RANDOM_MAX_START_TIME_MS = "job.random.max.start.time.ms";

public final static String REGISTRATION_NUMBER_OF_ATTEMPTS = "registration.number.of.attempts";
public final static String REGISTRATION_REOPEN_USE_SAME_PASSWORD = "registration.reopen.use.same.password";
public final static String REGISTRATION_REQUIRE_NODE_GROUP_LINK = "registration.require.node.group.link";
public final static String REGISTRATION_REINITIALIZE_ENABLED = "registration.reinitialize.enable";

Expand Down
Expand Up @@ -455,8 +455,14 @@ public void registerWithServer() {
*/
public synchronized void reOpenRegistration(String nodeId) {
Node node = nodeService.findNode(nodeId);
String password = nodeService.getNodeIdCreator().generatePassword(node);
password = filterPasswordOnSaveIfNeeded(password);
NodeSecurity security = nodeService.findNodeSecurity(nodeId);
String password = null;
if (security != null && parameterService.is(ParameterConstants.REGISTRATION_REOPEN_USE_SAME_PASSWORD, true)) {
password = security.getNodePassword();
} else {
password = nodeService.getNodeIdCreator().generatePassword(node);
password = filterPasswordOnSaveIfNeeded(password);
}
if (node != null) {
int updateCount = sqlTemplate.update(getSql("reopenRegistrationSql"), new Object[] {
password, nodeId });
Expand Down
Expand Up @@ -410,6 +410,13 @@ schema.version=?
# Tags: registration
registration.number.of.attempts=-1

# Indicates that if registration is reopened if the same password should be used. If set to false
# then a new password will be generated.
#
# DatabaseOverridable: true
# Tags: registration
registration.reopen.use.same.password=true

# Indicates whether SymmetricDS should be re-initialized immediately before registration.
#
# DatabaseOverridable: true
Expand Down

0 comments on commit 28e00d0

Please sign in to comment.