Search in sources :

Example 1 with Krb5AcceptCredential

use of sun.security.jgss.krb5.Krb5AcceptCredential in project jdk8u_jdk by JetBrains.

the class SpNegoMechFactory method getCredFromSubject.

private static SpNegoCredElement getCredFromSubject(GSSNameSpi name, boolean initiate) throws GSSException {
    Vector<SpNegoCredElement> creds = GSSUtil.searchSubject(name, GSS_SPNEGO_MECH_OID, initiate, SpNegoCredElement.class);
    SpNegoCredElement result = ((creds == null || creds.isEmpty()) ? null : creds.firstElement());
    // Force permission check before returning the cred to caller
    if (result != null) {
        GSSCredentialSpi cred = result.getInternalCred();
        if (GSSUtil.isKerberosMech(cred.getMechanism())) {
            if (initiate) {
                Krb5InitCredential krbCred = (Krb5InitCredential) cred;
                Krb5MechFactory.checkInitCredPermission((Krb5NameElement) krbCred.getName());
            } else {
                Krb5AcceptCredential krbCred = (Krb5AcceptCredential) cred;
                Krb5MechFactory.checkAcceptCredPermission((Krb5NameElement) krbCred.getName(), name);
            }
        }
    }
    return result;
}
Also used : Krb5InitCredential(sun.security.jgss.krb5.Krb5InitCredential) Krb5AcceptCredential(sun.security.jgss.krb5.Krb5AcceptCredential)

Aggregations

Krb5AcceptCredential (sun.security.jgss.krb5.Krb5AcceptCredential)1 Krb5InitCredential (sun.security.jgss.krb5.Krb5InitCredential)1