CredentialStore¶
-
class
pyvo.auth.credentialstore.
CredentialStore
[source]¶ Bases:
object
The credential store takes user credentials, and uses them to create appropriate requests sessions for dispatching requests using those credentials.
Different types of credentials can be passed in, such as cookies, a jar of cookies, certificates, and basic auth.
A session can also be associated with a security method URI by calling the set function.
Before a request is to be dispatched, the AuthSession calls the get method to retrieve the appropriate requests.Session for making that HTTP request.
Methods Summary
get
(method_uri)Retrieve the requests.Session like object associated with a security method URI. negotiate_method
(allowed_methods)Compare the credentials provided by the user against the security methods passed in, and determine which method is to be used for making this request. set
(method_uri, session)Associate a security method URI with a requests.Session like object. set_client_certificate
(certificate_path)Add a client certificate to use for authentication. set_cookie
(cookie_name, cookie_value[, …])Add a cookie to use as authentication. set_cookie_jar
(cookie_jar)Set the cookie jar to use for authentication. set_password
(username, password)Add a username / password for basic authentication. Methods Documentation
-
get
(method_uri)[source]¶ Retrieve the requests.Session like object associated with a security method URI.
Parameters: - method_uri : str
URI representing the security method
-
negotiate_method
(allowed_methods)[source]¶ Compare the credentials provided by the user against the security methods passed in, and determine which method is to be used for making this request.
Parameters: - allowed_methods : list(str)
list of allowed security methods to return
Raises: - Raises an exception if a common method could not be negotiated.
-
set
(method_uri, session)[source]¶ Associate a security method URI with a requests.Session like object.
Parameters: - method_uri : str
URI representing the security method
- session : object
the requests.Session like object that will dispatch requests for the authentication method provided by method_uri
-
set_client_certificate
(certificate_path)[source]¶ Add a client certificate to use for authentication.
Parameters: - certificate_path : str
path to the file of the client certificate
Add a cookie to use as authentication.
More than one call to set_cookie will add multiple cookies into the same cookie jar used for the request.
Parameters: - cookie_name : str
name of the cookie
- cookie_value : str
value of the cookie
- domain : str
restrict usage of this cookie to this domain
- path : str
restrict usage of this cookie to this path
Set the cookie jar to use for authentication.
Any previous cookies or cookie jars set will be removed.
Parameters: - cookie_jar : obj
the cookie jar to use.
-