Java Code Examples for sun.security.krb5.Config#get()

The following examples show how to use sun.security.krb5.Config#get() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: ParseConfig.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 6 votes vote down vote up
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");
}
 
Example 2
Source File: ParseConfig.java    From TencentKona-8 with GNU General Public License v2.0 6 votes vote down vote up
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");
}
 
Example 3
Source File: ParseConfig.java    From jdk8u-dev-jdk with GNU General Public License v2.0 6 votes vote down vote up
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");
}
 
Example 4
Source File: ParseConfig.java    From hottub with GNU General Public License v2.0 6 votes vote down vote up
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");
}
 
Example 5
Source File: Duplicates.java    From jdk8u-jdk with GNU General Public License v2.0 5 votes vote down vote up
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);
    }
}
 
Example 6
Source File: Duplicates.java    From openjdk-jdk9 with GNU General Public License v2.0 5 votes vote down vote up
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);
    }
}
 
Example 7
Source File: EType.java    From jdk8u-jdk with GNU General Public License v2.0 5 votes vote down vote up
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;
}
 
Example 8
Source File: Duplicates.java    From jdk8u-dev-jdk with GNU General Public License v2.0 5 votes vote down vote up
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);
    }
}
 
Example 9
Source File: EType.java    From jdk8u-dev-jdk with GNU General Public License v2.0 5 votes vote down vote up
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;
}
 
Example 10
Source File: Duplicates.java    From openjdk-jdk8u with GNU General Public License v2.0 5 votes vote down vote up
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);
    }
}
 
Example 11
Source File: EType.java    From jdk8u-jdk with GNU General Public License v2.0 5 votes vote down vote up
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;
}
 
Example 12
Source File: EType.java    From dragonwell8_jdk with GNU General Public License v2.0 5 votes vote down vote up
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;
}
 
Example 13
Source File: Duplicates.java    From TencentKona-8 with GNU General Public License v2.0 5 votes vote down vote up
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);
    }
}
 
Example 14
Source File: Duplicates.java    From jdk8u_jdk with GNU General Public License v2.0 5 votes vote down vote up
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);
    }
}
 
Example 15
Source File: Duplicates.java    From openjdk-8 with GNU General Public License v2.0 5 votes vote down vote up
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);
    }
}
 
Example 16
Source File: Duplicates.java    From hottub with GNU General Public License v2.0 5 votes vote down vote up
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);
    }
}
 
Example 17
Source File: Duplicates.java    From dragonwell8_jdk with GNU General Public License v2.0 5 votes vote down vote up
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);
    }
}
 
Example 18
Source File: Semicolon.java    From openjdk-jdk8u with GNU General Public License v2.0 4 votes vote down vote up
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");
}
 
Example 19
Source File: Semicolon.java    From jdk8u_jdk with GNU General Public License v2.0 4 votes vote down vote up
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");
}
 
Example 20
Source File: Semicolon.java    From dragonwell8_jdk with GNU General Public License v2.0 4 votes vote down vote up
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");
}