Added authentication information.

closes #115
This commit is contained in:
theunkn0wn1 2019-04-07 14:15:46 -07:00
parent d9fbd6019b
commit 7e2ba474d0
No known key found for this signature in database
GPG Key ID: A929E17B5504016C
2 changed files with 48 additions and 1 deletions

View File

@ -22,7 +22,7 @@ Features
Basic Usage Basic Usage
----------- -----------
`python3 setup.py install` `pip install pydle`
From there, you can `import pydle` and subclass `pydle.Client` for your own functionality. From there, you can `import pydle` and subclass `pydle.Client` for your own functionality.

View File

@ -60,6 +60,53 @@ This trivial example shows a few things:
was implemented or no callbacks overridden. was implemented or no callbacks overridden.
.. _`advanced string formatting`: http://legacy.python.org/dev/peps/pep-3101/ .. _`advanced string formatting`: http://legacy.python.org/dev/peps/pep-3101/
Authentication
-----------------
Pydle can also handle authenticating against IRC services by default, all you need to do is tell
it what its credentials are.
.. note::
the server must support SASL based authentication.
-----------
SASL(Username + password)
-----------
To authenticate, pydle simply needs to be provided with a set of credentials to present during the
connection process, the most common type being a username+password pair
.. code:: python
import pydle
client = pydle.Client(
nickname="my_irc_bot[bot]",
sasl_username = "username",
sasl_password = "my_secret_bot_password",
sasl_identity = "account_to_identify_against",
)
-----------
External authentication (Certificate)
-----------
As an alternative to using passwords for credentials, certificates can also be used via the
SASL (External) authentication method.
All you need to do is tell pydle where it can find the certificate, which it will then present
during the TLS handshake when connecting to the server.
.. code:: python
import pydle
client = pydle.Client(
nickname="my_irc_bot[bot]",
sasl_mechanism = "EXTERNAL",
tls_client_cert = "/path/to/client_certificate"
)
.. note::
this authentication mode only works over TLS connections
Multiple servers, multiple clients Multiple servers, multiple clients
---------------------------------- ----------------------------------