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

The following examples show how to use sun.security.krb5.internal.ccache.FileCredentialsCache. These examples are extracted from open source projects. 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 Project: dragonwell8_jdk   Source File: DefaultFile.java    License: 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 Project: dragonwell8_jdk   Source File: Renewal.java    License: 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 Project: TencentKona-8   Source File: DefaultFile.java    License: 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 Project: TencentKona-8   Source File: Renewal.java    License: 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 Project: jdk8u60   Source File: DefaultFile.java    License: 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 Project: openjdk-jdk8u   Source File: DefaultFile.java    License: 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 Project: openjdk-jdk8u   Source File: Renewal.java    License: 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
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 Project: openjdk-jdk9   Source File: DefaultFile.java    License: 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 Project: openjdk-jdk9   Source File: Renewal.java    License: 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 Project: jdk8u-jdk   Source File: DefaultFile.java    License: 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 Project: hottub   Source File: DefaultFile.java    License: 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 Project: jdk8u_jdk   Source File: DefaultFile.java    License: 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 Project: jdk8u_jdk   Source File: Renewal.java    License: 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 Project: jdk8u-jdk   Source File: DefaultFile.java    License: 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 Project: jdk8u-dev-jdk   Source File: DefaultFile.java    License: 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);
    }
}