Package com.lucimber.dbus.connection.sasl


package com.lucimber.dbus.connection.sasl
Simple Authentication and Security Layer (SASL) implementation for D-Bus authentication.

This package provides core SASL types and data structures used by the D-Bus authentication system. The actual SASL authentication implementation is handled by the com.lucimber.dbus.netty.sasl package.

Core SASL Types

SaslMessage

Represents SASL protocol messages exchanged during authentication:


 SaslMessage authMessage = SaslMessage.create(
     SaslCommandName.AUTH,
     "EXTERNAL",
     "31303030"  // UID as hex
 );
 

SaslCommandName

Enumeration of SASL command types:

  • AUTH: Authentication initiation
  • CANCEL: Authentication cancellation
  • DATA: Authentication data exchange
  • BEGIN: Start message protocol
  • REJECTED: Authentication rejected
  • OK: Authentication successful
  • ERROR: Protocol error

SaslAuthMechanism

Enumeration of supported authentication mechanisms:

  • EXTERNAL: Unix credentials authentication
  • COOKIE: Cookie-based authentication (DBUS_COOKIE_SHA1)
  • ANONYMOUS: Anonymous authentication

Authentication Process

The SASL authentication follows the D-Bus specification:

  1. Mechanism Selection: Client proposes authentication mechanism
  2. Challenge Exchange: Server may send challenges, client responds
  3. Authentication Result: Server sends OK or REJECTED
  4. Protocol Start: Client sends BEGIN to start D-Bus message protocol

 // Typical SASL flow:
 // Client -> Server: AUTH EXTERNAL 31303030
 // Server -> Client: OK b25c0b89b8f9b4e9d2a8c4f3e7d6b1a0
 // Client -> Server: BEGIN
 

Implementation Notes

This package contains data types and constants only. The actual SASL authentication logic is implemented in:

Authentication is performed automatically during connection establishment. No manual SASL configuration is required for standard D-Bus connections.

Since:
2.0
See Also:
  • Class
    Description
    An enum that describes the supported authentication mechanisms.
    Contains all SASL command names used by D-Bus.
    A SASL message exchanged between a D-Bus instance (server) and a client application.