1
0
Fork 0
mirror of https://github.com/vanitasvitae/Smack.git synced 2024-06-16 08:34:50 +02:00
Smack/smack-sasl-javax/src/main/java/org/jivesoftware/smack/sasl/javax/SASLGSSAPIMechanism.java
Florian Schmaus 35cf094386 sasl-javax: Do not set system properties in SASLGSSAPIMechanism
Smack did this for a long time, since eb56f8a55 ("GSSAPI work by Jay
Kline (SMACK-218)."). Not always in a static block though. But
irregardless this is bad practice as it causes side-effects and may
overrides settings.

For example, one users reports:

java.lang.SecurityException: java.io.IOException: gss.conf (No such file or directory)
    at sun.security.provider.ConfigFile$Spi.<init>(ConfigFile.java:137)
    at sun.security.provider.ConfigFile.<init>(ConfigFile.java:102)
    at sun.reflect.GeneratedConstructorAccessor119.newInstance(Unknown Source)
2019-09-25 23:36:21 +02:00

70 lines
1.7 KiB
Java

/**
*
* Copyright the original author or authors
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.jivesoftware.smack.sasl.javax;
import java.util.Map;
import javax.security.sasl.Sasl;
/**
* Implementation of the SASL GSSAPI mechanism.
*
* @author Jay Kline
*/
public class SASLGSSAPIMechanism extends SASLJavaXMechanism {
public static final String NAME = GSSAPI;
@Override
public boolean authzidSupported() {
return true;
}
@Override
public String getName() {
return NAME;
}
@Override
protected Map<String, String> getSaslProps() {
Map<String, String> props = super.getSaslProps();
props.put(Sasl.SERVER_AUTH, "TRUE");
return props;
}
/**
* GSSAPI differs from all other SASL mechanism such that it required the FQDN host name as
* server name and not the serviceName (At least that is what old code comments of Smack tell
* us).
*/
@Override
protected String getServerName() {
return host;
}
@Override
public int getPriority() {
return 100;
}
@Override
public SASLGSSAPIMechanism newInstance() {
return new SASLGSSAPIMechanism();
}
}