本文整理汇总了Java中sun.security.krb5.Config.get方法的典型用法代码示例。如果您正苦于以下问题:Java Config.get方法的具体用法?Java Config.get怎么用?Java Config.get使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类sun.security.krb5.Config
的用法示例。
在下文中一共展示了Config.get方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: main
import sun.security.krb5.Config; //导入方法依赖的package包/类
public static void main(String[] args) throws Exception {
System.setProperty("java.security.krb5.conf",
System.getProperty("test.src", ".") + "/krb5.conf");
Config config = Config.getInstance();
config.listTable();
String sample = "kdc.example.com kdc2.example.com";
for ( int i = 0; i < 4; i++ ) {
String expected = config.getAll("realms", "EXAMPLE_" + i + ".COM", "kdc");
if (!sample.equals(expected)) {
throw new Exception("krb5.conf: unexpected kdc value \"" +
expected + "\"");
}
}
// JDK-8055045: IOOBE when reading an empty value
config.get("empty1", "NOVAL.COM");
config.get("empty2", "NOVAL.COM");
config.get("quote1", "NOVAL.COM");
config.get("quote2", "NOVAL.COM");
}
示例2: initStatic
import sun.security.krb5.Config; //导入方法依赖的package包/类
public static void initStatic() {
boolean allowed = false;
try {
Config cfg = Config.getInstance();
String temp = cfg.get("libdefaults", "allow_weak_crypto");
if (temp != null && temp.equals("true")) allowed = true;
} catch (Exception exc) {
if (DEBUG) {
System.out.println ("Exception in getting allow_weak_crypto, " +
"using default value " +
exc.getMessage());
}
}
allowWeakCrypto = allowed;
}
示例3: main
import sun.security.krb5.Config; //导入方法依赖的package包/类
public static void main(String[] args) throws Exception {
System.setProperty("java.security.krb5.conf",
System.getProperty("test.src", ".") +"/k1.conf");
Config config = Config.getInstance();
config.listTable();
String s;
// Latter overwrites former for root section
s = config.get("libdefaults", "default_realm");
if (s != null) {
throw new Exception();
}
// Latter overwrites former for strings
s = config.get("libdefaults", "default_tkt_enctypes");
if (!s.equals("aes256-cts")) {
throw new Exception();
}
// Latter overwrites former for sub-section
s = config.get("realms", "R1", "kdc");
if (!s.equals("k2")) {
throw new Exception(s);
}
// Duplicate keys in [realms] are merged
s = config.getAll("realms", "R2", "kdc");
if (!s.equals("k1 k2 k3 k4")) {
throw new Exception(s);
}
// Duplicate keys in [capaths] are merged
s = config.getAll("capaths", "R1", "R2");
if (!s.equals("R3 R4 R5 R6")) {
throw new Exception(s);
}
// We can be very deep now
s = config.get("new", "x", "y", "z", "a", "b", "c");
if (!s.equals("d")) {
throw new Exception(s);
}
}
示例4: main
import sun.security.krb5.Config; //导入方法依赖的package包/类
public static void main(String[] args) throws Exception {
System.setProperty("java.security.krb5.conf",
System.getProperty("test.src", ".") +"/k1.conf");
Config config = Config.getInstance();
config.listTable();
String s;
// root section merged
s = config.get("libdefaults", "default_realm");
if (!s.equals("R1")) {
throw new Exception();
}
// Former is preferred to latter for strings and sections
s = config.get("libdefaults", "default_tkt_enctypes");
if (!s.equals("aes128-cts")) {
throw new Exception();
}
s = config.get("realms", "R1", "kdc");
if (!s.equals("k1")) {
throw new Exception(s);
}
// Duplicate keys in [realms] are merged, and sections with the same
// name in between ignored
s = config.getAll("realms", "R2", "kdc");
if (!s.equals("k1 k2 k3 k4")) {
throw new Exception(s);
}
// Duplicate keys in [capaths] are merged
s = config.getAll("capaths", "R1", "R2");
if (!s.equals("R3 R4 R5 R6")) {
throw new Exception(s);
}
// We can be very deep now
s = config.get("new", "x", "y", "z", "a", "b", "c");
if (!s.equals("d")) {
throw new Exception(s);
}
}
示例5: main
import sun.security.krb5.Config; //导入方法依赖的package包/类
public static void main(String[] args) throws Throwable {
System.setProperty("java.security.krb5.conf",
System.getProperty("test.src", ".") + "/comments.conf");
Config config = Config.getInstance();
config.get("section", "value");
}