Package org.freedesktop.dbus.connections
Class SASL
java.lang.Object
org.freedesktop.dbus.connections.SASL
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic class(package private) static enumstatic enumstatic enumstatic enum -
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final intstatic final intstatic final intstatic final intprivate static final Set<PosixFilePermission> private Stringprivate static final Collatorprivate Stringstatic final Stringstatic final intprivate static final Fileprivate static final Stringstatic final intprivate booleanwhether file descriptor passing is supported on the current connection.static final intprivate final org.slf4j.Loggerprivate static final intstatic final intstatic final intprivate final SaslConfigprivate static final String -
Constructor Summary
ConstructorsConstructorDescriptionSASL()Deprecated, for removal: This API element is subject to removal in a future version.should not be used as SASL configuration is not providedSASL(SaslConfig _saslConfig) Create a new SASL auth handler. -
Method Summary
Modifier and TypeMethodDescriptionprivate voidbooleanauth(SocketChannel _sock, AbstractTransport _transport) Performs SASL auth on the given socketchannel.String[]convertAuthTypes(int _types) (package private) SASL.SaslResultdoChallenge(int _auth, SASL.Command _c) (package private) SASL.SaslResultdoResponse(int _auth, String _uid, String _kernelUid, SASL.Command _c) private StringfindCookie(String _context, String _id) private bytegetNibble(char _c) private longTries to get the UID (user ID) of the current JVM process.private inthandleReject(int _available, String _luid, SocketChannel _sock) Handle reject of authentication.booleanreceive(SocketChannel _sock) voidsend(SocketChannel _sock, SASL.SaslCommand _command, String... _data) private StringstupidlyDecode(String _data) private StringstupidlyEncode(byte[] _data) private StringstupidlyEncode(String _data) Takes the string, encodes it as hex and then turns it into a string again.
-
Field Details
-
AUTH_NONE
public static final int AUTH_NONE- See Also:
-
AUTH_EXTERNAL
public static final int AUTH_EXTERNAL- See Also:
-
AUTH_SHA
public static final int AUTH_SHA- See Also:
-
AUTH_ANON
public static final int AUTH_ANON- See Also:
-
LOCK_TIMEOUT
public static final int LOCK_TIMEOUT- See Also:
-
NEW_KEY_TIMEOUT_SECONDS
public static final int NEW_KEY_TIMEOUT_SECONDS- See Also:
-
EXPIRE_KEYS_TIMEOUT_SECONDS
public static final int EXPIRE_KEYS_TIMEOUT_SECONDS- See Also:
-
MAX_TIME_TRAVEL_SECONDS
public static final int MAX_TIME_TRAVEL_SECONDS- See Also:
-
COOKIE_TIMEOUT
public static final int COOKIE_TIMEOUT- See Also:
-
COOKIE_CONTEXT
- See Also:
-
MAX_READ_BYTES
private static final int MAX_READ_BYTES- See Also:
-
COL
-
SYSPROP_USER_HOME
-
DBUS_TEST_HOME_DIR
-
DBUS_KEYRINGS_DIR
-
BAD_FILE_PERMISSIONS
-
challenge
-
cookie
-
logger
private final org.slf4j.Logger logger -
fileDescriptorSupported
private boolean fileDescriptorSupportedwhether file descriptor passing is supported on the current connection. -
saslConfig
-
-
Constructor Details
-
SASL
Deprecated, for removal: This API element is subject to removal in a future version.should not be used as SASL configuration is not providedCreate a new SASL auth handler. Defaults to disable file descriptor passing. -
SASL
Create a new SASL auth handler.- Parameters:
_saslConfig- SASL configuration_hasFileDescriptorSupport- true to support file descriptor passing (usually only works with UNIX_SOCKET).
-
-
Method Details
-
findCookie
- Throws:
IOException
-
addCookie
private void addCookie(String _context, String _id, long _timestamp, String _cookie) throws IOException - Throws:
IOException
-
stupidlyEncode
Takes the string, encodes it as hex and then turns it into a string again. No, I don't know why either. -
stupidlyEncode
-
getNibble
private byte getNibble(char _c) -
stupidlyDecode
-
receive
- Throws:
IOException
-
send
public void send(SocketChannel _sock, SASL.SaslCommand _command, String... _data) throws IOException - Throws:
IOException
-
doChallenge
- Throws:
IOException
-
doResponse
-
convertAuthTypes
-
auth
Performs SASL auth on the given socketchannel. Mode selects whether to run as a SASL server or client. Types is a bitmask of the available auth types.- Parameters:
_sock- socket channel_transport- transport_config- sasl configuration parameters- Returns:
- true if the auth was successful and false if it failed.
- Throws:
IOException- on failure
-
isFileDescriptorSupported
public boolean isFileDescriptorSupported() -
handleReject
Handle reject of authentication.- Parameters:
_available-_luid-_sock- socketchannel- Returns:
- current state or -1 if failed
- Throws:
IOException- when sending fails
-
getUserId
private long getUserId()Tries to get the UID (user ID) of the current JVM process. Will always return 0 on windows.- Returns:
- long
-