sun.security.krb5.internal.ccache.FileCredentialsCache Java Examples

The following examples show how to use sun.security.krb5.internal.ccache.FileCredentialsCache. 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: DefaultFile.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 {
    // There are 2 cases where default ccache name is not
    // /tmp/krb5cc_uid.
    if (System.getenv("KRB5CCNAME") != null) {
        return;
    }
    if (System.getProperty("os.name").startsWith("Windows")) {
        return;
    }
    String name = FileCredentialsCache.getDefaultCacheName();
    if (!name.startsWith("/tmp/krb5cc_")) {
        throw new Exception("default name is " + name);
    }
}
 
Example #2
Source File: Renewal.java    From dragonwell8_jdk with GNU General Public License v2.0 5 votes vote down vote up
static void checkKinit(
        String s1,      // ticket_lifetime in krb5.conf, null if none
        String s2,      // renew_lifetime in krb5.conf, null if none
        String c1,      // -l on kinit, null if none
        String c2,      // -r on kinit, null if none
        int t1, int t2  // expected lifetimes, -1 of unexpected
            ) throws Exception {
    KDC.saveConfig(OneKDC.KRB5_CONF, kdc,
            s1 != null ? ("ticket_lifetime = " + s1) : "",
            s2 != null ? ("renew_lifetime = " + s2) : "");
    Proc p = Proc.create(clazz);
    if (c1 != null) {
        p.args("-l", c1);
    }
    if (c2 != null) {
        p.args("-r", c2);
    }
    count++;
    p.args(OneKDC.USER, new String(OneKDC.PASS))
            .inheritIO()
            .prop("sun.net.spi.nameservice.provider.1", "ns,mock")
            .prop("java.security.krb5.conf", OneKDC.KRB5_CONF)
            .env("KRB5CCNAME", "ccache" + count)
            .start();
    if (p.waitFor() != 0) {
        throw new Exception();
    }
    FileCredentialsCache fcc =
            FileCredentialsCache.acquireInstance(null, "ccache" + count);
    Credentials cred = fcc.getDefaultCreds();
    checkRough(cred.getEndTime().toDate(), t1);
    if (cred.getRenewTill() == null) {
        checkRough(null, t2);
    } else {
        checkRough(cred.getRenewTill().toDate(), t2);
    }
}
 
Example #3
Source File: DefaultFile.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 {
    // There are 2 cases where default ccache name is not
    // /tmp/krb5cc_uid.
    if (System.getenv("KRB5CCNAME") != null) {
        return;
    }
    if (System.getProperty("os.name").startsWith("Windows")) {
        return;
    }
    String name = FileCredentialsCache.getDefaultCacheName();
    if (!name.startsWith("/tmp/krb5cc_")) {
        throw new Exception("default name is " + name);
    }
}
 
Example #4
Source File: Renewal.java    From TencentKona-8 with GNU General Public License v2.0 5 votes vote down vote up
static void checkKinit(
        String s1,      // ticket_lifetime in krb5.conf, null if none
        String s2,      // renew_lifetime in krb5.conf, null if none
        String c1,      // -l on kinit, null if none
        String c2,      // -r on kinit, null if none
        int t1, int t2  // expected lifetimes, -1 of unexpected
            ) throws Exception {
    KDC.saveConfig(OneKDC.KRB5_CONF, kdc,
            s1 != null ? ("ticket_lifetime = " + s1) : "",
            s2 != null ? ("renew_lifetime = " + s2) : "");
    Proc p = Proc.create(clazz);
    if (c1 != null) {
        p.args("-l", c1);
    }
    if (c2 != null) {
        p.args("-r", c2);
    }
    count++;
    p.args(OneKDC.USER, new String(OneKDC.PASS))
            .inheritIO()
            .prop("sun.net.spi.nameservice.provider.1", "ns,mock")
            .prop("java.security.krb5.conf", OneKDC.KRB5_CONF)
            .env("KRB5CCNAME", "ccache" + count)
            .start();
    if (p.waitFor() != 0) {
        throw new Exception();
    }
    FileCredentialsCache fcc =
            FileCredentialsCache.acquireInstance(null, "ccache" + count);
    Credentials cred = fcc.getDefaultCreds();
    checkRough(cred.getEndTime().toDate(), t1);
    if (cred.getRenewTill() == null) {
        checkRough(null, t2);
    } else {
        checkRough(cred.getRenewTill().toDate(), t2);
    }
}
 
Example #5
Source File: DefaultFile.java    From jdk8u60 with GNU General Public License v2.0 5 votes vote down vote up
public static void main(String[] args) throws Exception {
    // There are 2 cases where default ccache name is not
    // /tmp/krb5cc_uid.
    if (System.getenv("KRB5CCNAME") != null) {
        return;
    }
    if (System.getProperty("os.name").startsWith("Windows")) {
        return;
    }
    String name = FileCredentialsCache.getDefaultCacheName();
    if (!name.startsWith("/tmp/krb5cc_")) {
        throw new Exception("default name is " + name);
    }
}
 
Example #6
Source File: DefaultFile.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 {
    // There are 2 cases where default ccache name is not
    // /tmp/krb5cc_uid.
    if (System.getenv("KRB5CCNAME") != null) {
        return;
    }
    if (System.getProperty("os.name").startsWith("Windows")) {
        return;
    }
    String name = FileCredentialsCache.getDefaultCacheName();
    if (!name.startsWith("/tmp/krb5cc_")) {
        throw new Exception("default name is " + name);
    }
}
 
Example #7
Source File: Renewal.java    From openjdk-jdk8u with GNU General Public License v2.0 5 votes vote down vote up
static void checkKinit(
        String s1,      // ticket_lifetime in krb5.conf, null if none
        String s2,      // renew_lifetime in krb5.conf, null if none
        String c1,      // -l on kinit, null if none
        String c2,      // -r on kinit, null if none
        int t1, int t2  // expected lifetimes, -1 of unexpected
            ) throws Exception {
    KDC.saveConfig(OneKDC.KRB5_CONF, kdc,
            s1 != null ? ("ticket_lifetime = " + s1) : "",
            s2 != null ? ("renew_lifetime = " + s2) : "");
    Proc p = Proc.create(clazz);
    if (c1 != null) {
        p.args("-l", c1);
    }
    if (c2 != null) {
        p.args("-r", c2);
    }
    count++;
    p.args(OneKDC.USER, new String(OneKDC.PASS))
            .inheritIO()
            .prop("sun.net.spi.nameservice.provider.1", "ns,mock")
            .prop("java.security.krb5.conf", OneKDC.KRB5_CONF)
            .env("KRB5CCNAME", "ccache" + count)
            .start();
    if (p.waitFor() != 0) {
        throw new Exception();
    }
    FileCredentialsCache fcc =
            FileCredentialsCache.acquireInstance(null, "ccache" + count);
    Credentials cred = fcc.getDefaultCreds();
    checkRough(cred.getEndTime().toDate(), t1);
    if (cred.getRenewTill() == null) {
        checkRough(null, t2);
    } else {
        checkRough(cred.getRenewTill().toDate(), t2);
    }
}
 
Example #8
Source File: DefaultFile.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 5 votes vote down vote up
public static void main(String[] args) throws Exception {
    // There are 2 cases where default ccache name is not
    // /tmp/krb5cc_uid.
    if (System.getenv("KRB5CCNAME") != null) {
        return;
    }
    if (System.getProperty("os.name").startsWith("Windows")) {
        return;
    }
    String name = FileCredentialsCache.getDefaultCacheName();
    if (!name.startsWith("/tmp/krb5cc_")) {
        throw new Exception("default name is " + name);
    }
}
 
Example #9
Source File: DefaultFile.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 {
    // There are 2 cases where default ccache name is not
    // /tmp/krb5cc_uid.
    if (System.getenv("KRB5CCNAME") != null) {
        return;
    }
    if (System.getProperty("os.name").startsWith("Windows")) {
        return;
    }
    String name = FileCredentialsCache.getDefaultCacheName();
    if (!name.startsWith("/tmp/krb5cc_")) {
        throw new Exception("default name is " + name);
    }
}
 
Example #10
Source File: Renewal.java    From openjdk-jdk9 with GNU General Public License v2.0 5 votes vote down vote up
static void checkKinit(
        String s1,      // ticket_lifetime in krb5.conf, null if none
        String s2,      // renew_lifetime in krb5.conf, null if none
        String c1,      // -l on kinit, null if none
        String c2,      // -r on kinit, null if none
        int t1, int t2  // expected lifetimes, -1 of unexpected
            ) throws Exception {
    KDC.saveConfig(OneKDC.KRB5_CONF, kdc,
            s1 != null ? ("ticket_lifetime = " + s1) : "",
            s2 != null ? ("renew_lifetime = " + s2) : "");
    Proc p = Proc.create(clazz);
    if (c1 != null) {
        p.args("-l", c1);
    }
    if (c2 != null) {
        p.args("-r", c2);
    }
    count++;
    p.args(OneKDC.USER, new String(OneKDC.PASS))
            .inheritIO()
            .prop("jdk.net.hosts.file", hostsFileName)
            .prop("java.security.krb5.conf", OneKDC.KRB5_CONF)
            .env("KRB5CCNAME", "ccache" + count)
            .start();
    if (p.waitFor() != 0) {
        throw new Exception();
    }
    FileCredentialsCache fcc =
            FileCredentialsCache.acquireInstance(null, "ccache" + count);
    Credentials cred = fcc.getDefaultCreds();
    checkRough(cred.getEndTime().toDate(), t1);
    if (cred.getRenewTill() == null) {
        checkRough(null, t2);
    } else {
        checkRough(cred.getRenewTill().toDate(), t2);
    }
}
 
Example #11
Source File: DefaultFile.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 {
    // There are 2 cases where default ccache name is not
    // /tmp/krb5cc_uid.
    if (System.getenv("KRB5CCNAME") != null) {
        return;
    }
    if (System.getProperty("os.name").startsWith("Windows")) {
        return;
    }
    String name = FileCredentialsCache.getDefaultCacheName();
    if (!name.startsWith("/tmp/krb5cc_")) {
        throw new Exception("default name is " + name);
    }
}
 
Example #12
Source File: DefaultFile.java    From hottub with GNU General Public License v2.0 5 votes vote down vote up
public static void main(String[] args) throws Exception {
    // There are 2 cases where default ccache name is not
    // /tmp/krb5cc_uid.
    if (System.getenv("KRB5CCNAME") != null) {
        return;
    }
    if (System.getProperty("os.name").startsWith("Windows")) {
        return;
    }
    String name = FileCredentialsCache.getDefaultCacheName();
    if (!name.startsWith("/tmp/krb5cc_")) {
        throw new Exception("default name is " + name);
    }
}
 
Example #13
Source File: DefaultFile.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 {
    // There are 2 cases where default ccache name is not
    // /tmp/krb5cc_uid.
    if (System.getenv("KRB5CCNAME") != null) {
        return;
    }
    if (System.getProperty("os.name").startsWith("Windows")) {
        return;
    }
    String name = FileCredentialsCache.getDefaultCacheName();
    if (!name.startsWith("/tmp/krb5cc_")) {
        throw new Exception("default name is " + name);
    }
}
 
Example #14
Source File: Renewal.java    From jdk8u_jdk with GNU General Public License v2.0 5 votes vote down vote up
static void checkKinit(
        String s1,      // ticket_lifetime in krb5.conf, null if none
        String s2,      // renew_lifetime in krb5.conf, null if none
        String c1,      // -l on kinit, null if none
        String c2,      // -r on kinit, null if none
        int t1, int t2  // expected lifetimes, -1 of unexpected
            ) throws Exception {
    KDC.saveConfig(OneKDC.KRB5_CONF, kdc,
            s1 != null ? ("ticket_lifetime = " + s1) : "",
            s2 != null ? ("renew_lifetime = " + s2) : "");
    Proc p = Proc.create(clazz);
    if (c1 != null) {
        p.args("-l", c1);
    }
    if (c2 != null) {
        p.args("-r", c2);
    }
    count++;
    p.args(OneKDC.USER, new String(OneKDC.PASS))
            .inheritIO()
            .prop("sun.net.spi.nameservice.provider.1", "ns,mock")
            .prop("java.security.krb5.conf", OneKDC.KRB5_CONF)
            .env("KRB5CCNAME", "ccache" + count)
            .start();
    if (p.waitFor() != 0) {
        throw new Exception();
    }
    FileCredentialsCache fcc =
            FileCredentialsCache.acquireInstance(null, "ccache" + count);
    Credentials cred = fcc.getDefaultCreds();
    checkRough(cred.getEndTime().toDate(), t1);
    if (cred.getRenewTill() == null) {
        checkRough(null, t2);
    } else {
        checkRough(cred.getRenewTill().toDate(), t2);
    }
}
 
Example #15
Source File: DefaultFile.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 {
    // There are 2 cases where default ccache name is not
    // /tmp/krb5cc_uid.
    if (System.getenv("KRB5CCNAME") != null) {
        return;
    }
    if (System.getProperty("os.name").startsWith("Windows")) {
        return;
    }
    String name = FileCredentialsCache.getDefaultCacheName();
    if (!name.startsWith("/tmp/krb5cc_")) {
        throw new Exception("default name is " + name);
    }
}
 
Example #16
Source File: DefaultFile.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 {
    // There are 2 cases where default ccache name is not
    // /tmp/krb5cc_uid.
    if (System.getenv("KRB5CCNAME") != null) {
        return;
    }
    if (System.getProperty("os.name").startsWith("Windows")) {
        return;
    }
    String name = FileCredentialsCache.getDefaultCacheName();
    if (!name.startsWith("/tmp/krb5cc_")) {
        throw new Exception("default name is " + name);
    }
}