jdk/src/share/classes/sun/security/jgss/spnego/NegTokenInit.java
author weijun
Tue, 03 May 2011 02:48:59 +0800
changeset 9549 24b7de36d243
parent 5506 202f599c92aa
permissions -rw-r--r--
7040151: SPNEGO GSS code does not parse tokens in accordance to RFC 2478 Reviewed-by: valeriep
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
     1
/*
9549
24b7de36d243 7040151: SPNEGO GSS code does not parse tokens in accordance to RFC 2478
weijun
parents: 5506
diff changeset
     2
 * Copyright (c) 2005, 2011, Oracle and/or its affiliates. All rights reserved.
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
     3
 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
90ce3da70b43 Initial load
duke
parents:
diff changeset
     4
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
     5
 * This code is free software; you can redistribute it and/or modify it
90ce3da70b43 Initial load
duke
parents:
diff changeset
     6
 * under the terms of the GNU General Public License version 2 only, as
5506
202f599c92aa 6943119: Rebrand source copyright notices
ohair
parents: 2279
diff changeset
     7
 * published by the Free Software Foundation.  Oracle designates this
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
     8
 * particular file as subject to the "Classpath" exception as provided
5506
202f599c92aa 6943119: Rebrand source copyright notices
ohair
parents: 2279
diff changeset
     9
 * by Oracle in the LICENSE file that accompanied this code.
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
    10
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
    11
 * This code is distributed in the hope that it will be useful, but WITHOUT
90ce3da70b43 Initial load
duke
parents:
diff changeset
    12
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
90ce3da70b43 Initial load
duke
parents:
diff changeset
    13
 * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
90ce3da70b43 Initial load
duke
parents:
diff changeset
    14
 * version 2 for more details (a copy is included in the LICENSE file that
90ce3da70b43 Initial load
duke
parents:
diff changeset
    15
 * accompanied this code).
90ce3da70b43 Initial load
duke
parents:
diff changeset
    16
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
    17
 * You should have received a copy of the GNU General Public License version
90ce3da70b43 Initial load
duke
parents:
diff changeset
    18
 * 2 along with this work; if not, write to the Free Software Foundation,
90ce3da70b43 Initial load
duke
parents:
diff changeset
    19
 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    20
 *
5506
202f599c92aa 6943119: Rebrand source copyright notices
ohair
parents: 2279
diff changeset
    21
 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
202f599c92aa 6943119: Rebrand source copyright notices
ohair
parents: 2279
diff changeset
    22
 * or visit www.oracle.com if you need additional information or have any
202f599c92aa 6943119: Rebrand source copyright notices
ohair
parents: 2279
diff changeset
    23
 * questions.
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
    24
 */
90ce3da70b43 Initial load
duke
parents:
diff changeset
    25
90ce3da70b43 Initial load
duke
parents:
diff changeset
    26
package sun.security.jgss.spnego;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    27
90ce3da70b43 Initial load
duke
parents:
diff changeset
    28
import java.io.*;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    29
import java.util.*;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    30
import org.ietf.jgss.*;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    31
import sun.security.jgss.*;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    32
import sun.security.util.*;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    33
90ce3da70b43 Initial load
duke
parents:
diff changeset
    34
/**
90ce3da70b43 Initial load
duke
parents:
diff changeset
    35
 * Implements the SPNEGO NegTokenInit token
90ce3da70b43 Initial load
duke
parents:
diff changeset
    36
 * as specified in RFC 2478
90ce3da70b43 Initial load
duke
parents:
diff changeset
    37
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
    38
 * NegTokenInit ::= SEQUENCE {
90ce3da70b43 Initial load
duke
parents:
diff changeset
    39
 *      mechTypes       [0] MechTypeList  OPTIONAL,
90ce3da70b43 Initial load
duke
parents:
diff changeset
    40
 *      reqFlags        [1] ContextFlags  OPTIONAL,
90ce3da70b43 Initial load
duke
parents:
diff changeset
    41
 *      mechToken       [2] OCTET STRING  OPTIONAL,
90ce3da70b43 Initial load
duke
parents:
diff changeset
    42
 *      mechListMIC     [3] OCTET STRING  OPTIONAL
90ce3da70b43 Initial load
duke
parents:
diff changeset
    43
 * }
90ce3da70b43 Initial load
duke
parents:
diff changeset
    44
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
    45
 * MechTypeList ::= SEQUENCE OF MechType
90ce3da70b43 Initial load
duke
parents:
diff changeset
    46
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
    47
 * MechType::= OBJECT IDENTIFIER
90ce3da70b43 Initial load
duke
parents:
diff changeset
    48
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
    49
 * ContextFlags ::= BIT STRING {
90ce3da70b43 Initial load
duke
parents:
diff changeset
    50
 *      delegFlag       (0),
90ce3da70b43 Initial load
duke
parents:
diff changeset
    51
 *      mutualFlag      (1),
90ce3da70b43 Initial load
duke
parents:
diff changeset
    52
 *      replayFlag      (2),
90ce3da70b43 Initial load
duke
parents:
diff changeset
    53
 *      sequenceFlag    (3),
90ce3da70b43 Initial load
duke
parents:
diff changeset
    54
 *      anonFlag        (4),
90ce3da70b43 Initial load
duke
parents:
diff changeset
    55
 *      confFlag        (5),
90ce3da70b43 Initial load
duke
parents:
diff changeset
    56
 *      integFlag       (6)
90ce3da70b43 Initial load
duke
parents:
diff changeset
    57
 * }
90ce3da70b43 Initial load
duke
parents:
diff changeset
    58
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
    59
 * @author Seema Malkani
90ce3da70b43 Initial load
duke
parents:
diff changeset
    60
 * @since 1.6
90ce3da70b43 Initial load
duke
parents:
diff changeset
    61
 */
90ce3da70b43 Initial load
duke
parents:
diff changeset
    62
90ce3da70b43 Initial load
duke
parents:
diff changeset
    63
public class NegTokenInit extends SpNegoToken {
90ce3da70b43 Initial load
duke
parents:
diff changeset
    64
90ce3da70b43 Initial load
duke
parents:
diff changeset
    65
    // DER-encoded mechTypes
90ce3da70b43 Initial load
duke
parents:
diff changeset
    66
    private byte[] mechTypes = null;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    67
    private Oid[] mechTypeList = null;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    68
2279
e5639c0d8552 6815182: GSSAPI/SPNEGO does not work with server using MIT Kerberos library
weijun
parents: 2
diff changeset
    69
    private BitArray reqFlags = null;
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
    70
    private byte[] mechToken = null;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    71
    private byte[] mechListMIC = null;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    72
2279
e5639c0d8552 6815182: GSSAPI/SPNEGO does not work with server using MIT Kerberos library
weijun
parents: 2
diff changeset
    73
    NegTokenInit(byte[] mechTypes, BitArray flags,
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
    74
                byte[] token, byte[] mechListMIC)
90ce3da70b43 Initial load
duke
parents:
diff changeset
    75
    {
90ce3da70b43 Initial load
duke
parents:
diff changeset
    76
        super(NEG_TOKEN_INIT_ID);
90ce3da70b43 Initial load
duke
parents:
diff changeset
    77
        this.mechTypes = mechTypes;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    78
        this.reqFlags = flags;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    79
        this.mechToken = token;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    80
        this.mechListMIC = mechListMIC;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    81
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
    82
90ce3da70b43 Initial load
duke
parents:
diff changeset
    83
    // Used by sun.security.jgss.wrapper.NativeGSSContext
90ce3da70b43 Initial load
duke
parents:
diff changeset
    84
    // to parse SPNEGO tokens
90ce3da70b43 Initial load
duke
parents:
diff changeset
    85
    public NegTokenInit(byte[] in) throws GSSException {
90ce3da70b43 Initial load
duke
parents:
diff changeset
    86
        super(NEG_TOKEN_INIT_ID);
90ce3da70b43 Initial load
duke
parents:
diff changeset
    87
        parseToken(in);
90ce3da70b43 Initial load
duke
parents:
diff changeset
    88
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
    89
90ce3da70b43 Initial load
duke
parents:
diff changeset
    90
    final byte[] encode() throws GSSException {
90ce3da70b43 Initial load
duke
parents:
diff changeset
    91
        try {
90ce3da70b43 Initial load
duke
parents:
diff changeset
    92
            // create negInitToken
90ce3da70b43 Initial load
duke
parents:
diff changeset
    93
            DerOutputStream initToken = new DerOutputStream();
90ce3da70b43 Initial load
duke
parents:
diff changeset
    94
90ce3da70b43 Initial load
duke
parents:
diff changeset
    95
            // DER-encoded mechTypes with CONTEXT 00
90ce3da70b43 Initial load
duke
parents:
diff changeset
    96
            if (mechTypes != null) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
    97
                initToken.write(DerValue.createTag(DerValue.TAG_CONTEXT,
90ce3da70b43 Initial load
duke
parents:
diff changeset
    98
                                                true, (byte) 0x00), mechTypes);
90ce3da70b43 Initial load
duke
parents:
diff changeset
    99
            }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   100
90ce3da70b43 Initial load
duke
parents:
diff changeset
   101
            // write context flags with CONTEXT 01
90ce3da70b43 Initial load
duke
parents:
diff changeset
   102
            if (reqFlags != null) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   103
                DerOutputStream flags = new DerOutputStream();
2279
e5639c0d8552 6815182: GSSAPI/SPNEGO does not work with server using MIT Kerberos library
weijun
parents: 2
diff changeset
   104
                flags.putUnalignedBitString(reqFlags);
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   105
                initToken.write(DerValue.createTag(DerValue.TAG_CONTEXT,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   106
                                                true, (byte) 0x01), flags);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   107
            }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   108
90ce3da70b43 Initial load
duke
parents:
diff changeset
   109
            // mechToken with CONTEXT 02
90ce3da70b43 Initial load
duke
parents:
diff changeset
   110
            if (mechToken != null) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   111
                DerOutputStream dataValue = new DerOutputStream();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   112
                dataValue.putOctetString(mechToken);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   113
                initToken.write(DerValue.createTag(DerValue.TAG_CONTEXT,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   114
                                                true, (byte) 0x02), dataValue);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   115
            }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   116
90ce3da70b43 Initial load
duke
parents:
diff changeset
   117
            // mechListMIC with CONTEXT 03
90ce3da70b43 Initial load
duke
parents:
diff changeset
   118
            if (mechListMIC != null) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   119
                if (DEBUG) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   120
                    System.out.println("SpNegoToken NegTokenInit: " +
90ce3da70b43 Initial load
duke
parents:
diff changeset
   121
                                        "sending MechListMIC");
90ce3da70b43 Initial load
duke
parents:
diff changeset
   122
                }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   123
                DerOutputStream mic = new DerOutputStream();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   124
                mic.putOctetString(mechListMIC);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   125
                initToken.write(DerValue.createTag(DerValue.TAG_CONTEXT,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   126
                                                true, (byte) 0x03), mic);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   127
            }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   128
90ce3da70b43 Initial load
duke
parents:
diff changeset
   129
            // insert in a SEQUENCE
90ce3da70b43 Initial load
duke
parents:
diff changeset
   130
            DerOutputStream out = new DerOutputStream();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   131
            out.write(DerValue.tag_Sequence, initToken);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   132
90ce3da70b43 Initial load
duke
parents:
diff changeset
   133
            return out.toByteArray();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   134
90ce3da70b43 Initial load
duke
parents:
diff changeset
   135
        } catch (IOException e) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   136
            throw new GSSException(GSSException.DEFECTIVE_TOKEN, -1,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   137
                "Invalid SPNEGO NegTokenInit token : " + e.getMessage());
90ce3da70b43 Initial load
duke
parents:
diff changeset
   138
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   139
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   140
90ce3da70b43 Initial load
duke
parents:
diff changeset
   141
    private void parseToken(byte[] in) throws GSSException {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   142
        try {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   143
            DerValue der = new DerValue(in);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   144
            // verify NegotiationToken type token
90ce3da70b43 Initial load
duke
parents:
diff changeset
   145
            if (!der.isContextSpecific((byte) NEG_TOKEN_INIT_ID)) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   146
                throw new IOException("SPNEGO NegoTokenInit : " +
90ce3da70b43 Initial load
duke
parents:
diff changeset
   147
                                "did not have right token type");
90ce3da70b43 Initial load
duke
parents:
diff changeset
   148
            }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   149
            DerValue tmp1 = der.data.getDerValue();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   150
            if (tmp1.tag != DerValue.tag_Sequence) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   151
                throw new IOException("SPNEGO NegoTokenInit : " +
90ce3da70b43 Initial load
duke
parents:
diff changeset
   152
                                "did not have the Sequence tag");
90ce3da70b43 Initial load
duke
parents:
diff changeset
   153
            }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   154
9549
24b7de36d243 7040151: SPNEGO GSS code does not parse tokens in accordance to RFC 2478
weijun
parents: 5506
diff changeset
   155
            // parse various fields if present
24b7de36d243 7040151: SPNEGO GSS code does not parse tokens in accordance to RFC 2478
weijun
parents: 5506
diff changeset
   156
            int lastField = -1;
24b7de36d243 7040151: SPNEGO GSS code does not parse tokens in accordance to RFC 2478
weijun
parents: 5506
diff changeset
   157
            while (tmp1.data.available() > 0) {
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   158
                DerValue tmp2 = tmp1.data.getDerValue();
9549
24b7de36d243 7040151: SPNEGO GSS code does not parse tokens in accordance to RFC 2478
weijun
parents: 5506
diff changeset
   159
                if (tmp2.isContextSpecific((byte)0x00)) {
24b7de36d243 7040151: SPNEGO GSS code does not parse tokens in accordance to RFC 2478
weijun
parents: 5506
diff changeset
   160
                    // get the DER-encoded sequence of mechTypes
24b7de36d243 7040151: SPNEGO GSS code does not parse tokens in accordance to RFC 2478
weijun
parents: 5506
diff changeset
   161
                    lastField = checkNextField(lastField, 0);
24b7de36d243 7040151: SPNEGO GSS code does not parse tokens in accordance to RFC 2478
weijun
parents: 5506
diff changeset
   162
                    DerInputStream mValue = tmp2.data;
24b7de36d243 7040151: SPNEGO GSS code does not parse tokens in accordance to RFC 2478
weijun
parents: 5506
diff changeset
   163
                    mechTypes = mValue.toByteArray();
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   164
9549
24b7de36d243 7040151: SPNEGO GSS code does not parse tokens in accordance to RFC 2478
weijun
parents: 5506
diff changeset
   165
                    // read all the mechTypes
24b7de36d243 7040151: SPNEGO GSS code does not parse tokens in accordance to RFC 2478
weijun
parents: 5506
diff changeset
   166
                    DerValue[] mList = mValue.getSequence(0);
24b7de36d243 7040151: SPNEGO GSS code does not parse tokens in accordance to RFC 2478
weijun
parents: 5506
diff changeset
   167
                    mechTypeList = new Oid[mList.length];
24b7de36d243 7040151: SPNEGO GSS code does not parse tokens in accordance to RFC 2478
weijun
parents: 5506
diff changeset
   168
                    ObjectIdentifier mech = null;
24b7de36d243 7040151: SPNEGO GSS code does not parse tokens in accordance to RFC 2478
weijun
parents: 5506
diff changeset
   169
                    for (int i = 0; i < mList.length; i++) {
24b7de36d243 7040151: SPNEGO GSS code does not parse tokens in accordance to RFC 2478
weijun
parents: 5506
diff changeset
   170
                        mech = mList[i].getOID();
24b7de36d243 7040151: SPNEGO GSS code does not parse tokens in accordance to RFC 2478
weijun
parents: 5506
diff changeset
   171
                        if (DEBUG) {
24b7de36d243 7040151: SPNEGO GSS code does not parse tokens in accordance to RFC 2478
weijun
parents: 5506
diff changeset
   172
                            System.out.println("SpNegoToken NegTokenInit: " +
24b7de36d243 7040151: SPNEGO GSS code does not parse tokens in accordance to RFC 2478
weijun
parents: 5506
diff changeset
   173
                                    "reading Mechanism Oid = " + mech);
24b7de36d243 7040151: SPNEGO GSS code does not parse tokens in accordance to RFC 2478
weijun
parents: 5506
diff changeset
   174
                        }
24b7de36d243 7040151: SPNEGO GSS code does not parse tokens in accordance to RFC 2478
weijun
parents: 5506
diff changeset
   175
                        mechTypeList[i] = new Oid(mech.toString());
24b7de36d243 7040151: SPNEGO GSS code does not parse tokens in accordance to RFC 2478
weijun
parents: 5506
diff changeset
   176
                    }
24b7de36d243 7040151: SPNEGO GSS code does not parse tokens in accordance to RFC 2478
weijun
parents: 5506
diff changeset
   177
                } else if (tmp2.isContextSpecific((byte)0x01)) {
24b7de36d243 7040151: SPNEGO GSS code does not parse tokens in accordance to RFC 2478
weijun
parents: 5506
diff changeset
   178
                    lastField = checkNextField(lastField, 1);
24b7de36d243 7040151: SPNEGO GSS code does not parse tokens in accordance to RFC 2478
weijun
parents: 5506
diff changeset
   179
                    // received reqFlags, skip it
24b7de36d243 7040151: SPNEGO GSS code does not parse tokens in accordance to RFC 2478
weijun
parents: 5506
diff changeset
   180
                } else if (tmp2.isContextSpecific((byte)0x02)) {
24b7de36d243 7040151: SPNEGO GSS code does not parse tokens in accordance to RFC 2478
weijun
parents: 5506
diff changeset
   181
                    lastField = checkNextField(lastField, 2);
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   182
                    if (DEBUG) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   183
                        System.out.println("SpNegoToken NegTokenInit: " +
9549
24b7de36d243 7040151: SPNEGO GSS code does not parse tokens in accordance to RFC 2478
weijun
parents: 5506
diff changeset
   184
                                            "reading Mech Token");
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   185
                    }
9549
24b7de36d243 7040151: SPNEGO GSS code does not parse tokens in accordance to RFC 2478
weijun
parents: 5506
diff changeset
   186
                    mechToken = tmp2.data.getOctetString();
24b7de36d243 7040151: SPNEGO GSS code does not parse tokens in accordance to RFC 2478
weijun
parents: 5506
diff changeset
   187
                } else if (tmp2.isContextSpecific((byte)0x03)) {
24b7de36d243 7040151: SPNEGO GSS code does not parse tokens in accordance to RFC 2478
weijun
parents: 5506
diff changeset
   188
                    lastField = checkNextField(lastField, 3);
24b7de36d243 7040151: SPNEGO GSS code does not parse tokens in accordance to RFC 2478
weijun
parents: 5506
diff changeset
   189
                    if (!GSSUtil.useMSInterop()) {
24b7de36d243 7040151: SPNEGO GSS code does not parse tokens in accordance to RFC 2478
weijun
parents: 5506
diff changeset
   190
                        mechListMIC = tmp2.data.getOctetString();
24b7de36d243 7040151: SPNEGO GSS code does not parse tokens in accordance to RFC 2478
weijun
parents: 5506
diff changeset
   191
                        if (DEBUG) {
24b7de36d243 7040151: SPNEGO GSS code does not parse tokens in accordance to RFC 2478
weijun
parents: 5506
diff changeset
   192
                            System.out.println("SpNegoToken NegTokenInit: " +
24b7de36d243 7040151: SPNEGO GSS code does not parse tokens in accordance to RFC 2478
weijun
parents: 5506
diff changeset
   193
                                    "MechListMIC Token = " +
24b7de36d243 7040151: SPNEGO GSS code does not parse tokens in accordance to RFC 2478
weijun
parents: 5506
diff changeset
   194
                                    getHexBytes(mechListMIC));
24b7de36d243 7040151: SPNEGO GSS code does not parse tokens in accordance to RFC 2478
weijun
parents: 5506
diff changeset
   195
                        }
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   196
                    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   197
                }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   198
            }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   199
        } catch (IOException e) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   200
            throw new GSSException(GSSException.DEFECTIVE_TOKEN, -1,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   201
                "Invalid SPNEGO NegTokenInit token : " + e.getMessage());
90ce3da70b43 Initial load
duke
parents:
diff changeset
   202
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   203
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   204
90ce3da70b43 Initial load
duke
parents:
diff changeset
   205
    byte[] getMechTypes() {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   206
        return mechTypes;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   207
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   208
90ce3da70b43 Initial load
duke
parents:
diff changeset
   209
    // Used by sun.security.jgss.wrapper.NativeGSSContext
90ce3da70b43 Initial load
duke
parents:
diff changeset
   210
    // to find the mechs in SPNEGO tokens
90ce3da70b43 Initial load
duke
parents:
diff changeset
   211
    public Oid[] getMechTypeList() {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   212
        return mechTypeList;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   213
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   214
2279
e5639c0d8552 6815182: GSSAPI/SPNEGO does not work with server using MIT Kerberos library
weijun
parents: 2
diff changeset
   215
    BitArray getReqFlags() {
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   216
        return reqFlags;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   217
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   218
90ce3da70b43 Initial load
duke
parents:
diff changeset
   219
    // Used by sun.security.jgss.wrapper.NativeGSSContext
90ce3da70b43 Initial load
duke
parents:
diff changeset
   220
    // to access the mech token portion of SPNEGO tokens
90ce3da70b43 Initial load
duke
parents:
diff changeset
   221
    public byte[] getMechToken() {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   222
        return mechToken;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   223
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   224
90ce3da70b43 Initial load
duke
parents:
diff changeset
   225
    byte[] getMechListMIC() {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   226
        return mechListMIC;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   227
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   228
90ce3da70b43 Initial load
duke
parents:
diff changeset
   229
}