1 /*
   2  * Copyright (c) 2003, 2014, Oracle and/or its affiliates. All rights reserved.
   3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
   4  *
   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
   7  * published by the Free Software Foundation.  Oracle designates this
   8  * particular file as subject to the "Classpath" exception as provided
   9  * by Oracle in the LICENSE file that accompanied this code.
  10  *
  11  * This code is distributed in the hope that it will be useful, but WITHOUT
  12  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  13  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  14  * version 2 for more details (a copy is included in the LICENSE file that
  15  * accompanied this code).
  16  *
  17  * You should have received a copy of the GNU General Public License version
  18  * 2 along with this work; if not, write to the Free Software Foundation,
  19  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  20  *
  21  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  22  * or visit www.oracle.com if you need additional information or have any
  23  * questions.
  24  */
  25 package com.sun.security.sasl;
  26 
  27 import java.security.AccessController;
  28 import java.security.PrivilegedAction;
  29 
  30 /**
  31  * The SASL provider.
  32  * Provides client support for
  33  * - EXTERNAL
  34  * - PLAIN
  35  * - CRAM-MD5
  36  * - DIGEST-MD5
  37  * - GSSAPI/Kerberos v5
  38  * - NTLM
  39  * And server support for
  40  * - CRAM-MD5
  41  * - DIGEST-MD5
  42  * - GSSAPI/Kerberos v5
  43  * - NTLM
  44  */
  45 
  46 public final class Provider extends java.security.Provider {
  47 
  48     private static final long serialVersionUID = 8622598936488630849L;
  49 
  50     private static final String info = "Sun SASL provider" +
  51         "(implements client mechanisms for: " +
  52         "DIGEST-MD5, GSSAPI, EXTERNAL, PLAIN, CRAM-MD5, NTLM;" +
  53         " server mechanisms for: DIGEST-MD5, GSSAPI, CRAM-MD5, NTLM)";
  54 
  55     public Provider() {
  56         super("SunSASL", 1.9d, info);
  57 
  58         AccessController.doPrivileged(new PrivilegedAction<Void>() {
  59             public Void run() {
  60                 // Client mechanisms
  61                 put("SaslClientFactory.DIGEST-MD5",
  62                     "com.sun.security.sasl.digest.FactoryImpl");
  63                 put("SaslClientFactory.NTLM",
  64                     "com.sun.security.sasl.ntlm.FactoryImpl");
  65                 put("SaslClientFactory.GSSAPI",
  66                     "com.sun.security.sasl.gsskerb.FactoryImpl");
  67 
  68                 put("SaslClientFactory.EXTERNAL",
  69                     "com.sun.security.sasl.ClientFactoryImpl");
  70                 put("SaslClientFactory.PLAIN",
  71                     "com.sun.security.sasl.ClientFactoryImpl");
  72                 put("SaslClientFactory.CRAM-MD5",
  73                     "com.sun.security.sasl.ClientFactoryImpl");
  74 
  75                 // Server mechanisms
  76                 put("SaslServerFactory.CRAM-MD5",
  77                     "com.sun.security.sasl.ServerFactoryImpl");
  78                 put("SaslServerFactory.GSSAPI",
  79                     "com.sun.security.sasl.gsskerb.FactoryImpl");
  80                 put("SaslServerFactory.DIGEST-MD5",
  81                     "com.sun.security.sasl.digest.FactoryImpl");
  82                 put("SaslServerFactory.NTLM",
  83                     "com.sun.security.sasl.ntlm.FactoryImpl");
  84                 return null;
  85             }
  86         });
  87     }
  88 }