gpt4 book ai didi

org.apache.shardingsphere.core.yaml.YamlAuthentication类的使用及代码示例

转载 作者:知者 更新时间:2024-03-17 06:09:31 26 4
gpt4 key购买 nike

本文整理了Java中org.apache.shardingsphere.core.yaml.YamlAuthentication类的一些代码示例,展示了YamlAuthentication类的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。YamlAuthentication类的具体详情如下:
包路径:org.apache.shardingsphere.core.yaml.YamlAuthentication
类名称:YamlAuthentication

YamlAuthentication介绍

[英]Authentication for YAML.
[中]YAML的身份验证。

代码示例

代码示例来源: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

@Override
  public String dump(final Authentication authentication) {
    YamlAuthentication yamlAuthentication = new YamlAuthentication();
    yamlAuthentication.setUsername(authentication.getUsername());
    yamlAuthentication.setPassword(authentication.getPassword());
    return new Yaml(new DefaultYamlRepresenter()).dumpAsMap(yamlAuthentication);
  }
}

代码示例来源: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);
  }
}

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com