sun.security.krb5.internal.KDCOptions Java Examples

The following examples show how to use sun.security.krb5.internal.KDCOptions. 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: KrbAsReqBuilder.java    From dragonwell8_jdk with GNU General Public License v2.0 6 votes vote down vote up
boolean handleError(KrbException ke) throws RealmException {
    if (enabled) {
        if (ke.returnCode() == Krb5.KRB_ERR_WRONG_REALM) {
            Realm referredRealm = ke.getError().getClientRealm();
            if (req.getMessage().reqBody.kdcOptions.get(KDCOptions.CANONICALIZE) &&
                    referredRealm != null && referredRealm.toString().length() > 0 &&
                    count < Config.MAX_REFERRALS) {
                refCname = new PrincipalName(refCname.getNameType(),
                        refCname.getNameStrings(), referredRealm);
                refreshComm = true;
                count++;
                return true;
            }
        }
        if (count < Config.MAX_REFERRALS &&
                refCname.getNameType() != PrincipalName.KRB_NT_ENTERPRISE) {
            // Server may raise an error if CANONICALIZE is true.
            // Try CANONICALIZE false.
            enabled = false;
            return true;
        }
    }
    return false;
}
 
Example #2
Source File: KrbAsReqBuilder.java    From jdk8u_jdk with GNU General Public License v2.0 6 votes vote down vote up
boolean handleError(KrbException ke) throws RealmException {
    if (enabled) {
        if (ke.returnCode() == Krb5.KRB_ERR_WRONG_REALM) {
            Realm referredRealm = ke.getError().getClientRealm();
            if (req.getMessage().reqBody.kdcOptions.get(KDCOptions.CANONICALIZE) &&
                    referredRealm != null && referredRealm.toString().length() > 0 &&
                    count < Config.MAX_REFERRALS) {
                refCname = new PrincipalName(refCname.getNameType(),
                        refCname.getNameStrings(), referredRealm);
                refreshComm = true;
                count++;
                return true;
            }
        }
        if (count < Config.MAX_REFERRALS &&
                refCname.getNameType() != PrincipalName.KRB_NT_ENTERPRISE) {
            // Server may raise an error if CANONICALIZE is true.
            // Try CANONICALIZE false.
            enabled = false;
            return true;
        }
    }
    return false;
}
 
Example #3
Source File: KrbAsReqBuilder.java    From TencentKona-8 with GNU General Public License v2.0 6 votes vote down vote up
boolean handleError(KrbException ke) throws RealmException {
    if (enabled) {
        if (ke.returnCode() == Krb5.KRB_ERR_WRONG_REALM) {
            Realm referredRealm = ke.getError().getClientRealm();
            if (req.getMessage().reqBody.kdcOptions.get(KDCOptions.CANONICALIZE) &&
                    referredRealm != null && referredRealm.toString().length() > 0 &&
                    count < Config.MAX_REFERRALS) {
                refCname = new PrincipalName(refCname.getNameType(),
                        refCname.getNameStrings(), referredRealm);
                refreshComm = true;
                count++;
                return true;
            }
        }
        if (count < Config.MAX_REFERRALS &&
                refCname.getNameType() != PrincipalName.KRB_NT_ENTERPRISE) {
            // Server may raise an error if CANONICALIZE is true.
            // Try CANONICALIZE false.
            enabled = false;
            return true;
        }
    }
    return false;
}
 
Example #4
Source File: KrbAsReqBuilder.java    From openjdk-jdk8u with GNU General Public License v2.0 6 votes vote down vote up
boolean handleError(KrbException ke) throws RealmException {
    if (enabled) {
        if (ke.returnCode() == Krb5.KRB_ERR_WRONG_REALM) {
            Realm referredRealm = ke.getError().getClientRealm();
            if (req.getMessage().reqBody.kdcOptions.get(KDCOptions.CANONICALIZE) &&
                    referredRealm != null && referredRealm.toString().length() > 0 &&
                    count < Config.MAX_REFERRALS) {
                refCname = new PrincipalName(refCname.getNameType(),
                        refCname.getNameStrings(), referredRealm);
                refreshComm = true;
                count++;
                return true;
            }
        }
        if (count < Config.MAX_REFERRALS &&
                refCname.getNameType() != PrincipalName.KRB_NT_ENTERPRISE) {
            // Server may raise an error if CANONICALIZE is true.
            // Try CANONICALIZE false.
            enabled = false;
            return true;
        }
    }
    return false;
}
 
Example #5
Source File: KdcDefaultOptions.java    From openjdk-jdk9 with GNU General Public License v2.0 5 votes vote down vote up
public static void main(String[] args) throws Exception {
    System.setProperty("java.security.krb5.conf",
            System.getProperty("test.src", ".") + "/kdc_default_options.conf");
    Config.refresh();
    KDCOptions options = new KDCOptions();
    if (!options.get(KDCOptions.FORWARDABLE) ||
            !options.get(KDCOptions.PROXIABLE) ||
            !options.get(KDCOptions.RENEWABLE_OK)) {
        throw new Exception(options.toString());
    }
}
 
Example #6
Source File: KdcDefaultOptions.java    From jdk8u-dev-jdk with GNU General Public License v2.0 5 votes vote down vote up
public static void main(String[] args) throws Exception {
    System.setProperty("java.security.krb5.conf",
            System.getProperty("test.src", ".") + "/kdc_default_options.conf");
    Config.refresh();
    KDCOptions options = new KDCOptions();
    if (!options.get(KDCOptions.FORWARDABLE) ||
            !options.get(KDCOptions.PROXIABLE) ||
            !options.get(KDCOptions.RENEWABLE_OK)) {
        throw new Exception(options.toString());
    }
}
 
Example #7
Source File: KdcDefaultOptions.java    From jdk8u-jdk with GNU General Public License v2.0 5 votes vote down vote up
public static void main(String[] args) throws Exception {
    System.setProperty("java.security.krb5.conf",
            System.getProperty("test.src", ".") + "/kdc_default_options.conf");
    Config.refresh();
    KDCOptions options = new KDCOptions();
    if (!options.get(KDCOptions.FORWARDABLE) ||
            !options.get(KDCOptions.PROXIABLE) ||
            !options.get(KDCOptions.RENEWABLE_OK)) {
        throw new Exception(options.toString());
    }
}
 
Example #8
Source File: KdcDefaultOptions.java    From jdk8u_jdk with GNU General Public License v2.0 5 votes vote down vote up
public static void main(String[] args) throws Exception {
    System.setProperty("java.security.krb5.conf",
            System.getProperty("test.src", ".") + "/kdc_default_options.conf");
    Config.refresh();
    KDCOptions options = new KDCOptions();
    if (!options.get(KDCOptions.FORWARDABLE) ||
            !options.get(KDCOptions.PROXIABLE) ||
            !options.get(KDCOptions.RENEWABLE_OK)) {
        throw new Exception(options.toString());
    }
}
 
Example #9
Source File: KrbAsReqBuilder.java    From jdk8u_jdk with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Build a KrbAsReq object from all info fed above. Normally this method
 * will be called twice: initial AS-REQ and second with pakey
 * @param key null (initial AS-REQ) or pakey (with preauth)
 * @return the KrbAsReq object
 * @throws KrbException
 * @throws IOException
 */
private KrbAsReq build(EncryptionKey key, ReferralsState referralsState)
        throws KrbException, IOException {
    PAData[] extraPAs = null;
    int[] eTypes;
    if (password != null) {
        eTypes = EType.getDefaults("default_tkt_enctypes");
    } else {
        EncryptionKey[] ks = Krb5Util.keysFromJavaxKeyTab(ktab, cname);
        eTypes = EType.getDefaults("default_tkt_enctypes",
                ks);
        for (EncryptionKey k: ks) k.destroy();
    }
    options = (options == null) ? new KDCOptions() : options;
    if (referralsState.isEnabled()) {
        options.set(KDCOptions.CANONICALIZE, true);
        extraPAs = new PAData[]{ new PAData(Krb5.PA_REQ_ENC_PA_REP,
                new byte[]{}) };
    } else {
        options.set(KDCOptions.CANONICALIZE, false);
    }
    return new KrbAsReq(key,
        options,
        refCname,
        sname,
        from,
        till,
        rtime,
        eTypes,
        addresses,
        extraPAs);
}
 
Example #10
Source File: KdcDefaultOptions.java    From openjdk-8 with GNU General Public License v2.0 5 votes vote down vote up
public static void main(String[] args) throws Exception {
    System.setProperty("java.security.krb5.conf",
            System.getProperty("test.src", ".") + "/kdc_default_options.conf");
    Config.refresh();
    KDCOptions options = new KDCOptions();
    if (!options.get(KDCOptions.FORWARDABLE) ||
            !options.get(KDCOptions.PROXIABLE) ||
            !options.get(KDCOptions.RENEWABLE_OK)) {
        throw new Exception(options.toString());
    }
}
 
Example #11
Source File: KdcDefaultOptions.java    From openjdk-8-source with GNU General Public License v2.0 5 votes vote down vote up
public static void main(String[] args) throws Exception {
    System.setProperty("java.security.krb5.conf",
            System.getProperty("test.src", ".") + "/kdc_default_options.conf");
    Config.refresh();
    KDCOptions options = new KDCOptions();
    if (!options.get(KDCOptions.FORWARDABLE) ||
            !options.get(KDCOptions.PROXIABLE) ||
            !options.get(KDCOptions.RENEWABLE_OK)) {
        throw new Exception(options.toString());
    }
}
 
Example #12
Source File: KdcDefaultOptions.java    From hottub with GNU General Public License v2.0 5 votes vote down vote up
public static void main(String[] args) throws Exception {
    System.setProperty("java.security.krb5.conf",
            System.getProperty("test.src", ".") + "/kdc_default_options.conf");
    Config.refresh();
    KDCOptions options = new KDCOptions();
    if (!options.get(KDCOptions.FORWARDABLE) ||
            !options.get(KDCOptions.PROXIABLE) ||
            !options.get(KDCOptions.RENEWABLE_OK)) {
        throw new Exception(options.toString());
    }
}
 
Example #13
Source File: KdcDefaultOptions.java    From jdk8u-jdk with GNU General Public License v2.0 5 votes vote down vote up
public static void main(String[] args) throws Exception {
    System.setProperty("java.security.krb5.conf",
            System.getProperty("test.src", ".") + "/kdc_default_options.conf");
    Config.refresh();
    KDCOptions options = new KDCOptions();
    if (!options.get(KDCOptions.FORWARDABLE) ||
            !options.get(KDCOptions.PROXIABLE) ||
            !options.get(KDCOptions.RENEWABLE_OK)) {
        throw new Exception(options.toString());
    }
}
 
Example #14
Source File: KdcDefaultOptions.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 5 votes vote down vote up
public static void main(String[] args) throws Exception {
    System.setProperty("java.security.krb5.conf",
            System.getProperty("test.src", ".") + "/kdc_default_options.conf");
    Config.refresh();
    KDCOptions options = new KDCOptions();
    if (!options.get(KDCOptions.FORWARDABLE) ||
            !options.get(KDCOptions.PROXIABLE) ||
            !options.get(KDCOptions.RENEWABLE_OK)) {
        throw new Exception(options.toString());
    }
}
 
Example #15
Source File: KdcDefaultOptions.java    From openjdk-jdk8u with GNU General Public License v2.0 5 votes vote down vote up
public static void main(String[] args) throws Exception {
    System.setProperty("java.security.krb5.conf",
            System.getProperty("test.src", ".") + "/kdc_default_options.conf");
    Config.refresh();
    KDCOptions options = new KDCOptions();
    if (!options.get(KDCOptions.FORWARDABLE) ||
            !options.get(KDCOptions.PROXIABLE) ||
            !options.get(KDCOptions.RENEWABLE_OK)) {
        throw new Exception(options.toString());
    }
}
 
Example #16
Source File: KrbAsReqBuilder.java    From dragonwell8_jdk with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Build a KrbAsReq object from all info fed above. Normally this method
 * will be called twice: initial AS-REQ and second with pakey
 * @param key null (initial AS-REQ) or pakey (with preauth)
 * @return the KrbAsReq object
 * @throws KrbException
 * @throws IOException
 */
private KrbAsReq build(EncryptionKey key, ReferralsState referralsState)
        throws KrbException, IOException {
    PAData[] extraPAs = null;
    int[] eTypes;
    if (password != null) {
        eTypes = EType.getDefaults("default_tkt_enctypes");
    } else {
        EncryptionKey[] ks = Krb5Util.keysFromJavaxKeyTab(ktab, cname);
        eTypes = EType.getDefaults("default_tkt_enctypes",
                ks);
        for (EncryptionKey k: ks) k.destroy();
    }
    options = (options == null) ? new KDCOptions() : options;
    if (referralsState.isEnabled()) {
        options.set(KDCOptions.CANONICALIZE, true);
        extraPAs = new PAData[]{ new PAData(Krb5.PA_REQ_ENC_PA_REP,
                new byte[]{}) };
    } else {
        options.set(KDCOptions.CANONICALIZE, false);
    }
    return new KrbAsReq(key,
        options,
        refCname,
        sname,
        from,
        till,
        rtime,
        eTypes,
        addresses,
        extraPAs);
}
 
Example #17
Source File: KdcDefaultOptions.java    From dragonwell8_jdk with GNU General Public License v2.0 5 votes vote down vote up
public static void main(String[] args) throws Exception {
    System.setProperty("java.security.krb5.conf",
            System.getProperty("test.src", ".") + "/kdc_default_options.conf");
    Config.refresh();
    KDCOptions options = new KDCOptions();
    if (!options.get(KDCOptions.FORWARDABLE) ||
            !options.get(KDCOptions.PROXIABLE) ||
            !options.get(KDCOptions.RENEWABLE_OK)) {
        throw new Exception(options.toString());
    }
}
 
Example #18
Source File: KrbAsReqBuilder.java    From TencentKona-8 with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Build a KrbAsReq object from all info fed above. Normally this method
 * will be called twice: initial AS-REQ and second with pakey
 * @param key null (initial AS-REQ) or pakey (with preauth)
 * @return the KrbAsReq object
 * @throws KrbException
 * @throws IOException
 */
private KrbAsReq build(EncryptionKey key, ReferralsState referralsState)
        throws KrbException, IOException {
    PAData[] extraPAs = null;
    int[] eTypes;
    if (password != null) {
        eTypes = EType.getDefaults("default_tkt_enctypes");
    } else {
        EncryptionKey[] ks = Krb5Util.keysFromJavaxKeyTab(ktab, cname);
        eTypes = EType.getDefaults("default_tkt_enctypes",
                ks);
        for (EncryptionKey k: ks) k.destroy();
    }
    options = (options == null) ? new KDCOptions() : options;
    if (referralsState.isEnabled()) {
        options.set(KDCOptions.CANONICALIZE, true);
        extraPAs = new PAData[]{ new PAData(Krb5.PA_REQ_ENC_PA_REP,
                new byte[]{}) };
    } else {
        options.set(KDCOptions.CANONICALIZE, false);
    }
    return new KrbAsReq(key,
        options,
        refCname,
        sname,
        from,
        till,
        rtime,
        eTypes,
        addresses,
        extraPAs);
}
 
Example #19
Source File: KdcDefaultOptions.java    From TencentKona-8 with GNU General Public License v2.0 5 votes vote down vote up
public static void main(String[] args) throws Exception {
    System.setProperty("java.security.krb5.conf",
            System.getProperty("test.src", ".") + "/kdc_default_options.conf");
    Config.refresh();
    KDCOptions options = new KDCOptions();
    if (!options.get(KDCOptions.FORWARDABLE) ||
            !options.get(KDCOptions.PROXIABLE) ||
            !options.get(KDCOptions.RENEWABLE_OK)) {
        throw new Exception(options.toString());
    }
}
 
Example #20
Source File: KdcDefaultOptions.java    From jdk8u60 with GNU General Public License v2.0 5 votes vote down vote up
public static void main(String[] args) throws Exception {
    System.setProperty("java.security.krb5.conf",
            System.getProperty("test.src", ".") + "/kdc_default_options.conf");
    Config.refresh();
    KDCOptions options = new KDCOptions();
    if (!options.get(KDCOptions.FORWARDABLE) ||
            !options.get(KDCOptions.PROXIABLE) ||
            !options.get(KDCOptions.RENEWABLE_OK)) {
        throw new Exception(options.toString());
    }
}
 
Example #21
Source File: KrbAsReqBuilder.java    From openjdk-jdk8u with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Build a KrbAsReq object from all info fed above. Normally this method
 * will be called twice: initial AS-REQ and second with pakey
 * @param key null (initial AS-REQ) or pakey (with preauth)
 * @return the KrbAsReq object
 * @throws KrbException
 * @throws IOException
 */
private KrbAsReq build(EncryptionKey key, ReferralsState referralsState)
        throws KrbException, IOException {
    PAData[] extraPAs = null;
    int[] eTypes;
    if (password != null) {
        eTypes = EType.getDefaults("default_tkt_enctypes");
    } else {
        EncryptionKey[] ks = Krb5Util.keysFromJavaxKeyTab(ktab, cname);
        eTypes = EType.getDefaults("default_tkt_enctypes",
                ks);
        for (EncryptionKey k: ks) k.destroy();
    }
    options = (options == null) ? new KDCOptions() : options;
    if (referralsState.isEnabled()) {
        options.set(KDCOptions.CANONICALIZE, true);
        extraPAs = new PAData[]{ new PAData(Krb5.PA_REQ_ENC_PA_REP,
                new byte[]{}) };
    } else {
        options.set(KDCOptions.CANONICALIZE, false);
    }
    return new KrbAsReq(key,
        options,
        refCname,
        sname,
        from,
        till,
        rtime,
        eTypes,
        addresses,
        extraPAs);
}
 
Example #22
Source File: KrbAsReqBuilder.java    From hottub with GNU General Public License v2.0 2 votes vote down vote up
/**
 * Sets or clears options. If cleared, default options will be used
 * at creation time.
 * @param options
 */
public void setOptions(KDCOptions options) {
    checkState(State.INIT, "Cannot specify options");
    this.options = options;
}
 
Example #23
Source File: KrbAsReqBuilder.java    From openjdk-jdk8u with GNU General Public License v2.0 2 votes vote down vote up
/**
 * Sets or clears options. If cleared, default options will be used
 * at creation time.
 * @param options
 */
public void setOptions(KDCOptions options) {
    checkState(State.INIT, "Cannot specify options");
    this.options = options;
}
 
Example #24
Source File: KrbAsReqBuilder.java    From openjdk-8-source with GNU General Public License v2.0 2 votes vote down vote up
/**
 * Sets or clears options. If cleared, default options will be used
 * at creation time.
 * @param options
 */
public void setOptions(KDCOptions options) {
    checkState(State.INIT, "Cannot specify options");
    this.options = options;
}
 
Example #25
Source File: KrbAsReqBuilder.java    From openjdk-8 with GNU General Public License v2.0 2 votes vote down vote up
/**
 * Sets or clears options. If cleared, default options will be used
 * at creation time.
 * @param options
 */
public void setOptions(KDCOptions options) {
    checkState(State.INIT, "Cannot specify options");
    this.options = options;
}
 
Example #26
Source File: KrbAsReqBuilder.java    From jdk8u60 with GNU General Public License v2.0 2 votes vote down vote up
/**
 * Sets or clears options. If cleared, default options will be used
 * at creation time.
 * @param options
 */
public void setOptions(KDCOptions options) {
    checkState(State.INIT, "Cannot specify options");
    this.options = options;
}
 
Example #27
Source File: KrbAsReqBuilder.java    From jdk8u_jdk with GNU General Public License v2.0 2 votes vote down vote up
/**
 * Sets or clears options. If cleared, default options will be used
 * at creation time.
 * @param options
 */
public void setOptions(KDCOptions options) {
    checkState(State.INIT, "Cannot specify options");
    this.options = options;
}
 
Example #28
Source File: KrbAsReqBuilder.java    From jdk8u-jdk with GNU General Public License v2.0 2 votes vote down vote up
/**
 * Sets or clears options. If cleared, default options will be used
 * at creation time.
 * @param options
 */
public void setOptions(KDCOptions options) {
    checkState(State.INIT, "Cannot specify options");
    this.options = options;
}
 
Example #29
Source File: KrbAsReqBuilder.java    From dragonwell8_jdk with GNU General Public License v2.0 2 votes vote down vote up
/**
 * Sets or clears options. If cleared, default options will be used
 * at creation time.
 * @param options
 */
public void setOptions(KDCOptions options) {
    checkState(State.INIT, "Cannot specify options");
    this.options = options;
}
 
Example #30
Source File: KrbAsReqBuilder.java    From TencentKona-8 with GNU General Public License v2.0 2 votes vote down vote up
/**
 * Sets or clears options. If cleared, default options will be used
 * at creation time.
 * @param options
 */
public void setOptions(KDCOptions options) {
    checkState(State.INIT, "Cannot specify options");
    this.options = options;
}