Back to index

moin  1.9.0~rc2
Public Member Functions | Public Attributes | Static Public Attributes | Properties | Private Member Functions | Static Private Attributes
MoinMoin.support.werkzeug.datastructures.WWWAuthenticate Class Reference
Inheritance diagram for MoinMoin.support.werkzeug.datastructures.WWWAuthenticate:
Inheritance graph
[legend]
Collaboration diagram for MoinMoin.support.werkzeug.datastructures.WWWAuthenticate:
Collaboration graph
[legend]

List of all members.

Public Member Functions

def __init__
def set_basic
def set_digest
def to_header
def __str__
def __repr__
def auth_property
def calls_update

Public Attributes

 on_update

Static Public Attributes

tuple type
tuple realm
tuple domain
tuple nonce
tuple opaque
tuple algorithm
tuple qop
tuple auth_property = staticmethod(auth_property)
tuple clear = calls_update('clear')
tuple pop = calls_update('pop')
tuple popitem = calls_update('popitem')
tuple setdefault = calls_update('setdefault')
tuple update = calls_update('update')

Properties

 stale

Private Member Functions

def _set_property
def _get_stale
def _set_stale

Static Private Attributes

tuple _require_quoting = frozenset(['domain', 'nonce', 'opaque', 'realm'])

Detailed Description

Provides simple access to `WWW-Authenticate` headers.

Definition at line 1790 of file datastructures.py.


Constructor & Destructor Documentation

def MoinMoin.support.werkzeug.datastructures.WWWAuthenticate.__init__ (   self,
  auth_type = None,
  values = None,
  on_update = None 
)

Definition at line 1796 of file datastructures.py.

01796 
01797     def __init__(self, auth_type=None, values=None, on_update=None):
01798         dict.__init__(self, values or ())
01799         if auth_type:
01800             self['__auth_type__'] = auth_type
01801         self.on_update = on_update


Member Function Documentation

Definition at line 1842 of file datastructures.py.

01842 
01843     def __repr__(self):
01844         return '<%s %r>' % (
01845             self.__class__.__name__,
01846             self.to_header()
01847         )

Here is the call graph for this function:

Definition at line 1839 of file datastructures.py.

01839 
01840     def __str__(self):
01841         return self.to_header()

Here is the call graph for this function:

Definition at line 1904 of file datastructures.py.

01904 
01905     def _get_stale(self):
01906         val = self.get('stale')
01907         if val is not None:
            return val.lower() == 'true'

Here is the call graph for this function:

Definition at line 1865 of file datastructures.py.

01865 
01866     def _set_property(name, doc=None):
01867         def fget(self):
01868             def on_update(header_set):
01869                 if not header_set and name in self:
01870                     del self[name]
01871                 elif header_set:
01872                     self[name] = header_set.to_header()
01873             return parse_set_header(self.get(name), on_update)
01874         return property(fget, doc=doc)

Here is the call graph for this function:

Definition at line 1908 of file datastructures.py.

01908 
01909     def _set_stale(self, value):
01910         if value is None:
01911             self.pop('stale', None)
01912         else:
            self['stale'] = value and 'TRUE' or 'FALSE'
A static helper function for subclasses to add extra authentication
system properites onto a class::

    class FooAuthenticate(WWWAuthenticate):
special_realm = auth_property('special_realm')

For more information have a look at the sourcecode to see how the
regular properties (:attr:`realm` etc. are implemented).

Definition at line 1848 of file datastructures.py.

01848 
01849     def auth_property(name, doc=None):
01850         """A static helper function for subclasses to add extra authentication
01851         system properites onto a class::
01852 
01853             class FooAuthenticate(WWWAuthenticate):
01854                 special_realm = auth_property('special_realm')
01855 
01856         For more information have a look at the sourcecode to see how the
01857         regular properties (:attr:`realm` etc. are implemented).
01858         """
01859         def _set_value(self, value):
01860             if value is None:
01861                 self.pop(name, None)
01862             else:
01863                 self[name] = str(value)
01864         return property(lambda x: x.get(name), _set_value, doc=doc)

Definition at line 135 of file datastructures.py.

00135 
00136     def calls_update(name):
00137         def oncall(self, *args, **kw):
00138             rv = getattr(super(UpdateDictMixin, self), name)(*args, **kw)
00139             if self.on_update is not None:
00140                 self.on_update(self)
00141             return rv
00142         oncall.__name__ = name
00143         return oncall

def MoinMoin.support.werkzeug.datastructures.WWWAuthenticate.set_basic (   self,
  realm = 'authentication required' 
)
Clear the auth info and enable basic auth.

Definition at line 1802 of file datastructures.py.

01802 
01803     def set_basic(self, realm='authentication required'):
01804         """Clear the auth info and enable basic auth."""
01805         dict.clear(self)
01806         dict.update(self, {'__auth_type__': 'basic', 'realm': realm})
01807         if self.on_update:
01808             self.on_update(self)

Here is the call graph for this function:

def MoinMoin.support.werkzeug.datastructures.WWWAuthenticate.set_digest (   self,
  realm,
  nonce,
  qop = ('auth',,
  opaque = None,
  algorithm = None,
  stale = False 
)
Clear the auth info and enable digest auth.

Definition at line 1810 of file datastructures.py.

01810 
01811                    algorithm=None, stale=False):
01812         """Clear the auth info and enable digest auth."""
01813         d = {
01814             '__auth_type__':    'digest',
01815             'realm':            realm,
01816             'nonce':            nonce,
01817             'qop':              dump_header(qop)
01818         }
01819         if stale:
01820             d['stale'] = 'TRUE'
01821         if opaque is not None:
01822             d['opaque'] = opaque
01823         if algorithm is not None:
01824             d['algorithm'] = algorithm
01825         dict.clear(self)
01826         dict.update(self, d)
01827         if self.on_update:
01828             self.on_update(self)

Here is the call graph for this function:

Here is the caller graph for this function:

Convert the stored values into a WWW-Authenticate header.

Definition at line 1829 of file datastructures.py.

01829 
01830     def to_header(self):
01831         """Convert the stored values into a WWW-Authenticate header."""
01832         d = dict(self)
01833         auth_type = d.pop('__auth_type__', None) or 'basic'
01834         return '%s %s' % (auth_type.title(), ', '.join([
01835             '%s=%s' % (key, quote_header_value(value,
01836                        allow_token=key not in self._require_quoting))
01837             for key, value in d.iteritems()
01838         ]))

Here is the call graph for this function:

Here is the caller graph for this function:


Member Data Documentation

Definition at line 1794 of file datastructures.py.

Initial value:
auth_property('algorithm', doc='''
    A string indicating a pair of algorithms used to produce the digest
    and a checksum.  If this is not present it is assumed to be "MD5".
    If the algorithm is not understood, the challenge should be ignored
    (and a different one used, if there is more than one).''')

Definition at line 1896 of file datastructures.py.

Definition at line 1920 of file datastructures.py.

Definition at line 146 of file datastructures.py.

Initial value:
_set_property('domain', doc='''
    A list of URIs that define the protection space.  If a URI is an
    absolute path, it is relative to the canonical root URL of the
    server being accessed.''')

Definition at line 1883 of file datastructures.py.

Initial value:
auth_property('nonce', doc='''
    A server-specified data string which should be uniquely generated
    each time a 401 response is made.  It is recommended that this
    string be base64 or hexadecimal data.''')

Definition at line 1887 of file datastructures.py.

Reimplemented from MoinMoin.support.werkzeug.datastructures.UpdateDictMixin.

Definition at line 1800 of file datastructures.py.

Initial value:
auth_property('opaque', doc='''
    A string of data, specified by the server, which should be returned
    by the client unchanged in the Authorization header of subsequent
    requests with URIs in the same protection space.  It is recommended
    that this string be base64 or hexadecimal data.''')

Definition at line 1891 of file datastructures.py.

Definition at line 147 of file datastructures.py.

Definition at line 148 of file datastructures.py.

Initial value:
_set_property('qop', doc='''
    A set of quality-of-privacy modifies such as auth and auth-int.''')

Definition at line 1901 of file datastructures.py.

Initial value:
auth_property('realm', doc='''
    A string to be displayed to users so they know which username and
    password to use.  This string should contain at least the name of
    the host performing the authentication and might additionally
    indicate the collection of users who might have access.''')

Definition at line 1878 of file datastructures.py.

Definition at line 149 of file datastructures.py.

Initial value:
auth_property('__auth_type__', doc='''
    The type of the auth mechanism.  HTTP currently specifies
    `Basic` and `Digest`.''')

Definition at line 1875 of file datastructures.py.

Definition at line 150 of file datastructures.py.


Property Documentation

Initial value:
property(_get_stale, _set_stale, doc='''
    A flag, indicating that the previous request from the client was
    rejected because the nonce value was stale.''')

Definition at line 1913 of file datastructures.py.


The documentation for this class was generated from the following file: