Java Code Examples for sun.security.krb5.internal.ccache.CredentialsCache#update()

The following examples show how to use sun.security.krb5.internal.ccache.CredentialsCache#update() . 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: Context.java    From dragonwell8_jdk with GNU General Public License v2.0 6 votes vote down vote up
/**
 * Saves the tickets to a ccache file.
 *
 * @param file pathname of the ccache file
 * @return true if created, false otherwise.
 */
public boolean ccache(String file) throws Exception {
    Set<KerberosTicket> tickets
            = s.getPrivateCredentials(KerberosTicket.class);
    if (tickets != null && !tickets.isEmpty()) {
        CredentialsCache cc = null;
        for (KerberosTicket t : tickets) {
            Credentials cred = Krb5Util.ticketToCreds(t);
            if (cc == null) {
                cc = CredentialsCache.create(cred.getClient(), file);
            }
            cc.update(cred.toCCacheCreds());
        }
        if (cc != null) {
            cc.save();
            return true;
        }
    }
    return false;
}
 
Example 2
Source File: Context.java    From TencentKona-8 with GNU General Public License v2.0 6 votes vote down vote up
/**
 * Saves the tickets to a ccache file.
 *
 * @param file pathname of the ccache file
 * @return true if created, false otherwise.
 */
public boolean ccache(String file) throws Exception {
    Set<KerberosTicket> tickets
            = s.getPrivateCredentials(KerberosTicket.class);
    if (tickets != null && !tickets.isEmpty()) {
        CredentialsCache cc = null;
        for (KerberosTicket t : tickets) {
            Credentials cred = Krb5Util.ticketToCreds(t);
            if (cc == null) {
                cc = CredentialsCache.create(cred.getClient(), file);
            }
            cc.update(cred.toCCacheCreds());
        }
        if (cc != null) {
            cc.save();
            return true;
        }
    }
    return false;
}
 
Example 3
Source File: Context.java    From openjdk-jdk8u with GNU General Public License v2.0 6 votes vote down vote up
/**
 * Saves the tickets to a ccache file.
 *
 * @param file pathname of the ccache file
 * @return true if created, false otherwise.
 */
public boolean ccache(String file) throws Exception {
    Set<KerberosTicket> tickets
            = s.getPrivateCredentials(KerberosTicket.class);
    if (tickets != null && !tickets.isEmpty()) {
        CredentialsCache cc = null;
        for (KerberosTicket t : tickets) {
            Credentials cred = Krb5Util.ticketToCreds(t);
            if (cc == null) {
                cc = CredentialsCache.create(cred.getClient(), file);
            }
            cc.update(cred.toCCacheCreds());
        }
        if (cc != null) {
            cc.save();
            return true;
        }
    }
    return false;
}
 
Example 4
Source File: Context.java    From jdk8u_jdk with GNU General Public License v2.0 6 votes vote down vote up
/**
 * Saves the tickets to a ccache file.
 *
 * @param file pathname of the ccache file
 * @return true if created, false otherwise.
 */
public boolean ccache(String file) throws Exception {
    Set<KerberosTicket> tickets
            = s.getPrivateCredentials(KerberosTicket.class);
    if (tickets != null && !tickets.isEmpty()) {
        CredentialsCache cc = null;
        for (KerberosTicket t : tickets) {
            Credentials cred = Krb5Util.ticketToCreds(t);
            if (cc == null) {
                cc = CredentialsCache.create(cred.getClient(), file);
            }
            cc.update(cred.toCCacheCreds());
        }
        if (cc != null) {
            cc.save();
            return true;
        }
    }
    return false;
}