001/** 002 * 003 * Copyright the original author or authors 004 * 005 * Licensed under the Apache License, Version 2.0 (the "License"); 006 * you may not use this file except in compliance with the License. 007 * You may obtain a copy of the License at 008 * 009 * http://www.apache.org/licenses/LICENSE-2.0 010 * 011 * Unless required by applicable law or agreed to in writing, software 012 * distributed under the License is distributed on an "AS IS" BASIS, 013 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 014 * See the License for the specific language governing permissions and 015 * limitations under the License. 016 */ 017package org.jivesoftware.smack.sasl; 018 019import org.jivesoftware.smack.SASLAuthentication; 020 021/** 022 * Implementation of the SASL EXTERNAL mechanism. 023 * 024 * To effectively use this mechanism, Java must be configured to properly 025 * supply a client SSL certificate (of some sort) to the server. It is up 026 * to the implementer to determine how to do this. Here is one method: 027 * 028 * Create a java keystore with your SSL certificate in it: 029 * keytool -genkey -alias username -dname "cn=username,ou=organizationalUnit,o=organizationaName,l=locality,s=state,c=country" 030 * 031 * Next, set the System Properties: 032 * <ul> 033 * <li>javax.net.ssl.keyStore to the location of the keyStore 034 * <li>javax.net.ssl.keyStorePassword to the password of the keyStore 035 * <li>javax.net.ssl.trustStore to the location of the trustStore 036 * <li>javax.net.ssl.trustStorePassword to the the password of the trustStore 037 * </ul> 038 * 039 * Then, when the server requests or requires the client certificate, java will 040 * simply provide the one in the keyStore. 041 * 042 * Also worth noting is the EXTERNAL mechanism in Smack is not enabled by default. 043 * To enable it, the implementer will need to call SASLAuthentication.supportSASLMechamism("EXTERNAL"); 044 * 045 * @author Jay Kline 046 */ 047public class SASLExternalMechanism extends SASLMechanism { 048 049 public SASLExternalMechanism(SASLAuthentication saslAuthentication) { 050 super(saslAuthentication); 051 } 052 053 protected String getName() { 054 return "EXTERNAL"; 055 } 056}