Java Code Examples for sun.security.krb5.Credentials#getEndTime()

The following examples show how to use sun.security.krb5.Credentials#getEndTime() . 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: Krb5Util.java    From openjdk-8-source with GNU General Public License v2.0 6 votes vote down vote up
public static KerberosTicket credsToTicket(Credentials serviceCreds) {
    EncryptionKey sessionKey =  serviceCreds.getSessionKey();
    return new KerberosTicket(
        serviceCreds.getEncoded(),
        new KerberosPrincipal(serviceCreds.getClient().getName()),
        new KerberosPrincipal(serviceCreds.getServer().getName(),
                            KerberosPrincipal.KRB_NT_SRV_INST),
        sessionKey.getBytes(),
        sessionKey.getEType(),
        serviceCreds.getFlags(),
        serviceCreds.getAuthTime(),
        serviceCreds.getStartTime(),
        serviceCreds.getEndTime(),
        serviceCreds.getRenewTill(),
        serviceCreds.getClientAddresses());
}
 
Example 2
Source File: Krb5LoginModule.java    From openjdk-jdk9 with GNU General Public License v2.0 6 votes vote down vote up
private static boolean isOld(Credentials creds)
{
    Date endTime = creds.getEndTime();
    if (endTime != null) {
        Date authTime = creds.getAuthTime();
        long now = System.currentTimeMillis();
        if (authTime != null) {
            // pass the mid between auth and end
            return now - authTime.getTime() > endTime.getTime() - now;
        } else {
            // will expire in less than 2 hours
            return now <= endTime.getTime() - 1000*3600*2L;
        }
    }
    return false;
}
 
Example 3
Source File: Krb5Util.java    From jdk8u-jdk with GNU General Public License v2.0 6 votes vote down vote up
public static KerberosTicket credsToTicket(Credentials serviceCreds) {
    EncryptionKey sessionKey =  serviceCreds.getSessionKey();
    return new KerberosTicket(
        serviceCreds.getEncoded(),
        new KerberosPrincipal(serviceCreds.getClient().getName()),
        new KerberosPrincipal(serviceCreds.getServer().getName(),
                            KerberosPrincipal.KRB_NT_SRV_INST),
        sessionKey.getBytes(),
        sessionKey.getEType(),
        serviceCreds.getFlags(),
        serviceCreds.getAuthTime(),
        serviceCreds.getStartTime(),
        serviceCreds.getEndTime(),
        serviceCreds.getRenewTill(),
        serviceCreds.getClientAddresses());
}
 
Example 4
Source File: Krb5Util.java    From jdk8u60 with GNU General Public License v2.0 6 votes vote down vote up
public static KerberosTicket credsToTicket(Credentials serviceCreds) {
    EncryptionKey sessionKey =  serviceCreds.getSessionKey();
    return new KerberosTicket(
        serviceCreds.getEncoded(),
        new KerberosPrincipal(serviceCreds.getClient().getName()),
        new KerberosPrincipal(serviceCreds.getServer().getName(),
                            KerberosPrincipal.KRB_NT_SRV_INST),
        sessionKey.getBytes(),
        sessionKey.getEType(),
        serviceCreds.getFlags(),
        serviceCreds.getAuthTime(),
        serviceCreds.getStartTime(),
        serviceCreds.getEndTime(),
        serviceCreds.getRenewTill(),
        serviceCreds.getClientAddresses());
}
 
Example 5
Source File: Krb5Util.java    From openjdk-jdk9 with GNU General Public License v2.0 6 votes vote down vote up
public static KerberosTicket credsToTicket(Credentials serviceCreds) {
    EncryptionKey sessionKey =  serviceCreds.getSessionKey();
    return new KerberosTicket(
        serviceCreds.getEncoded(),
        new KerberosPrincipal(serviceCreds.getClient().getName()),
        new KerberosPrincipal(serviceCreds.getServer().getName(),
                            KerberosPrincipal.KRB_NT_SRV_INST),
        sessionKey.getBytes(),
        sessionKey.getEType(),
        serviceCreds.getFlags(),
        serviceCreds.getAuthTime(),
        serviceCreds.getStartTime(),
        serviceCreds.getEndTime(),
        serviceCreds.getRenewTill(),
        serviceCreds.getClientAddresses());
}
 
Example 6
Source File: Krb5Util.java    From openjdk-8 with GNU General Public License v2.0 6 votes vote down vote up
public static KerberosTicket credsToTicket(Credentials serviceCreds) {
    EncryptionKey sessionKey =  serviceCreds.getSessionKey();
    return new KerberosTicket(
        serviceCreds.getEncoded(),
        new KerberosPrincipal(serviceCreds.getClient().getName()),
        new KerberosPrincipal(serviceCreds.getServer().getName(),
                            KerberosPrincipal.KRB_NT_SRV_INST),
        sessionKey.getBytes(),
        sessionKey.getEType(),
        serviceCreds.getFlags(),
        serviceCreds.getAuthTime(),
        serviceCreds.getStartTime(),
        serviceCreds.getEndTime(),
        serviceCreds.getRenewTill(),
        serviceCreds.getClientAddresses());
}
 
Example 7
Source File: Krb5LoginModule.java    From hottub with GNU General Public License v2.0 5 votes vote down vote up
private boolean isCurrent(Credentials creds)
{
    Date endTime = creds.getEndTime();
    if (endTime != null) {
        return (System.currentTimeMillis() <= endTime.getTime());
    }
    return true;
}
 
Example 8
Source File: Krb5LoginModule.java    From jdk8u-jdk with GNU General Public License v2.0 5 votes vote down vote up
private boolean isCurrent(Credentials creds)
{
    Date endTime = creds.getEndTime();
    if (endTime != null) {
        return (System.currentTimeMillis() <= endTime.getTime());
    }
    return true;
}
 
Example 9
Source File: Krb5LoginModule.java    From openjdk-8 with GNU General Public License v2.0 5 votes vote down vote up
private boolean isCurrent(Credentials creds)
{
    Date endTime = creds.getEndTime();
    if (endTime != null) {
        return (System.currentTimeMillis() <= endTime.getTime());
    }
    return true;
}
 
Example 10
Source File: Krb5LoginModule.java    From openjdk-jdk9 with GNU General Public License v2.0 5 votes vote down vote up
private static boolean isCurrent(Credentials creds)
{
    Date endTime = creds.getEndTime();
    if (endTime != null) {
        return (System.currentTimeMillis() <= endTime.getTime());
    }
    return true;
}
 
Example 11
Source File: Krb5LoginModule.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 5 votes vote down vote up
private boolean isCurrent(Credentials creds)
{
    Date endTime = creds.getEndTime();
    if (endTime != null) {
        return (System.currentTimeMillis() <= endTime.getTime());
    }
    return true;
}
 
Example 12
Source File: Krb5LoginModule.java    From jdk8u-jdk with GNU General Public License v2.0 5 votes vote down vote up
private boolean isCurrent(Credentials creds)
{
    Date endTime = creds.getEndTime();
    if (endTime != null) {
        return (System.currentTimeMillis() <= endTime.getTime());
    }
    return true;
}
 
Example 13
Source File: Krb5LoginModule.java    From openjdk-jdk8u with GNU General Public License v2.0 5 votes vote down vote up
private static boolean isCurrent(Credentials creds)
{
    Date endTime = creds.getEndTime();
    if (endTime != null) {
        return (System.currentTimeMillis() <= endTime.getTime());
    }
    return true;
}
 
Example 14
Source File: Krb5LoginModule.java    From jdk8u_jdk with GNU General Public License v2.0 5 votes vote down vote up
private static boolean isCurrent(Credentials creds)
{
    Date endTime = creds.getEndTime();
    if (endTime != null) {
        return (System.currentTimeMillis() <= endTime.getTime());
    }
    return true;
}
 
Example 15
Source File: Krb5LoginModule.java    From JDKSourceCode1.8 with MIT License 5 votes vote down vote up
private boolean isCurrent(Credentials creds)
{
    Date endTime = creds.getEndTime();
    if (endTime != null) {
        return (System.currentTimeMillis() <= endTime.getTime());
    }
    return true;
}
 
Example 16
Source File: Krb5LoginModule.java    From jdk8u60 with GNU General Public License v2.0 5 votes vote down vote up
private boolean isCurrent(Credentials creds)
{
    Date endTime = creds.getEndTime();
    if (endTime != null) {
        return (System.currentTimeMillis() <= endTime.getTime());
    }
    return true;
}
 
Example 17
Source File: Krb5LoginModule.java    From TencentKona-8 with GNU General Public License v2.0 5 votes vote down vote up
private static boolean isCurrent(Credentials creds)
{
    Date endTime = creds.getEndTime();
    if (endTime != null) {
        return (System.currentTimeMillis() <= endTime.getTime());
    }
    return true;
}
 
Example 18
Source File: Krb5Util.java    From TencentKona-8 with GNU General Public License v2.0 5 votes vote down vote up
public static KerberosTicket credsToTicket(Credentials serviceCreds) {
    EncryptionKey sessionKey =  serviceCreds.getSessionKey();
    KerberosTicket kt = new KerberosTicket(
        serviceCreds.getEncoded(),
        new KerberosPrincipal(serviceCreds.getClient().getName()),
        new KerberosPrincipal(serviceCreds.getServer().getName(),
                            KerberosPrincipal.KRB_NT_SRV_INST),
        sessionKey.getBytes(),
        sessionKey.getEType(),
        serviceCreds.getFlags(),
        serviceCreds.getAuthTime(),
        serviceCreds.getStartTime(),
        serviceCreds.getEndTime(),
        serviceCreds.getRenewTill(),
        serviceCreds.getClientAddresses());
    PrincipalName clientAlias = serviceCreds.getClientAlias();
    PrincipalName serverAlias = serviceCreds.getServerAlias();
    if (clientAlias != null) {
        KerberosSecrets.getJavaxSecurityAuthKerberosAccess()
                .kerberosTicketSetClientAlias(kt, new KerberosPrincipal(
                        clientAlias.getName(), clientAlias.getNameType()));
    }
    if (serverAlias != null) {
        KerberosSecrets.getJavaxSecurityAuthKerberosAccess()
                .kerberosTicketSetServerAlias(kt, new KerberosPrincipal(
                        serverAlias.getName(), serverAlias.getNameType()));
    }
    return kt;
}
 
Example 19
Source File: Krb5LoginModule.java    From dragonwell8_jdk with GNU General Public License v2.0 5 votes vote down vote up
private static boolean isCurrent(Credentials creds)
{
    Date endTime = creds.getEndTime();
    if (endTime != null) {
        return (System.currentTimeMillis() <= endTime.getTime());
    }
    return true;
}
 
Example 20
Source File: Krb5Util.java    From dragonwell8_jdk with GNU General Public License v2.0 5 votes vote down vote up
public static KerberosTicket credsToTicket(Credentials serviceCreds) {
    EncryptionKey sessionKey =  serviceCreds.getSessionKey();
    KerberosTicket kt = new KerberosTicket(
        serviceCreds.getEncoded(),
        new KerberosPrincipal(serviceCreds.getClient().getName()),
        new KerberosPrincipal(serviceCreds.getServer().getName(),
                            KerberosPrincipal.KRB_NT_SRV_INST),
        sessionKey.getBytes(),
        sessionKey.getEType(),
        serviceCreds.getFlags(),
        serviceCreds.getAuthTime(),
        serviceCreds.getStartTime(),
        serviceCreds.getEndTime(),
        serviceCreds.getRenewTill(),
        serviceCreds.getClientAddresses());
    PrincipalName clientAlias = serviceCreds.getClientAlias();
    PrincipalName serverAlias = serviceCreds.getServerAlias();
    if (clientAlias != null) {
        KerberosSecrets.getJavaxSecurityAuthKerberosAccess()
                .kerberosTicketSetClientAlias(kt, new KerberosPrincipal(
                        clientAlias.getName(), clientAlias.getNameType()));
    }
    if (serverAlias != null) {
        KerberosSecrets.getJavaxSecurityAuthKerberosAccess()
                .kerberosTicketSetServerAlias(kt, new KerberosPrincipal(
                        serverAlias.getName(), serverAlias.getNameType()));
    }
    return kt;
}