Authentication Credentials¶
The credentials classes are used to encapsulate all authentication
information for the ConnectionParameters
class.
The PlainCredentials
class returns the properly
formatted username and password to the Connection
.
To authenticate with Pika, create a PlainCredentials
object passing in the username and password and pass it as the credentials
argument value to the ConnectionParameters
object.
If you are using URLParameters
you do not need a
credentials object, one will automatically be created for you.
If you are looking to implement SSL certificate style authentication, you would
extend the ExternalCredentials
class implementing
the required behavior.
PlainCredentials¶
- class pika.credentials.PlainCredentials(username, password, erase_on_connect=False)[source]
A credentials object for the default authentication methodology with RabbitMQ.
If you do not pass in credentials to the ConnectionParameters object, it will create credentials for ‘guest’ with the password of ‘guest’.
If you pass True to erase_on_connect the credentials will not be stored in memory after the Connection attempt has been made.
- Parameters
- erase_credentials()[source]
Called by Connection when it no longer needs the credentials