ó
 KMc           @   sE   d  Z  e Z d d g Z d d d     YZ d e f d     YZ d S(   s	  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.
t   BasicHttpAuthorizert   HttpAuthorizerc           B   s/   e  Z d  Z d   Z d   Z e d    Z RS(   sÇ  Handles 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.
    c         C   s   d S(   s*   Set up credentials for the entire session.N(    (   t   selft   client(    (    sI   /usr/lib/python2.7/dist-packages/lazr/restfulclient/authorize/__init__.pyt   authorizeSession/   s    c         C   s   d S(   st   Set up credentials for a single request.

        This probably involves setting the Authentication header.
        N(    (   R   t   absolute_urit   methodt   bodyt   headers(    (    sI   /usr/lib/python2.7/dist-packages/lazr/restfulclient/authorize/__init__.pyt   authorizeRequest3   s    c         C   s   i  S(   sG  Any 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   (    (    sI   /usr/lib/python2.7/dist-packages/lazr/restfulclient/authorize/__init__.pyt   user_agent_params:   s    	(   t   __name__t
   __module__t   __doc__R   R	   t   propertyR
   (    (    (    sI   /usr/lib/python2.7/dist-packages/lazr/restfulclient/authorize/__init__.pyR   "   s   		c           B   s    e  Z d  Z d   Z d   Z RS(   s=   Handles authentication for services that use HTTP Basic Auth.c         C   s   | |  _  | |  _ d S(   sĴ   Constructor.

        :param username: User to send as authorization for all requests.
        :param password: Password to send as authorization for all requests.
        N(   t   usernamet   password(   R   R   R   (    (    sI   /usr/lib/python2.7/dist-packages/lazr/restfulclient/authorize/__init__.pyt   __init__I   s    	c         C   s   | j  |  j |  j  d  S(   N(   t   add_credentialsR   R   (   R   R   (    (    sI   /usr/lib/python2.7/dist-packages/lazr/restfulclient/authorize/__init__.pyR   R   s    (   R   R   R   R   R   (    (    (    sI   /usr/lib/python2.7/dist-packages/lazr/restfulclient/authorize/__init__.pyR    F   s   		N(    (   R   t   typet   __metaclass__t   __all__R   R    (    (    (    sI   /usr/lib/python2.7/dist-packages/lazr/restfulclient/authorize/__init__.pyt   <module>   s
   	$