src/java.security.jgss/share/classes/sun/security/jgss/ProviderList.java
changeset 51398 3c389a284345
parent 47216 71c04702a3d5
equal deleted inserted replaced
51397:c9150700bbd0 51398:3c389a284345
     1 /*
     1 /*
     2  * Copyright (c) 2000, 2009, Oracle and/or its affiliates. All rights reserved.
     2  * Copyright (c) 2000, 2018, Oracle and/or its affiliates. All rights reserved.
     3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
     3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
     4  *
     4  *
     5  * This code is free software; you can redistribute it and/or modify it
     5  * This code is free software; you can redistribute it and/or modify it
     6  * under the terms of the GNU General Public License version 2 only, as
     6  * under the terms of the GNU General Public License version 2 only, as
     7  * published by the Free Software Foundation.  Oracle designates this
     7  * published by the Free Software Foundation.  Oracle designates this
    25 
    25 
    26 package sun.security.jgss;
    26 package sun.security.jgss;
    27 
    27 
    28 import java.lang.reflect.InvocationTargetException;
    28 import java.lang.reflect.InvocationTargetException;
    29 import org.ietf.jgss.*;
    29 import org.ietf.jgss.*;
    30 import java.security.AccessController;
       
    31 import java.security.Provider;
    30 import java.security.Provider;
    32 import java.security.Security;
    31 import java.security.Security;
    33 import java.util.ArrayList;
    32 import java.util.ArrayList;
    34 import java.util.HashSet;
    33 import java.util.HashSet;
    35 import java.util.HashMap;
    34 import java.util.HashMap;
    91         PROV_PROP_PREFIX.length();
    90         PROV_PROP_PREFIX.length();
    92 
    91 
    93     private static final String SPI_MECH_FACTORY_TYPE
    92     private static final String SPI_MECH_FACTORY_TYPE
    94         = "sun.security.jgss.spi.MechanismFactory";
    93         = "sun.security.jgss.spi.MechanismFactory";
    95 
    94 
    96     // Undocumented property?
       
    97     private static final String DEFAULT_MECH_PROP =
       
    98         "sun.security.jgss.mechanism";
       
    99 
       
   100     public static final Oid DEFAULT_MECH_OID;
    95     public static final Oid DEFAULT_MECH_OID;
   101 
    96 
   102     static {
    97     static {
   103         /*
    98         /*
   104          * Set the default mechanism. Kerberos v5 is the default
    99          * Set the default mechanism. Kerberos v5 is the default
   105          * mechanism unless it is overridden by a system property.
   100          * mechanism unless it is overridden by a system property.
   106          * with a valid OID value
   101          * with a valid OID value
   107          */
   102          */
   108         Oid defOid = null;
   103         Oid defOid = null;
   109         String defaultOidStr = AccessController.doPrivileged
   104         String defaultOidStr = GetPropertyAction
   110             (new GetPropertyAction(DEFAULT_MECH_PROP));
   105                 .privilegedGetProperty("sun.security.jgss.mechanism");
   111         if (defaultOidStr != null) {
   106         if (defaultOidStr != null) {
   112             defOid = GSSUtil.createOid(defaultOidStr);
   107             defOid = GSSUtil.createOid(defaultOidStr);
   113         }
   108         }
   114         DEFAULT_MECH_OID =
   109         DEFAULT_MECH_OID =
   115             (defOid == null ? GSSUtil.GSS_KRB5_MECH_OID : defOid);
   110             (defOid == null ? GSSUtil.GSS_KRB5_MECH_OID : defOid);