src/java.security.jgss/share/classes/sun/security/jgss/krb5/Krb5MechFactory.java
author weijun
Fri, 19 Apr 2019 10:22:20 +0800
changeset 58611 53ddf218eddd
parent 47216 71c04702a3d5
permissions -rw-r--r--
8220302: Better Kerberos ccache handling Reviewed-by: valeriep
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
     1
/*
58611
53ddf218eddd 8220302: Better Kerberos ccache handling
weijun
parents: 47216
diff changeset
     2
 * Copyright (c) 2000, 2019, 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: 2942
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: 2942
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: 2942
diff changeset
    21
 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
202f599c92aa 6943119: Rebrand source copyright notices
ohair
parents: 2942
diff changeset
    22
 * or visit www.oracle.com if you need additional information or have any
202f599c92aa 6943119: Rebrand source copyright notices
ohair
parents: 2942
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.krb5;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    27
90ce3da70b43 Initial load
duke
parents:
diff changeset
    28
import org.ietf.jgss.*;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    29
import sun.security.jgss.GSSUtil;
2942
37d9baeb7518 6578647: Undefined requesting URL in java.net.Authenticator.getPasswordAuthentication()
weijun
parents: 2
diff changeset
    30
import sun.security.jgss.GSSCaller;
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
    31
import sun.security.jgss.spi.*;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    32
import javax.security.auth.kerberos.ServicePermission;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    33
import java.security.Provider;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    34
import java.util.Vector;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    35
90ce3da70b43 Initial load
duke
parents:
diff changeset
    36
/**
90ce3da70b43 Initial load
duke
parents:
diff changeset
    37
 * Krb5 Mechanism plug in for JGSS
90ce3da70b43 Initial load
duke
parents:
diff changeset
    38
 * This is the properties object required by the JGSS framework.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    39
 * All mechanism specific information is defined here.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    40
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
    41
 * @author Mayank Upadhyay
90ce3da70b43 Initial load
duke
parents:
diff changeset
    42
 */
90ce3da70b43 Initial load
duke
parents:
diff changeset
    43
90ce3da70b43 Initial load
duke
parents:
diff changeset
    44
public final class Krb5MechFactory implements MechanismFactory {
90ce3da70b43 Initial load
duke
parents:
diff changeset
    45
90ce3da70b43 Initial load
duke
parents:
diff changeset
    46
    private static final boolean DEBUG = Krb5Util.DEBUG;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    47
90ce3da70b43 Initial load
duke
parents:
diff changeset
    48
    static final Provider PROVIDER =
90ce3da70b43 Initial load
duke
parents:
diff changeset
    49
        new sun.security.jgss.SunProvider();
90ce3da70b43 Initial load
duke
parents:
diff changeset
    50
90ce3da70b43 Initial load
duke
parents:
diff changeset
    51
    static final Oid GSS_KRB5_MECH_OID =
90ce3da70b43 Initial load
duke
parents:
diff changeset
    52
        createOid("1.2.840.113554.1.2.2");
90ce3da70b43 Initial load
duke
parents:
diff changeset
    53
90ce3da70b43 Initial load
duke
parents:
diff changeset
    54
    static final Oid NT_GSS_KRB5_PRINCIPAL =
90ce3da70b43 Initial load
duke
parents:
diff changeset
    55
        createOid("1.2.840.113554.1.2.2.1");
90ce3da70b43 Initial load
duke
parents:
diff changeset
    56
90ce3da70b43 Initial load
duke
parents:
diff changeset
    57
    private static Oid[] nameTypes =
90ce3da70b43 Initial load
duke
parents:
diff changeset
    58
        new Oid[] { GSSName.NT_USER_NAME,
90ce3da70b43 Initial load
duke
parents:
diff changeset
    59
                        GSSName.NT_HOSTBASED_SERVICE,
90ce3da70b43 Initial load
duke
parents:
diff changeset
    60
                        GSSName.NT_EXPORT_NAME,
90ce3da70b43 Initial load
duke
parents:
diff changeset
    61
                        NT_GSS_KRB5_PRINCIPAL};
90ce3da70b43 Initial load
duke
parents:
diff changeset
    62
2942
37d9baeb7518 6578647: Undefined requesting URL in java.net.Authenticator.getPasswordAuthentication()
weijun
parents: 2
diff changeset
    63
    final private GSSCaller caller;
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
    64
90ce3da70b43 Initial load
duke
parents:
diff changeset
    65
    private static Krb5CredElement getCredFromSubject(GSSNameSpi name,
90ce3da70b43 Initial load
duke
parents:
diff changeset
    66
                                                      boolean initiate)
90ce3da70b43 Initial load
duke
parents:
diff changeset
    67
        throws GSSException {
90ce3da70b43 Initial load
duke
parents:
diff changeset
    68
        Vector<Krb5CredElement> creds =
90ce3da70b43 Initial load
duke
parents:
diff changeset
    69
            GSSUtil.searchSubject(name, GSS_KRB5_MECH_OID, initiate,
90ce3da70b43 Initial load
duke
parents:
diff changeset
    70
                                  (initiate ?
90ce3da70b43 Initial load
duke
parents:
diff changeset
    71
                                   Krb5InitCredential.class :
90ce3da70b43 Initial load
duke
parents:
diff changeset
    72
                                   Krb5AcceptCredential.class));
90ce3da70b43 Initial load
duke
parents:
diff changeset
    73
90ce3da70b43 Initial load
duke
parents:
diff changeset
    74
        Krb5CredElement result = ((creds == null || creds.isEmpty()) ?
90ce3da70b43 Initial load
duke
parents:
diff changeset
    75
                                  null : creds.firstElement());
90ce3da70b43 Initial load
duke
parents:
diff changeset
    76
90ce3da70b43 Initial load
duke
parents:
diff changeset
    77
        // Force permission check before returning the cred to caller
90ce3da70b43 Initial load
duke
parents:
diff changeset
    78
        if (result != null) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
    79
            if (initiate) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
    80
                checkInitCredPermission((Krb5NameElement) result.getName());
90ce3da70b43 Initial load
duke
parents:
diff changeset
    81
            } else {
90ce3da70b43 Initial load
duke
parents:
diff changeset
    82
                checkAcceptCredPermission
90ce3da70b43 Initial load
duke
parents:
diff changeset
    83
                    ((Krb5NameElement) result.getName(), name);
90ce3da70b43 Initial load
duke
parents:
diff changeset
    84
            }
90ce3da70b43 Initial load
duke
parents:
diff changeset
    85
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
    86
        return result;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    87
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
    88
23735
34d83df87817 8039575: liberate two manual kerberos tests
weijun
parents: 23010
diff changeset
    89
    public Krb5MechFactory() {
34d83df87817 8039575: liberate two manual kerberos tests
weijun
parents: 23010
diff changeset
    90
        this(GSSCaller.CALLER_UNKNOWN);
34d83df87817 8039575: liberate two manual kerberos tests
weijun
parents: 23010
diff changeset
    91
    }
34d83df87817 8039575: liberate two manual kerberos tests
weijun
parents: 23010
diff changeset
    92
2942
37d9baeb7518 6578647: Undefined requesting URL in java.net.Authenticator.getPasswordAuthentication()
weijun
parents: 2
diff changeset
    93
    public Krb5MechFactory(GSSCaller caller) {
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
    94
        this.caller = caller;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    95
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
    96
90ce3da70b43 Initial load
duke
parents:
diff changeset
    97
    public GSSNameSpi getNameElement(String nameStr, Oid nameType)
90ce3da70b43 Initial load
duke
parents:
diff changeset
    98
        throws GSSException {
90ce3da70b43 Initial load
duke
parents:
diff changeset
    99
        return Krb5NameElement.getInstance(nameStr, nameType);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   100
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   101
90ce3da70b43 Initial load
duke
parents:
diff changeset
   102
    public GSSNameSpi getNameElement(byte[] name, Oid nameType)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   103
        throws GSSException {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   104
        // At this point, even an exported name is stripped down to safe
90ce3da70b43 Initial load
duke
parents:
diff changeset
   105
        // bytes only
90ce3da70b43 Initial load
duke
parents:
diff changeset
   106
        // XXX Use encoding here
90ce3da70b43 Initial load
duke
parents:
diff changeset
   107
        return Krb5NameElement.getInstance(new String(name), nameType);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   108
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   109
90ce3da70b43 Initial load
duke
parents:
diff changeset
   110
    public GSSCredentialSpi getCredentialElement(GSSNameSpi name,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   111
           int initLifetime, int acceptLifetime,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   112
           int usage) throws GSSException {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   113
90ce3da70b43 Initial load
duke
parents:
diff changeset
   114
        if (name != null && !(name instanceof Krb5NameElement)) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   115
            name = Krb5NameElement.getInstance(name.toString(),
90ce3da70b43 Initial load
duke
parents:
diff changeset
   116
                                       name.getStringNameType());
90ce3da70b43 Initial load
duke
parents:
diff changeset
   117
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   118
90ce3da70b43 Initial load
duke
parents:
diff changeset
   119
        Krb5CredElement credElement = getCredFromSubject
90ce3da70b43 Initial load
duke
parents:
diff changeset
   120
            (name, (usage != GSSCredential.ACCEPT_ONLY));
90ce3da70b43 Initial load
duke
parents:
diff changeset
   121
90ce3da70b43 Initial load
duke
parents:
diff changeset
   122
        if (credElement == null) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   123
            if (usage == GSSCredential.INITIATE_ONLY ||
90ce3da70b43 Initial load
duke
parents:
diff changeset
   124
                usage == GSSCredential.INITIATE_AND_ACCEPT) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   125
                credElement = Krb5InitCredential.getInstance
90ce3da70b43 Initial load
duke
parents:
diff changeset
   126
                    (caller, (Krb5NameElement) name, initLifetime);
58611
53ddf218eddd 8220302: Better Kerberos ccache handling
weijun
parents: 47216
diff changeset
   127
                credElement = Krb5ProxyCredential.tryImpersonation(
53ddf218eddd 8220302: Better Kerberos ccache handling
weijun
parents: 47216
diff changeset
   128
                        caller, (Krb5InitCredential)credElement);
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   129
                checkInitCredPermission
90ce3da70b43 Initial load
duke
parents:
diff changeset
   130
                    ((Krb5NameElement) credElement.getName());
90ce3da70b43 Initial load
duke
parents:
diff changeset
   131
            } else if (usage == GSSCredential.ACCEPT_ONLY) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   132
                credElement =
90ce3da70b43 Initial load
duke
parents:
diff changeset
   133
                    Krb5AcceptCredential.getInstance(caller,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   134
                                                     (Krb5NameElement) name);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   135
                checkAcceptCredPermission
90ce3da70b43 Initial load
duke
parents:
diff changeset
   136
                    ((Krb5NameElement) credElement.getName(), name);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   137
            } else
90ce3da70b43 Initial load
duke
parents:
diff changeset
   138
                throw new GSSException(GSSException.FAILURE, -1,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   139
                                       "Unknown usage mode requested");
90ce3da70b43 Initial load
duke
parents:
diff changeset
   140
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   141
        return credElement;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   142
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   143
90ce3da70b43 Initial load
duke
parents:
diff changeset
   144
    public static void checkInitCredPermission(Krb5NameElement name) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   145
        SecurityManager sm = System.getSecurityManager();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   146
        if (sm != null) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   147
            String realm = (name.getKrb5PrincipalName()).getRealmAsString();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   148
            String tgsPrincipal =
90ce3da70b43 Initial load
duke
parents:
diff changeset
   149
                new String("krbtgt/" + realm + '@' + realm);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   150
            ServicePermission perm =
90ce3da70b43 Initial load
duke
parents:
diff changeset
   151
                new ServicePermission(tgsPrincipal, "initiate");
90ce3da70b43 Initial load
duke
parents:
diff changeset
   152
            try {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   153
                sm.checkPermission(perm);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   154
            } catch (SecurityException e) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   155
                if (DEBUG) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   156
                    System.out.println("Permission to initiate" +
90ce3da70b43 Initial load
duke
parents:
diff changeset
   157
                        "kerberos init credential" + e.getMessage());
90ce3da70b43 Initial load
duke
parents:
diff changeset
   158
                }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   159
                throw e;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   160
            }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   161
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   162
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   163
90ce3da70b43 Initial load
duke
parents:
diff changeset
   164
    public static void checkAcceptCredPermission(Krb5NameElement name,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   165
                                           GSSNameSpi originalName) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   166
        SecurityManager sm = System.getSecurityManager();
15006
10d6aacdd67f 8005447: default principal should act as anyone
weijun
parents: 5506
diff changeset
   167
        if (sm != null && name != null) {
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   168
            ServicePermission perm = new ServicePermission
90ce3da70b43 Initial load
duke
parents:
diff changeset
   169
                (name.getKrb5PrincipalName().getName(), "accept");
90ce3da70b43 Initial load
duke
parents:
diff changeset
   170
            try {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   171
                sm.checkPermission(perm);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   172
            } catch (SecurityException e) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   173
                if (originalName == null) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   174
                    // Don't disclose the name of the principal
90ce3da70b43 Initial load
duke
parents:
diff changeset
   175
                    e = new SecurityException("No permission to acquire "
90ce3da70b43 Initial load
duke
parents:
diff changeset
   176
                                      + "Kerberos accept credential");
90ce3da70b43 Initial load
duke
parents:
diff changeset
   177
                    // Don't call e.initCause() with caught exception
90ce3da70b43 Initial load
duke
parents:
diff changeset
   178
                }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   179
                throw e;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   180
            }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   181
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   182
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   183
90ce3da70b43 Initial load
duke
parents:
diff changeset
   184
    public GSSContextSpi getMechanismContext(GSSNameSpi peer,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   185
                             GSSCredentialSpi myInitiatorCred, int lifetime)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   186
        throws GSSException {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   187
        if (peer != null && !(peer instanceof Krb5NameElement)) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   188
            peer = Krb5NameElement.getInstance(peer.toString(),
90ce3da70b43 Initial load
duke
parents:
diff changeset
   189
                                       peer.getStringNameType());
90ce3da70b43 Initial load
duke
parents:
diff changeset
   190
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   191
        // XXX Convert myInitiatorCred to Krb5CredElement
90ce3da70b43 Initial load
duke
parents:
diff changeset
   192
        if (myInitiatorCred == null) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   193
            myInitiatorCred = getCredentialElement(null, lifetime, 0,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   194
                GSSCredential.INITIATE_ONLY);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   195
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   196
        return new Krb5Context(caller, (Krb5NameElement)peer,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   197
                               (Krb5CredElement)myInitiatorCred, lifetime);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   198
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   199
90ce3da70b43 Initial load
duke
parents:
diff changeset
   200
    public GSSContextSpi getMechanismContext(GSSCredentialSpi myAcceptorCred)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   201
        throws GSSException {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   202
        // XXX Convert myAcceptorCred to Krb5CredElement
90ce3da70b43 Initial load
duke
parents:
diff changeset
   203
        if (myAcceptorCred == null) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   204
            myAcceptorCred = getCredentialElement(null, 0,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   205
                GSSCredential.INDEFINITE_LIFETIME, GSSCredential.ACCEPT_ONLY);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   206
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   207
        return new Krb5Context(caller, (Krb5CredElement)myAcceptorCred);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   208
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   209
90ce3da70b43 Initial load
duke
parents:
diff changeset
   210
    public GSSContextSpi getMechanismContext(byte[] exportedContext)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   211
        throws GSSException {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   212
        return new Krb5Context(caller, exportedContext);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   213
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   214
90ce3da70b43 Initial load
duke
parents:
diff changeset
   215
90ce3da70b43 Initial load
duke
parents:
diff changeset
   216
    public final Oid getMechanismOid() {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   217
        return GSS_KRB5_MECH_OID;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   218
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   219
90ce3da70b43 Initial load
duke
parents:
diff changeset
   220
    public Provider getProvider() {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   221
        return PROVIDER;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   222
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   223
90ce3da70b43 Initial load
duke
parents:
diff changeset
   224
    public Oid[] getNameTypes() {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   225
        // nameTypes is cloned in GSSManager.getNamesForMech
90ce3da70b43 Initial load
duke
parents:
diff changeset
   226
        return nameTypes;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   227
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   228
90ce3da70b43 Initial load
duke
parents:
diff changeset
   229
    private static Oid createOid(String oidStr) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   230
        Oid retVal = null;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   231
        try {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   232
            retVal = new Oid(oidStr);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   233
        } catch (GSSException e) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   234
            // Should not happen!
90ce3da70b43 Initial load
duke
parents:
diff changeset
   235
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   236
        return retVal;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   237
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   238
}