@Test
 public void testGroupConfig() {
   GroupConfig groupConfig = config.getGroupConfig();
   assertNotNull(groupConfig);
   assertEquals("spring-group", groupConfig.getName());
   assertEquals("spring-group-pass", groupConfig.getPassword());
 }
 private boolean authenticateWithUserNameAndPassword() {
   GroupConfig groupConfig = nodeEngine.getConfig().getGroupConfig();
   String nodeGroupName = groupConfig.getName();
   String nodeGroupPassword = groupConfig.getPassword();
   boolean usernameMatch = nodeGroupName.equals(parameters.username);
   boolean passwordMatch = nodeGroupPassword.equals(parameters.password);
   return usernameMatch && passwordMatch;
 }
 private boolean authenticate(UsernamePasswordCredentials credentials) {
   GroupConfig groupConfig = nodeEngine.getConfig().getGroupConfig();
   String nodeGroupName = groupConfig.getName();
   String nodeGroupPassword = groupConfig.getPassword();
   boolean usernameMatch = nodeGroupName.equals(credentials.getUsername());
   boolean passwordMatch = nodeGroupPassword.equals(credentials.getPassword());
   return usernameMatch && passwordMatch;
 }
 @Override
 public void run() {
   GroupConfig groupConfig = getNodeEngine().getConfig().getGroupConfig();
   if (!groupName.equals(groupConfig.getName())) {
     response = Boolean.FALSE;
   } else if (!groupPassword.equals(groupConfig.getPassword())) {
     response = Boolean.FALSE;
   }
 }
 public byte[] changeWebServerUrlOverCluster(String groupName, String groupPass, String newUrl) {
   try {
     GroupConfig groupConfig = factory.getConfig().getGroupConfig();
     if (!(groupConfig.getName().equals(groupName) && groupConfig.getPassword().equals(groupPass)))
       return HttpCommand.RES_403;
     ManagementCenterConfigCallable callable = new ManagementCenterConfigCallable(newUrl);
     callable.setHazelcastInstance(factory);
     Set<Member> members = factory.getCluster().getMembers();
     MultiTask<Void> task = new MultiTask<Void>(callable, members);
     ExecutorService executorService = factory.getExecutorService();
     executorService.execute(task);
   } catch (Throwable throwable) {
     logger.log(Level.WARNING, "New web server url cannot be assigned.", throwable);
     return HttpCommand.RES_500;
   }
   return HttpCommand.RES_204;
 }
Beispiel #6
0
  public ConfigCheck createConfigCheck() {
    final ConfigCheck configCheck = new ConfigCheck();
    final GroupConfig groupConfig = config.getGroupConfig();
    final PartitionGroupConfig partitionGroupConfig = config.getPartitionGroupConfig();
    final boolean partitionGroupEnabled =
        partitionGroupConfig != null && partitionGroupConfig.isEnabled();

    PartitionGroupConfig.MemberGroupType memberGroupType =
        partitionGroupEnabled
            ? partitionGroupConfig.getGroupType()
            : PartitionGroupConfig.MemberGroupType.PER_MEMBER;
    configCheck
        .setGroupName(groupConfig.getName())
        .setGroupPassword(groupConfig.getPassword())
        .setJoinerType(joiner != null ? joiner.getType() : "")
        .setPartitionGroupEnabled(partitionGroupEnabled)
        .setMemberGroupType(memberGroupType);
    return configCheck;
  }
 private Credentials initCredentials(ClientConfig config) {
   final GroupConfig groupConfig = config.getGroupConfig();
   final ClientSecurityConfig securityConfig = config.getSecurityConfig();
   Credentials c = securityConfig.getCredentials();
   if (c == null) {
     final String credentialsClassname = securityConfig.getCredentialsClassname();
     // todo: Should be moved to a reflection utility.
     if (credentialsClassname != null) {
       try {
         c = ClassLoaderUtil.newInstance(config.getClassLoader(), credentialsClassname);
       } catch (Exception e) {
         throw ExceptionUtil.rethrow(e);
       }
     }
   }
   if (c == null) {
     c = new UsernamePasswordCredentials(groupConfig.getName(), groupConfig.getPassword());
   }
   return c;
 }
 public Boolean call() throws Exception {
   GroupConfig groupConfig = node.getConfig().getGroupConfig();
   if (!groupName.equals(groupConfig.getName())) return Boolean.FALSE;
   if (!groupPassword.equals(groupConfig.getPassword())) return Boolean.FALSE;
   return Boolean.TRUE;
 }
 @Test
 public void testGroupConfig() {
   final GroupConfig groupConfig = clientConfig.getGroupConfig();
   assertEquals("dev", groupConfig.getName());
   assertEquals("dev-pass", groupConfig.getPassword());
 }