
org.freedesktop.dbus.connections.config.SaslConfigBuilder Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of dbus-java-osgi Show documentation
Show all versions of dbus-java-osgi Show documentation
Improved version of the DBus-Java library provided by freedesktop.org (https://dbus.freedesktop.org/doc/dbus-java/).
This is the OSGi compliant bundle of all required libraries in one bundle.
The newest version!
package org.freedesktop.dbus.connections.config;
import org.freedesktop.dbus.connections.transports.TransportBuilder.SaslAuthMode;
import java.util.OptionalLong;
/**
* Configuration used to setup a sasl authentication.
*
* @author hypfvieh
* @since v4.2.2 - 2023-02-03
*/
public final class SaslConfigBuilder {
private SaslConfig saslConfig;
private final TransportConfigBuilder, R> transportBuilder;
SaslConfigBuilder(TransportConfigBuilder, R> _transportBuilder) {
saslConfig = new SaslConfig();
transportBuilder = _transportBuilder;
}
/**
* Return to the previous builder.
*
* This allows you to return from the this builder to the builder which
* started this builder so you can continue using the previous builder.
*
*
* @return previous builder, maybe null
*/
public TransportConfigBuilder, R> back() {
return transportBuilder;
}
/**
* Setup the authentication mode to use.
* null
values will be ignored.
*
* @param _types auth mode to set
* @return this
*/
public SaslConfigBuilder withAuthMode(SaslAuthMode _types) {
if (_types != null) {
saslConfig.setAuthMode(_types.getAuthMode());
}
return this;
}
/**
* Setup the user ID to use for authentication when using unix sockets.
* Will default to the user ID of the user running the current process.
*
* @param _saslUid uid to use
* @return this
*/
public SaslConfigBuilder withSaslUid(Long _saslUid) {
saslConfig.setSaslUid(OptionalLong.of(_saslUid));
return this;
}
/**
* Enable/disable checking of file permissions of the cookie files (used for DBUS_COOKIE_SHA1).
* Cookie permission check will only be used on Linux/Unix like OSes.
* Default is false (no strict checking).
*
* @param _strictCookiePermissions boolean
* @return this
*/
public SaslConfigBuilder withStrictCookiePermissions(boolean _strictCookiePermissions) {
saslConfig.setStrictCookiePermissions(_strictCookiePermissions);
return this;
}
/**
* Returns the created configuration.
* @return SaslConfig
*/
public SaslConfig build() {
return saslConfig;
}
/**
* Replace the current {@link SaslConfig} with the given instance.
* Will do nothing if null
is given.
*
* @param _cfg sasl config
* @return this
*/
SaslConfigBuilder withConfig(SaslConfig _cfg) {
if (_cfg != null) {
saslConfig = _cfg;
}
return this;
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy