Authentication

Note

If you use any of Jeepney’s I/O integrations, authentication is built in. You only need these functions if you’re working outside that.

If you are setting up a socket for D-Bus, you will need to do SASL authentication before starting to send and receive D-Bus messages. This text based protocol is completely different to D-Bus itself.

Only a small fraction of SASL is implemented here, primarily what Jeepney’s integration layer uses. If you’re doing something different, you may need to implement other messages yourself.

jeepney.auth.make_auth_external() bytes[source]

Prepare an AUTH command line with the current effective user ID.

This is the preferred authentication method for typical D-Bus connections over a Unix domain socket.

jeepney.auth.make_auth_anonymous() bytes[source]

Format an AUTH command line for the ANONYMOUS mechanism

Jeepney’s higher-level wrappers don’t currently use this mechanism, but third-party code may choose to.

See <https://tools.ietf.org/html/rfc4505> for details.

jeepney.auth.BEGIN: bytes

Send this just before switching to the D-Bus protocol.

class jeepney.auth.SASLParser[source]

Parse authentication messages received

authenticated: bool

Initially False, changes to True when authentication has succeeded.

error

None, or the raw bytes of an error message if authentication failed.

feed(data: bytes)[source]

Process received data

exception jeepney.auth.AuthenticationError(data)[source]

Raised by integration code when DBus authentication fails

Typical flow