Skip to content

Commit

Permalink
2.0 documentation update
Browse files Browse the repository at this point in the history
  • Loading branch information
miguelgrinberg committed Sep 26, 2013
1 parent 5168a5f commit e668f59
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 40 deletions.
35 changes: 2 additions & 33 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ Basic authentication example
@app.route('/')
@auth.login_required
def index():
return "Hello, %s!" % auth.username
return "Hello, %s!" % auth.username()
if __name__ == '__main__':
app.run()
Expand Down Expand Up @@ -55,7 +55,7 @@ Digest authentication example
@app.route('/')
@auth.login_required
def index():
return "Hello, %s!" % auth.username
return "Hello, %s!" % auth.username()
if __name__ == '__main__':
app.run()
Expand All @@ -66,34 +66,3 @@ Resources
- [Documentation](http://pythonhosted.org/Flask-HTTPAuth)
- [pypi](https://pypi.python.org/pypi/Flask-HTTPAuth)

License
-------

(the BSD license)

Copyright (c) 2013, Miguel Grinberg
All rights reserved.

Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:

1. Redistributions of source code must retain the above copyright notice, this
list of conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the above copyright notice,
this list of conditions and the following disclaimer in the documentation
and/or other materials provided with the distribution.

THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

The views and conclusions contained in the software and documentation are those
of the authors and should not be interpreted as representing official policies,
either expressed or implied, of the Flask-HTTPAuth Project.
14 changes: 7 additions & 7 deletions docs/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ The following example application uses HTTP Basic authentication to protect rout
@app.route('/')
@auth.login_required
def index():
return "Hello, %s!" % auth.username
return "Hello, %s!" % auth.username()
if __name__ == '__main__':
app.run()
Expand Down Expand Up @@ -74,7 +74,7 @@ The following example is similar to the previous one, but HTTP Digest authentica
@app.route('/')
@auth.login_required
def index():
return "Hello, %s!" % auth.username
return "Hello, %s!" % auth.username()
if __name__ == '__main__':
app.run()
Expand Down Expand Up @@ -123,18 +123,18 @@ API Documentation
def private_page():
return "Only for authorized people!"

.. attribute:: username
.. method:: username()

A view function that is protected with this class can access the logged username through this attribute. Example::
A view function that is protected with this class can access the logged username through this method. Example::

@app.route('/')
@auth.login_required
def index():
return "Hello, %s!" % auth.username
return "Hello, %s!" % auth.username()

.. class:: flask.ext.httpauth.HTTPDigestAuth

This class that handles HTTP Digest authentication for Flask routes. The ``SECRET_KEY`` configuration must be set in the Flask application to enable the session to work. Flask by default stores user sessions in the client as secure cookies, so the client must be able to handle cookies. To support clients that are not web browsers or that cannot handle cookies a http://flask.pocoo.org/docs/api/#flask.Flask.session_interface[session interface] that writes sessions in the server must be used.
This class that handles HTTP Digest authentication for Flask routes. The ``SECRET_KEY`` configuration must be set in the Flask application to enable the session to work. Flask by default stores user sessions in the client as secure cookies, so the client must be able to handle cookies. To support clients that are not web browsers or that cannot handle cookies a `session interface <http://flask.pocoo.org/docs/api/#flask.Flask.session_interface>`_ that writes sessions in the server must be used.

.. method:: get_password(password_callback)

Expand All @@ -148,7 +148,7 @@ API Documentation

*Required*. See basic authentication for documentation and examples.

.. attribute:: username
.. method:: username()

See basic authentication for documentation and examples.

0 comments on commit e668f59

Please sign in to comment.