private boolean checkCredentials(HttpPostCommand command) throws UnsupportedEncodingException { byte[] data = command.getData(); final String[] strList = bytesToString(data).split("&"); if (strList.length < 2) { return false; } final String groupName = URLDecoder.decode(strList[0], "UTF-8"); final String groupPass = URLDecoder.decode(strList[1], "UTF-8"); final GroupConfig groupConfig = textCommandService.getNode().getConfig().getGroupConfig(); return groupConfig.getName().equals(groupName) && groupConfig.getPassword().equals(groupPass); }
@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; } }
@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; } }
private void logGroupPasswordInfo() { if (!isNullOrEmpty(config.getGroupConfig().getPassword())) { logger.info("A non-empty group password is configured for the Hazelcast member." + " Since version 3.8.2, members with the same group name," + " but with different group passwords (that do not use authentication) form a cluster." + " The group password configuration will be removed completely in a future release."); } } }
private void logGroupPasswordInfo() { if (!isNullOrEmpty(config.getGroupConfig().getPassword())) { logger.info("A non-empty group password is configured for the Hazelcast member." + " Starting with Hazelcast version 3.8.2, members with the same group name," + " but with different group passwords (that do not use authentication) form a cluster." + " The group password configuration will be removed completely in a future release."); } } }
private void logGroupPasswordInfo() { if (!isNullOrEmpty(config.getGroupConfig().getPassword())) { ILogger logger = loggingService.getLogger(HazelcastClient.class); logger.info("A non-empty group password is configured for the Hazelcast client." + " Starting with Hazelcast version 3.11, clients with the same group name," + " but with different group passwords (that do not use authentication) will be accepted to a cluster." + " The group password configuration will be removed completely in a future release."); } }
private void logGroupPasswordInfo() { if (!isNullOrEmpty(config.getGroupConfig().getPassword())) { ILogger logger = loggingService.getLogger(HazelcastClient.class); logger.info("A non-empty group password is configured for the Hazelcast client." + " Starting with Hazelcast version 3.11, clients with the same group name," + " but with different group passwords (that do not use authentication) will be accepted to a cluster." + " The group password configuration will be removed completely in a future release."); } }
private static void group(XmlGenerator gen, GroupConfig group) { gen.open("group") .node("name", group.getName()) .node("password", group.getPassword()) .close(); }
private static void group(XmlGenerator gen, GroupConfig group) { gen.open("group") .node("name", group.getName()) .node("password", group.getPassword()) .close(); }
public byte[] clusterWideUpdateManagementCenterUrl(String groupName, String groupPass, String newUrl) { try { GroupConfig groupConfig = instance.getConfig().getGroupConfig(); if (!(groupConfig.getName().equals(groupName) && groupConfig.getPassword().equals(groupPass))) { return HttpCommand.RES_403; } final Collection<Member> memberList = instance.node.clusterService.getMembers(); for (Member member : memberList) { send(member.getAddress(), new UpdateManagementCenterUrlOperation(newUrl)); } return HttpCommand.RES_204; } catch (Throwable throwable) { logger.warning("New Management Center url cannot be assigned.", throwable); return HttpCommand.RES_500; } }
private void handleChangeClusterVersion(HttpPostCommand command) throws UnsupportedEncodingException { byte[] data = command.getData(); String[] strList = bytesToString(data).split("&"); String groupName = URLDecoder.decode(strList[0], "UTF-8"); String groupPass = URLDecoder.decode(strList[1], "UTF-8"); String versionParam = URLDecoder.decode(strList[2], "UTF-8"); String res; try { Node node = textCommandService.getNode(); ClusterService clusterService = node.getClusterService(); GroupConfig groupConfig = node.getConfig().getGroupConfig(); if (!(groupConfig.getName().equals(groupName) && groupConfig.getPassword().equals(groupPass))) { res = response(ResponseType.FORBIDDEN); } else { Version version = Version.of(versionParam); clusterService.changeClusterVersion(version); res = response(ResponseType.SUCCESS, "version", clusterService.getClusterVersion().toString()); } } catch (Throwable throwable) { logger.warning("Error occurred while changing cluster version", throwable); res = exceptionResponse(throwable); } command.setResponse(HttpCommand.CONTENT_TYPE_JSON, stringToBytes(res)); }
private Credentials initCredentials(ClientSecurityConfig securityConfig, GroupConfig groupConfig, ClassLoader classLoader) { Credentials credentials = securityConfig.getCredentials(); if (credentials == null) { String credentialsClassname = securityConfig.getCredentialsClassname(); if (credentialsClassname != null) { try { credentials = ClassLoaderUtil.newInstance(classLoader, credentialsClassname); } catch (Exception e) { throw rethrow(e); } } } if (credentials == null) { credentials = new UsernamePasswordCredentials(groupConfig.getName(), groupConfig.getPassword()); } return credentials; }
private Credentials initCredentials(ClientSecurityConfig securityConfig, GroupConfig groupConfig, ClassLoader classLoader) { Credentials credentials = securityConfig.getCredentials(); if (credentials == null) { String credentialsClassname = securityConfig.getCredentialsClassname(); if (credentialsClassname != null) { try { credentials = ClassLoaderUtil.newInstance(classLoader, credentialsClassname); } catch (Exception e) { throw rethrow(e); } } } if (credentials == null) { credentials = new UsernamePasswordCredentials(groupConfig.getName(), groupConfig.getPassword()); } return credentials; }
private void handleChangeClusterState(HttpPostCommand command) throws UnsupportedEncodingException { byte[] data = command.getData(); String[] strList = bytesToString(data).split("&"); String groupName = URLDecoder.decode(strList[0], "UTF-8"); String groupPass = URLDecoder.decode(strList[1], "UTF-8"); String stateParam = URLDecoder.decode(strList[2], "UTF-8"); String res; try { Node node = textCommandService.getNode(); ClusterService clusterService = node.getClusterService(); GroupConfig groupConfig = node.getConfig().getGroupConfig(); if (!(groupConfig.getName().equals(groupName) && groupConfig.getPassword().equals(groupPass))) { res = response(ResponseType.FORBIDDEN); } else { ClusterState state = ClusterState.valueOf(upperCaseInternal(stateParam)); if (!state.equals(clusterService.getClusterState())) { clusterService.changeClusterState(state); res = response(ResponseType.SUCCESS, "state", state.toString().toLowerCase(StringUtil.LOCALE_INTERNAL)); } else { res = response(ResponseType.FAIL, "state", state.toString().toLowerCase(StringUtil.LOCALE_INTERNAL)); } } } catch (Throwable throwable) { logger.warning("Error occurred while changing cluster state", throwable); res = exceptionResponse(throwable); } command.setResponse(HttpCommand.CONTENT_TYPE_JSON, stringToBytes(res)); }
gen.open("group") .node("name", config.getGroupConfig().getName()) .node("password", getOrMaskValue(config.getGroupConfig().getPassword())) .close() .node("license-key", getOrMaskValue(config.getLicenseKey()))
gen.open("group") .node("name", config.getGroupConfig().getName()) .node("password", getOrMaskValue(config.getGroupConfig().getPassword())) .close() .node("license-key", getOrMaskValue(config.getLicenseKey()))
private void assertHazelcastConfig(Config cfg) { assertTrue(cfg.getManagedContext() instanceof SpringManagedContext); assertEquals("jet-spring", cfg.getGroupConfig().getName()); assertEquals("jet-spring-pass", cfg.getGroupConfig().getPassword()); NetworkConfig networkConfig = cfg.getNetworkConfig(); assertEquals(5707, networkConfig.getPort()); assertFalse(networkConfig.isPortAutoIncrement()); JoinConfig join = networkConfig.getJoin(); assertFalse(join.getMulticastConfig().isEnabled()); TcpIpConfig tcpIpConfig = join.getTcpIpConfig(); assertTrue(tcpIpConfig.isEnabled()); List<String> members = tcpIpConfig.getMembers(); assertEquals(1, members.size()); assertEquals("127.0.0.1:5707", members.get(0)); assertEquals(3, cfg.getMapConfig("map").getBackupCount()); } }