Search in sources :

Example 1 with CCacheInputStream

use of sun.security.krb5.internal.ccache.CCacheInputStream in project jdk8u_jdk by JetBrains.

the class TimeInCCache method main.

public static void main(String[] args) throws Exception {
    // test code changes in DEBUG
    System.setProperty("sun.security.krb5.debug", "true");
    CCacheInputStream cis = new CCacheInputStream(new ByteArrayInputStream(ccache));
    cis.readVersion();
    cis.readTag();
    cis.readPrincipal(0x504);
    Method m = CCacheInputStream.class.getDeclaredMethod("readCred", Integer.TYPE);
    m.setAccessible(true);
    Credentials c = (Credentials) m.invoke(cis, new Integer(0x504));
    sun.security.krb5.Credentials cc = c.setKrbCreds();
    // 1. Make sure starttime is still null
    if (cc.getStartTime() != null) {
        throw new Exception("Fail, starttime should be zero here");
    }
    // 2. Make sure renewTill is still null
    if (cc.getRenewTill() != null) {
        throw new Exception("Fail, renewTill should be zero here");
    }
    // 3. Make sure isValid works
    c.isValid();
}
Also used : CCacheInputStream(sun.security.krb5.internal.ccache.CCacheInputStream) ByteArrayInputStream(java.io.ByteArrayInputStream) Method(java.lang.reflect.Method) Credentials(sun.security.krb5.internal.ccache.Credentials)

Aggregations

ByteArrayInputStream (java.io.ByteArrayInputStream)1 Method (java.lang.reflect.Method)1 CCacheInputStream (sun.security.krb5.internal.ccache.CCacheInputStream)1 Credentials (sun.security.krb5.internal.ccache.Credentials)1