本文整理了Java中com.hazelcast.config.Config.getSecurityConfig()
方法的一些代码示例,展示了Config.getSecurityConfig()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Config.getSecurityConfig()
方法的具体详情如下:
包路径:com.hazelcast.config.Config
类名称:Config
方法名:getSecurityConfig
[英]Returns the security configuration for this hazelcast instance. This includes configuration for security interceptors, permissions, etc.
[中]返回此hazelcast实例的安全配置。这包括安全拦截器、权限等的配置。
代码示例来源:origin: hazelcast/hazelcast-jet
public void onSecurityServiceUpdated(SecurityService securityService) {
this.dynamicSecurityConfig = new DynamicSecurityConfig(staticConfig.getSecurityConfig(), securityService);
}
代码示例来源:origin: com.hazelcast/hazelcast-all
public void onSecurityServiceUpdated(SecurityService securityService) {
this.dynamicSecurityConfig = new DynamicSecurityConfig(staticConfig.getSecurityConfig(), securityService);
}
代码示例来源:origin: hazelcast/hazelcast-jet
private void handleSecurityInterceptors(Node node) {
SecurityConfig cfg = config.getSecurityConfig();
for (Node child : childElements(node)) {
String nodeName = cleanNodeName(child);
if ("interceptor".equals(nodeName)) {
NamedNodeMap attrs = child.getAttributes();
Node classNameNode = attrs.getNamedItem("class-name");
String className = getTextContent(classNameNode);
cfg.addSecurityInterceptorConfig(new SecurityInterceptorConfig(className));
}
}
}
代码示例来源:origin: com.hazelcast/hazelcast-all
private void handleSecurityInterceptors(Node node) {
SecurityConfig cfg = config.getSecurityConfig();
for (Node child : childElements(node)) {
String nodeName = cleanNodeName(child);
if ("interceptor".equals(nodeName)) {
NamedNodeMap attrs = child.getAttributes();
Node classNameNode = attrs.getNamedItem("class-name");
String className = getTextContent(classNameNode);
cfg.addSecurityInterceptorConfig(new SecurityInterceptorConfig(className));
}
}
}
代码示例来源:origin: hazelcast/hazelcast-jet
private void handleSecurityPermission(Node node, PermissionConfig.PermissionType type) {
SecurityConfig cfg = config.getSecurityConfig();
NamedNodeMap attrs = node.getAttributes();
Node nameNode = attrs.getNamedItem("name");
String name = nameNode != null ? getTextContent(nameNode) : "*";
Node principalNode = attrs.getNamedItem("principal");
String principal = principalNode != null ? getTextContent(principalNode) : "*";
PermissionConfig permConfig = new PermissionConfig(type, name, principal);
cfg.addClientPermissionConfig(permConfig);
for (Node child : childElements(node)) {
String nodeName = cleanNodeName(child);
if ("endpoints".equals(nodeName)) {
handleSecurityPermissionEndpoints(child, permConfig);
} else if ("actions".equals(nodeName)) {
handleSecurityPermissionActions(child, permConfig);
}
}
}
代码示例来源:origin: com.hazelcast/hazelcast-all
private void handleSecurityPermission(Node node, PermissionType type) {
SecurityConfig cfg = config.getSecurityConfig();
NamedNodeMap attrs = node.getAttributes();
Node nameNode = attrs.getNamedItem("name");
String name = nameNode != null ? getTextContent(nameNode) : "*";
Node principalNode = attrs.getNamedItem("principal");
String principal = principalNode != null ? getTextContent(principalNode) : "*";
PermissionConfig permConfig = new PermissionConfig(type, name, principal);
cfg.addClientPermissionConfig(permConfig);
for (Node child : childElements(node)) {
String nodeName = cleanNodeName(child);
if ("endpoints".equals(nodeName)) {
handleSecurityPermissionEndpoints(child, permConfig);
} else if ("actions".equals(nodeName)) {
handleSecurityPermissionActions(child, permConfig);
}
}
}
代码示例来源:origin: hazelcast/hazelcast-jet
private void handleCredentialsFactory(Node node) {
NamedNodeMap attrs = node.getAttributes();
Node classNameNode = attrs.getNamedItem("class-name");
String className = getTextContent(classNameNode);
SecurityConfig cfg = config.getSecurityConfig();
CredentialsFactoryConfig credentialsFactoryConfig = new CredentialsFactoryConfig(className);
cfg.setMemberCredentialsConfig(credentialsFactoryConfig);
for (Node child : childElements(node)) {
String nodeName = cleanNodeName(child);
if ("properties".equals(nodeName)) {
fillProperties(child, credentialsFactoryConfig.getProperties());
break;
}
}
}
代码示例来源:origin: hazelcast/hazelcast-jet
private void handlePermissionPolicy(Node node) {
NamedNodeMap attrs = node.getAttributes();
Node classNameNode = attrs.getNamedItem("class-name");
String className = getTextContent(classNameNode);
SecurityConfig cfg = config.getSecurityConfig();
PermissionPolicyConfig policyConfig = new PermissionPolicyConfig(className);
cfg.setClientPolicyConfig(policyConfig);
for (Node child : childElements(node)) {
String nodeName = cleanNodeName(child);
if ("properties".equals(nodeName)) {
fillProperties(child, policyConfig.getProperties());
break;
}
}
}
代码示例来源:origin: com.hazelcast/hazelcast-all
private void handlePermissionPolicy(Node node) {
NamedNodeMap attrs = node.getAttributes();
Node classNameNode = attrs.getNamedItem("class-name");
String className = getTextContent(classNameNode);
SecurityConfig cfg = config.getSecurityConfig();
PermissionPolicyConfig policyConfig = new PermissionPolicyConfig(className);
cfg.setClientPolicyConfig(policyConfig);
for (Node child : childElements(node)) {
String nodeName = cleanNodeName(child);
if ("properties".equals(nodeName)) {
fillProperties(child, policyConfig.getProperties());
break;
}
}
}
代码示例来源:origin: hazelcast/hazelcast-jet
public DynamicConfigurationAwareConfig(Config staticConfig, HazelcastProperties properties) {
assert !(staticConfig instanceof DynamicConfigurationAwareConfig) : "A static Config object is required";
this.staticConfig = staticConfig;
this.configPatternMatcher = staticConfig.getConfigPatternMatcher();
this.isStaticFirst = !properties.getBoolean(SEARCH_DYNAMIC_CONFIG_FIRST);
this.dynamicSecurityConfig = new DynamicSecurityConfig(staticConfig.getSecurityConfig(), null);
this.configSearcher = initConfigSearcher();
}
代码示例来源:origin: com.hazelcast/hazelcast-all
private void handleCredentialsFactory(Node node) {
NamedNodeMap attrs = node.getAttributes();
Node classNameNode = attrs.getNamedItem("class-name");
String className = getTextContent(classNameNode);
SecurityConfig cfg = config.getSecurityConfig();
CredentialsFactoryConfig credentialsFactoryConfig = new CredentialsFactoryConfig(className);
cfg.setMemberCredentialsConfig(credentialsFactoryConfig);
for (Node child : childElements(node)) {
String nodeName = cleanNodeName(child);
if ("properties".equals(nodeName)) {
fillProperties(child, credentialsFactoryConfig.getProperties());
break;
}
}
}
代码示例来源:origin: com.hazelcast/hazelcast-all
private void handleLoginModules(Node node, boolean member) {
SecurityConfig cfg = config.getSecurityConfig();
for (Node child : childElements(node)) {
String nodeName = cleanNodeName(child);
if ("login-module".equals(nodeName)) {
LoginModuleConfig lm = handleLoginModule(child);
if (member) {
cfg.addMemberLoginModuleConfig(lm);
} else {
cfg.addClientLoginModuleConfig(lm);
}
}
}
}
代码示例来源:origin: com.hazelcast/hazelcast-all
public DynamicConfigurationAwareConfig(Config staticConfig, HazelcastProperties properties) {
assert !(staticConfig instanceof DynamicConfigurationAwareConfig) : "A static Config object is required";
this.staticConfig = staticConfig;
this.configPatternMatcher = staticConfig.getConfigPatternMatcher();
this.isStaticFirst = !properties.getBoolean(SEARCH_DYNAMIC_CONFIG_FIRST);
this.dynamicSecurityConfig = new DynamicSecurityConfig(staticConfig.getSecurityConfig(), null);
this.configSearcher = initConfigSearcher();
}
代码示例来源:origin: hazelcast/hazelcast-jet
private void handleSecurity(Node node) {
NamedNodeMap attributes = node.getAttributes();
Node enabledNode = attributes.getNamedItem("enabled");
boolean enabled = enabledNode != null && getBooleanValue(getTextContent(enabledNode));
config.getSecurityConfig().setEnabled(enabled);
for (Node child : childElements(node)) {
String nodeName = cleanNodeName(child);
if ("member-credentials-factory".equals(nodeName)) {
handleCredentialsFactory(child);
} else if ("member-login-modules".equals(nodeName)) {
handleLoginModules(child, true);
} else if ("client-login-modules".equals(nodeName)) {
handleLoginModules(child, false);
} else if ("client-permission-policy".equals(nodeName)) {
handlePermissionPolicy(child);
} else if ("client-permissions".equals(nodeName)) {
handleSecurityPermissions(child);
} else if ("security-interceptors".equals(nodeName)) {
handleSecurityInterceptors(child);
} else if ("client-block-unmapped-actions".equals(nodeName)) {
config.getSecurityConfig().setClientBlockUnmappedActions(getBooleanValue(getTextContent(child)));
}
}
}
代码示例来源:origin: hazelcast/hazelcast-jet
private void handleLoginModules(Node node, boolean member) {
SecurityConfig cfg = config.getSecurityConfig();
for (Node child : childElements(node)) {
String nodeName = cleanNodeName(child);
if ("login-module".equals(nodeName)) {
LoginModuleConfig lm = handleLoginModule(child);
if (member) {
cfg.addMemberLoginModuleConfig(lm);
} else {
cfg.addClientLoginModuleConfig(lm);
}
}
}
}
代码示例来源:origin: com.hazelcast/hazelcast-all
private void handleSecurity(Node node) {
NamedNodeMap attributes = node.getAttributes();
Node enabledNode = attributes.getNamedItem("enabled");
boolean enabled = enabledNode != null && getBooleanValue(getTextContent(enabledNode));
config.getSecurityConfig().setEnabled(enabled);
for (Node child : childElements(node)) {
String nodeName = cleanNodeName(child);
if ("member-credentials-factory".equals(nodeName)) {
handleCredentialsFactory(child);
} else if ("member-login-modules".equals(nodeName)) {
handleLoginModules(child, true);
} else if ("client-login-modules".equals(nodeName)) {
handleLoginModules(child, false);
} else if ("client-permission-policy".equals(nodeName)) {
handlePermissionPolicy(child);
} else if ("client-permissions".equals(nodeName)) {
handleSecurityPermissions(child);
} else if ("security-interceptors".equals(nodeName)) {
handleSecurityInterceptors(child);
} else if ("client-block-unmapped-actions".equals(nodeName)) {
config.getSecurityConfig().setClientBlockUnmappedActions(getBooleanValue(getTextContent(child)));
}
}
}
代码示例来源:origin: com.hazelcast/hazelcast-all
private void checkSecurityAllowed() {
SecurityConfig securityConfig = node.getConfig().getSecurityConfig();
if (securityConfig != null && securityConfig.isEnabled()) {
if (!BuildInfoProvider.getBuildInfo().isEnterprise()) {
throw new IllegalStateException("Security requires Hazelcast Enterprise Edition");
}
}
SymmetricEncryptionConfig symmetricEncryptionConfig = node.getConfig().getNetworkConfig().getSymmetricEncryptionConfig();
if (symmetricEncryptionConfig != null && symmetricEncryptionConfig.isEnabled()) {
if (!BuildInfoProvider.getBuildInfo().isEnterprise()) {
throw new IllegalStateException("Symmetric Encryption requires Hazelcast Enterprise Edition");
}
}
}
代码示例来源:origin: hazelcast/hazelcast-jet
private void checkSecurityAllowed() {
SecurityConfig securityConfig = node.getConfig().getSecurityConfig();
if (securityConfig != null && securityConfig.isEnabled()) {
if (!BuildInfoProvider.getBuildInfo().isEnterprise()) {
throw new IllegalStateException("Security requires Hazelcast Enterprise Edition");
}
}
SymmetricEncryptionConfig symmetricEncryptionConfig = node.getConfig().getNetworkConfig().getSymmetricEncryptionConfig();
if (symmetricEncryptionConfig != null && symmetricEncryptionConfig.isEnabled()) {
if (!BuildInfoProvider.getBuildInfo().isEnterprise()) {
throw new IllegalStateException("Symmetric Encryption requires Hazelcast Enterprise Edition");
}
}
}
代码示例来源:origin: hazelcast/hazelcast-code-samples
private static Config createConfig() {
Config config = new Config();
config.setLicenseKey(ENTERPRISE_LICENSE_KEY);
config.setProperty("hazelcast.wait.seconds.before.join", "0");
SecurityInterceptorConfig securityInterceptorConfig = new SecurityInterceptorConfig();
securityInterceptorConfig.setClassName(MySecurityInterceptor.class.getName());
SecurityConfig securityConfig = config.getSecurityConfig();
securityConfig.setEnabled(true).addSecurityInterceptorConfig(securityInterceptorConfig);
// when you enable security all client requests are denied, so we need to give permission first
// security-interceptor will be run after checking this permission
PermissionConfig permissionConfig = new PermissionConfig(PermissionConfig.PermissionType.ALL, "", null);
securityConfig.addClientPermissionConfig(permissionConfig);
return config;
}
代码示例来源:origin: hazelcast/hazelcast-jet
private static void securityXmlGenerator(XmlGenerator gen, Config config) {
SecurityConfig c = config.getSecurityConfig();
if (c == null) {
return;
内容来源于网络,如有侵权,请联系作者删除!