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.
- class jeepney.auth.SASLParser[source]¶
Parse authentication messages received
- error¶
None
, or the raw bytes of an error message if authentication failed.
- exception jeepney.auth.AuthenticationError(data)[source]¶
Raised by integration code when DBus authentication fails
Typical flow¶
Send a null byte to start.
Prepare & send an AUTH command, e.g. from
make_auth_external()
.Feed received data to
SASLParser
until eitherauthenticated
orerror
is set.Send
BEGIN
.Start sending & receiving D-Bus messages.