o 3O @s:dZeZddgZddlZGdddZGdddeZdS)a Classes to authorize lazr.restfulclient with various web services. This module includes an authorizer classes for HTTP Basic Auth, as well as a base-class authorizer that does nothing. A set of classes for authorizing with OAuth is located in the 'oauth' module. BasicHttpAuthorizerHttpAuthorizerNc@s,eZdZdZddZddZeddZdS) raHandles authentication for HTTP requests. There are two ways to authenticate. The authorize_session() method is called once when the client is initialized. This works for authentication methods like Basic Auth. The authorize_request is called for every HTTP request, which is useful for authentication methods like Digest and OAuth. The base class is a null authorizer which does not perform any authentication at all. cCdS)z*Set up credentials for the entire session.NselfclientrrG/usr/lib/python3/dist-packages/lazr/restfulclient/authorize/__init__.pyauthorizeSession2szHttpAuthorizer.authorizeSessioncCr)ztSet up credentials for a single request. This probably involves setting the Authentication header. Nrr absolute_urimethodbodyheadersrrr authorizeRequest6szHttpAuthorizer.authorizeRequestcCsiS)aGAny parameters necessary to identify this user agent. By default this is an empty dict (because authentication details don't contain any information about the application making the request), but when a resource is protected by OAuth, the OAuth consumer name is part of the user agent. r)rrrr user_agent_params=s z HttpAuthorizer.user_agent_paramsN)__name__ __module__ __qualname____doc__r rpropertyrrrrr r%s  c@s(eZdZdZddZddZddZdS) rz=Handles authentication for services that use HTTP Basic Auth.cCs||_||_dS)zConstructor. :param username: User to send as authorization for all requests. :param password: Password to send as authorization for all requests. N)usernamepassword)rrrrrr __init__Ls zBasicHttpAuthorizer.__init__cCs&dtd|j|jf|d<dS)zySet up credentials for a single request. This sets the authorization header with the username/password. zBasic z%s:%s authorizationN)base64 b64encoderrstripr rrr rUs  z$BasicHttpAuthorizer.authorizeRequestcCs||j|jdS)N)add_credentialsrrrrrr r ]sz$BasicHttpAuthorizer.authorizeSessionN)rrrrrrr rrrr rIs  )rtype __metaclass____all__rrrrrrr s $