From d50ea9b4658743d71d2ddbeb8989b6a9588912cd Mon Sep 17 00:00:00 2001 From: Kyle Mahan Date: Wed, 16 Dec 2015 18:00:27 +0000 Subject: [PATCH] move README.rst into index.rst for sphinx --- docs/README.rst | 61 ----------------------------------------- docs/index.rst | 73 +++++++++++++++++++++++++++++++++++++++---------- 2 files changed, 59 insertions(+), 75 deletions(-) delete mode 100644 docs/README.rst diff --git a/docs/README.rst b/docs/README.rst deleted file mode 100644 index a3c5a5a..0000000 --- a/docs/README.rst +++ /dev/null @@ -1,61 +0,0 @@ -Flask-Micropub -============== - -A Flask extension to support IndieAuth and Micropub clients. - -Authentication --------------- - -Authentication uses the -`IndieAuth `__ flow to confirm a -user controls a particular URL, without requesting any sort of -permissions or access token. Annotate an endpoint with -``@micropub.authenticated_handler`` and then call -``micropub.authenticate`` to initiate the login. - -Authorization -------------- - -Authorization uses the full -`Micropub `__ flow to authenticate a -user and then request an access token with which to make micropub -requests. Annotate an endpoint with ``@micropub.authorized_handler`` and -then call ``micropub.authorize`` to initiate the login. - -CSRF ----- - -MicropubClient provides a simple mechanism to deter Cross-Site Request -Forgery. Based on `this Flask -snippet `__, we generate a random -string, pass it to the indieauth service via the state parameter, and -then confirm we get the same random string back later. - -This helps prevent malicious sites from sending users to your indieauth -endpoint against their will. - -Example -------- - -.. code:: python - - from flask import Flask, request, url_for - from flask.ext.micropub import MicropubClient - - app = Flask(__name__) - micropub = MicropubClient(app) - - - @app.route('/login') - def login(): - return micropub.authorize( - me, scope=request.args.get('scope')) - - - @app.route('/micropub-callback') - @micropub.authorized_handler - def micropub_callback(resp): - print('success!', resp.me, resp.access_token, resp.next_url, resp.error) - -See example.py for a more thorough example. Protocol details at -https://indiewebcamp.com/IndieAuth and https://indiewebcamp.com/Micropub diff --git a/docs/index.rst b/docs/index.rst index bba5395..5985adb 100644 --- a/docs/index.rst +++ b/docs/index.rst @@ -1,22 +1,67 @@ -.. Flask-Micropub documentation master file, created by - sphinx-quickstart on Wed Dec 16 17:53:24 2015. - You can adapt this file completely to your liking, but it should at least - contain the root `toctree` directive. +Flask-Micropub +============== -Welcome to Flask-Micropub's documentation! -========================================== +A Flask extension to support IndieAuth and Micropub clients. -Contents: +Authentication +-------------- -.. toctree:: - :maxdepth: 2 +Authentication uses the +`IndieAuth `__ flow to confirm a +user controls a particular URL, without requesting any sort of +permissions or access token. Annotate an endpoint with +``@micropub.authenticated_handler`` and then call +``micropub.authenticate`` to initiate the login. + +Authorization +------------- + +Authorization uses the full +`Micropub `__ flow to authenticate a +user and then request an access token with which to make micropub +requests. Annotate an endpoint with ``@micropub.authorized_handler`` and +then call ``micropub.authorize`` to initiate the login. + +CSRF +---- + +MicropubClient provides a simple mechanism to deter Cross-Site Request +Forgery. Based on `this Flask +snippet `__, we generate a random +string, pass it to the indieauth service via the state parameter, and +then confirm we get the same random string back later. + +This helps prevent malicious sites from sending users to your indieauth +endpoint against their will. + +Example +------- + +.. code:: python + + from flask import Flask, request, url_for + from flask.ext.micropub import MicropubClient + + app = Flask(__name__) + micropub = MicropubClient(app) + @app.route('/login') + def login(): + return micropub.authorize( + me, scope=request.args.get('scope')) -Indices and tables -================== -* :ref:`genindex` -* :ref:`modindex` -* :ref:`search` + @app.route('/micropub-callback') + @micropub.authorized_handler + def micropub_callback(resp): + print('success!', resp.me, resp.access_token, resp.next_url, resp.error) +See example.py for a more thorough example. Protocol details at +https://indiewebcamp.com/IndieAuth and https://indiewebcamp.com/Micropub + +API +--- + +.. automodule:: mf2util + :members: