-
Notifications
You must be signed in to change notification settings - Fork 22
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Reviewed-by: Tibor Simko <tibor.simko@cern.ch> Signed-off-by: Jiri Kuncar <jiri.kuncar@cern.ch>
- Loading branch information
1 parent
74e1b97
commit 6262a89
Showing
18 changed files
with
230 additions
and
185 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
Contributing | ||
============ | ||
|
||
Bug reports, feature requests, and other contributions are welcome. | ||
If you find a demonstrable problem that is caused by the code of this | ||
library, please: | ||
|
||
1. Search for `already reported problems | ||
<https://github.com/inveniosoftware/flask-sso/issues>`_. | ||
2. Check if the issue has been fixed or is still reproducible on the | ||
latest `master` branch. | ||
3. Create an issue with **a test case**. | ||
|
||
If you create a feature branch, you can run the tests to ensure everything is | ||
operating correctly: | ||
|
||
.. code-block:: console | ||
$ ./run-tests.sh | ||
... | ||
Ran 8 tests in 0.246s | ||
OK | ||
Name Stmts Miss Cover Missing | ||
-------------------------------------------------- | ||
flask_sso/__init__ 47 0 100% | ||
flask_sso/config 4 0 100% | ||
flask_sso/version 2 0 100% | ||
-------------------------------------------------- | ||
TOTAL 53 0 100% |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,52 +1,162 @@ | ||
=========== | ||
Flask-SSO | ||
=========== | ||
.. currentmodule:: flask_sso | ||
|
||
Flask-SSO | ||
========= | ||
|
||
.. image:: https://travis-ci.org/inveniosoftware/flask-sso.png?branch=master | ||
:target: https://travis-ci.org/inveniosoftware/flask-sso | ||
.. image:: https://coveralls.io/repos/inveniosoftware/flask-sso/badge.png?branch=master | ||
:target: https://coveralls.io/r/inveniosoftware/flask-sso | ||
.. raw:: html | ||
|
||
<p style="height:22px; margin:0 0 0 2em; float:right"> | ||
<a href="https://travis-ci.org/inveniosoftware/flask-sso"> | ||
<img src="https://travis-ci.org/inveniosoftware/flask-sso.png?branch=master" | ||
alt="travis-ci badge"/> | ||
</a> | ||
<a href="https://coveralls.io/r/inveniosoftware/flask-sso"> | ||
<img src="https://coveralls.io/repos/inveniosoftware/flask-sso/badge.png?branch=master" | ||
alt="coveralls.io badge"/> | ||
</a> | ||
</p> | ||
|
||
|
||
Flask-SSO is a Flask extension permitting to set up Shibboleth | ||
Single-Sign-On authentication in Flask based web applications. | ||
|
||
User's Guide | ||
Contents | ||
-------- | ||
|
||
.. contents:: | ||
:local: | ||
:backlinks: none | ||
|
||
|
||
Installation | ||
============ | ||
|
||
Flask-SSO is on PyPI so all you need is : | ||
|
||
.. code-block:: console | ||
$ pip install flask-sso | ||
The development version can be downloaded from `its page at GitHub | ||
<http://github.com/inveniosoftware/flask-sso>`_. | ||
|
||
.. code-block:: console | ||
$ git clone https://github.com/inveniosoftware/flask-sso.git | ||
$ cd flask-sso | ||
$ python setup.py develop | ||
$ ./run-tests.sh | ||
Requirements | ||
^^^^^^^^^^^^ | ||
|
||
Flask-SSO has the following dependencies: | ||
|
||
* `Flask <https://pypi.python.org/pypi/Flask>`_ | ||
* `blinker <https://pypi.python.org/pypi/blinker>`_ | ||
* `six <https://pypi.python.org/pypi/six>`_ | ||
|
||
Flask-SSO requires Python version 2.6, 2.7 or 3.3+ | ||
|
||
|
||
Quickstart | ||
========== | ||
|
||
This part of the documentation will show you how to get started in using | ||
Flask-SSO with Flask. | ||
|
||
.. toctree:: | ||
:maxdepth: 2 | ||
This guide assumes you have successfully installed Flask-SSO and a working | ||
understanding of Flask. If not, follow the installation steps and read about | ||
Flask at http://flask.pocoo.org/docs/. | ||
|
||
|
||
A Minimal Example | ||
^^^^^^^^^^^^^^^^^ | ||
|
||
A minimal Flask-SSO usage example looks like this. | ||
|
||
First, let's create the application and initialise the extension: | ||
|
||
installation | ||
quickstart | ||
userguide | ||
.. code-block:: python | ||
from flask import Flask, session, redirect | ||
from flask_sso import SSO | ||
app = Flask("myapp") | ||
ext = SSO(app=app) | ||
API Reference | ||
Second, let's configure the attribute map for converting environment | ||
variables to a dictionary containing user information: | ||
|
||
.. code-block:: python | ||
#: Default attribute map | ||
SSO_ATTRIBUTE_MAP = { | ||
'ADFS_AUTHLEVEL': (False, 'authlevel'), | ||
'ADFS_GROUP': (True, 'group'), | ||
'ADFS_LOGIN': (True, 'nickname'), | ||
'ADFS_ROLE': (False, 'role'), | ||
'ADFS_EMAIL': (True, 'email'), | ||
'ADFS_IDENTITYCLASS': (False, 'external'), | ||
'HTTP_SHIB_AUTHENTICATION_METHOD': (False, 'authmethod'), | ||
} | ||
app.config.setdefault('SSO_ATTRIBUTE_MAP', SSO_ATTRIBUTE_MAP) | ||
Third, let's set up a login handler function that reads user information | ||
and stores it for later usage: | ||
|
||
.. code-block:: python | ||
@sso.login_handler | ||
def login_callback(user_info): | ||
"""Store information in session.""" | ||
session["user"] = user_info | ||
Fourth, we can now greet the user using his SSO login name: | ||
|
||
.. code-block:: python | ||
@app.route("/") | ||
def index(): | ||
"""Display user information or force login.""" | ||
if "user" in session: | ||
return "Welcome {name}".format(name=session["user"]["nickname"]) | ||
return redirect(app.config["SSO_LOGIN_URL"]) | ||
Configuration | ||
============= | ||
|
||
If you are looking for information on a specific function, class or | ||
method, this part of the documentation is for you. | ||
.. automodule:: flask_sso.config | ||
|
||
|
||
API | ||
=== | ||
|
||
This documentation section is automatically generated from Flask-SSO's | ||
source code. | ||
|
||
Flask-SSO | ||
^^^^^^^^^ | ||
|
||
.. automodule:: flask_sso | ||
|
||
.. autoclass:: SSO | ||
:members: | ||
|
||
.. toctree:: | ||
:maxdepth: 2 | ||
|
||
api | ||
.. include:: ../CHANGES | ||
|
||
.. include:: ../CONTRIBUTING.rst | ||
|
||
Additional Notes | ||
================ | ||
|
||
Notes on how to contribute, legal information and changelog are here for the interested. | ||
License | ||
======= | ||
|
||
.. toctree:: | ||
:maxdepth: 2 | ||
.. include:: ../LICENSE | ||
|
||
contributing | ||
changelog | ||
license | ||
.. include:: ../AUTHORS |
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.