本文整理了Java中org.apache.shardingsphere.core.yaml.YamlAuthentication.getUsername()
方法的一些代码示例,展示了YamlAuthentication.getUsername()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。YamlAuthentication.getUsername()
方法的具体详情如下:
包路径:org.apache.shardingsphere.core.yaml.YamlAuthentication
类名称:YamlAuthentication
方法名:getUsername
暂无
代码示例来源:origin: apache/incubator-shardingsphere
@Override
public Authentication load(final String data) {
YamlAuthentication result = new Yaml().loadAs(data, YamlAuthentication.class);
Preconditions.checkState(!Strings.isNullOrEmpty(result.getUsername()), "Authority configuration is invalid.");
return new Authentication(result.getUsername(), result.getPassword());
}
}
代码示例来源:origin: apache/incubator-shardingsphere
private YamlProxyServerConfiguration loadServerConfiguration(final File yamlFile) throws IOException {
try (
FileInputStream fileInputStream = new FileInputStream(yamlFile);
InputStreamReader inputStreamReader = new InputStreamReader(fileInputStream, "UTF-8")
) {
YamlProxyServerConfiguration result = new Yaml(new Constructor(YamlProxyServerConfiguration.class)).loadAs(inputStreamReader, YamlProxyServerConfiguration.class);
Preconditions.checkNotNull(result, "Server configuration file `%s` is invalid.", yamlFile.getName());
Preconditions.checkState(!Strings.isNullOrEmpty(result.getAuthentication().getUsername()) || null != result.getOrchestration(), "Authority configuration is invalid.");
return result;
}
}
代码示例来源:origin: apache/incubator-shardingsphere
private YamlProxyServerConfiguration loadServerConfiguration(final File yamlFile) throws IOException {
try (
FileInputStream fileInputStream = new FileInputStream(yamlFile);
InputStreamReader inputStreamReader = new InputStreamReader(fileInputStream, "UTF-8")
) {
YamlProxyServerConfiguration result = new Yaml(new Constructor(YamlProxyServerConfiguration.class)).loadAs(inputStreamReader, YamlProxyServerConfiguration.class);
Preconditions.checkNotNull(result, "Server configuration file `%s` is invalid.", yamlFile.getName());
Preconditions.checkState(!Strings.isNullOrEmpty(result.getAuthentication().getUsername()) || null != result.getOrchestration(), "Authority configuration is invalid.");
return result;
}
}
代码示例来源:origin: apache/incubator-shardingsphere
private static void initShardingOrchestrationFacade(
final YamlProxyServerConfiguration serverConfig, final Map<String, YamlProxyRuleConfiguration> ruleConfigs, final ShardingOrchestrationFacade shardingOrchestrationFacade) {
if (ruleConfigs.isEmpty()) {
shardingOrchestrationFacade.init();
} else {
shardingOrchestrationFacade.init(getDataSourceConfigurationMap(ruleConfigs), getRuleConfiguration(ruleConfigs),
new Authentication(serverConfig.getAuthentication().getUsername(), serverConfig.getAuthentication().getPassword()), serverConfig.getConfigMap(), serverConfig.getProps());
}
}
代码示例来源:origin: apache/incubator-shardingsphere
private static void initShardingOrchestrationFacade(
final YamlProxyServerConfiguration serverConfig, final Map<String, YamlProxyRuleConfiguration> ruleConfigs, final ShardingOrchestrationFacade shardingOrchestrationFacade) {
if (ruleConfigs.isEmpty()) {
shardingOrchestrationFacade.init();
} else {
shardingOrchestrationFacade.init(getDataSourceConfigurationMap(ruleConfigs), getRuleConfiguration(ruleConfigs),
new Authentication(serverConfig.getAuthentication().getUsername(), serverConfig.getAuthentication().getPassword()), serverConfig.getConfigMap(), serverConfig.getProps());
}
}
代码示例来源:origin: apache/incubator-shardingsphere
/**
* Main entrance.
*
* @param args startup arguments
* @throws InterruptedException interrupted exception
* @throws IOException IO exception
*/
public static void main(final String[] args) throws InterruptedException, IOException {
ShardingConfiguration shardingConfig = new ShardingConfigurationLoader().load();
int port = getPort(args);
new ProxyListenerRegister().register();
if (null == shardingConfig.getServerConfiguration().getOrchestration()) {
startWithoutRegistryCenter(shardingConfig.getRuleConfigurationMap(),
new Authentication(shardingConfig.getServerConfiguration().getAuthentication().getUsername(), shardingConfig.getServerConfiguration().getAuthentication().getPassword()),
shardingConfig.getServerConfiguration().getConfigMap(), shardingConfig.getServerConfiguration().getProps(), port);
} else {
startWithRegistryCenter(shardingConfig.getServerConfiguration(), shardingConfig.getRuleConfigurationMap().keySet(), shardingConfig.getRuleConfigurationMap(), port);
}
}
代码示例来源:origin: apache/incubator-shardingsphere
/**
* Main entrance.
*
* @param args startup arguments
* @throws InterruptedException interrupted exception
* @throws IOException IO exception
*/
public static void main(final String[] args) throws InterruptedException, IOException {
ShardingConfiguration shardingConfig = new ShardingConfigurationLoader().load();
int port = getPort(args);
new ProxyListenerRegister().register();
if (null == shardingConfig.getServerConfiguration().getOrchestration()) {
startWithoutRegistryCenter(shardingConfig.getRuleConfigurationMap(),
new Authentication(shardingConfig.getServerConfiguration().getAuthentication().getUsername(), shardingConfig.getServerConfiguration().getAuthentication().getPassword()),
shardingConfig.getServerConfiguration().getConfigMap(), shardingConfig.getServerConfiguration().getProps(), port);
} else {
startWithRegistryCenter(shardingConfig.getServerConfiguration(), shardingConfig.getRuleConfigurationMap().keySet(), shardingConfig.getRuleConfigurationMap(), port);
}
}
内容来源于网络,如有侵权,请联系作者删除!