Flask-SSO Documentation



Similar documents
Fuse MQ Enterprise Broker Administration Tutorials

Open Source Used In Cisco Instant Connect for ios Devices 4.9(1)

Third Party Software Used In PLEK500 (Utility for Win) v1.x.xx.xxx

ANZ TRANSACTIVE - MOBILE

Using SNMP with OnGuard

ANZ TRANSACTIVE MOBILE for ipad

FortiAuthenticator Agent for Microsoft IIS/OWA. Install Guide

django-helpdesk Documentation

openssl egg Bindings to the OpenSSL SSL/TLS library Extension for Chicken Scheme Version Thomas Chust

Introduction to OpenCV for Tegra. Shalini Gupta, Nvidia

idp Connect for OutSystems applications

[The BSD License] Copyright (c) Jaroslaw Kowalski

Adobe DNG Flat Field Plug-in (1.0) Software Notices and/or Additional Terms and Conditions

RSA Two Factor Authentication

Apache Software Foundation This product includes software developed by the Apache Software Foundation (

[MD5 Message Digests] derived from the RSA Data Security, Inc. MD5 Message Digest Algorithm

Digger Solutions. Intranet Open Source. Administrator s Guide

Activelock Customer Management 1.0

Release Notes for. CounterPath Bria iphone Edition CounterPath Bria ipad Edition Version 3.1.0

Security whitepaper. CloudAnywhere.

Software Package Document exchange (SPDX ) Tools. Version 1.2. Copyright The Linux Foundation. All other rights are expressly reserved.

Azure Multi-Factor Authentication. KEMP LoadMaster and Azure Multi- Factor Authentication. Technical Note

Portions derived from the RSA Data Security, Inc. MD5 Message-Digest Algorithm.

NetSuite End User License Agreement for Mobile Applications

Installing the Shrew Soft VPN Client

AccuTerm 7 Cloud Edition Connection Designer Help. Copyright Zumasys, Inc.

Log Insight Manager. Deployment Guide

Synology SSO Server. Development Guide

Enterprise Manager to Enterprise Console upgrade guide. Sophos Enterprise Manager version 4.7 Sophos Enterprise Console version 4.7.

HIGHSEC eid App Administration User Manual

System Center Virtual Machine Manager 2012 R2 Plug-In. Feature Description

S CHEDULER U SER M ANUAL

RSA Two Factor Authentication. Feature Description

Simba ODBC Driver with SQL Connector for Apache Cassandra

monoseq Documentation

DATA CENTER ACCESS POLICY AND GUIDELINES

INGESTING NWIS DATA USING VB.NET AND VISUAL STUDIO 2008

Smart Trading Apps: Market Entry App User Guide

Installation Guide Supplement

Boost Libraries Boost Software License Version 1.0

iphone/ipad Connection Manual

Integrated Citrix Servers

Architecting the Future of Big Data

Shrew Soft VPN Client Configuration for GTA Firewalls

Pulse Redundancy. User Guide

BMC Remedy Action Request System 7.0 Open Source License Agreements

iphone/ipad Connection Manual

RSA Data Security, Inc. Portions derived from the RSA Data Security, Inc. MD5 Message-Digest Algorithm.

Z O T PA D U S E R M A N U A L

flask-mail Documentation

Analog Documentation. Release Fabian Büchler

The Tor VM Project. Installing the Build Environment & Building Tor VM. Copyright The Tor Project, Inc. Authors: Martin Peck and Kyle Williams

Open Source Used In Meeting integration for Jabber 9.6

How To Use The Programs Of Ancient.Org

Release Notes for CounterPath X-Lite 4 for Windows Version 4.8

NetVault : SmartDisk v1.0.1 Release Notes Contents

Setup Reset Password Portal. CloudAnywhere. Auteur Emmanuel Dreux

GEO Sticky DNS. GEO Sticky DNS. Feature Description

Port Following. Port Following. Feature Description

1. Install the SOAP Toolkit 3.0 on your computer. This is freely available from msdn.microsoft.com.

Open Source Used In Cisco IronPort Encryption SDK

Virtual LoadMaster for Microsoft Hyper-V

PeopleSoft Red Paper Series. E-Learning. By: Gregory Sandford, Benjamin Harr, Leo Popov May 2006

Hyper V Windows 2012 and 8. Virtual LoadMaster for Microsoft Hyper V on Windows Server 2012, 2012 R2 and Windows 8. Installation Guide

AIXM Change Management Charter

Stone Edge Integration Guide

Open Source Used In Cisco D9865 Satellite Receiver Software Version 2.20

Job Status Guide 3.0

CA DLP. Release Notes for Advanced Encryption. r12.0

Network Working Group. Category: Standards Track March 2009

Open-Source Shopping Cart Solutions. Installation information for integrating a shopping cart with Checkout by Amazon using open-source solutions

Performance Monitoring using Pecos Release 0.1

Sophos Anti-Virus for Linux startup guide. Product version: 9

Guide to Using DoD PKI Certificates in Outlook 2000

PHP Integration Kit. Version User Guide

R&S TSMW Radio Network Analyzer Open Source Acknowledgment

Dell One Identity Cloud Access Manager How to Develop OpenID Connect Apps

OpenData CKAN VM for Microsoft Azure

PAW Web Filter Version 0.30 (release) This Software is Open Source. project.sourceforge.net

Open Source Used In LDSF 1.7.2

This script builds the FacebookSDK.framework that is distributed at

NetSuite End User License Agreement for Mobile Applications

DualShield SAML & SSO. Integration Guide. Copyright 2011 Deepnet Security Limited. Copyright 2011, Deepnet Security. All Rights Reserved.

IMX Mobile Proxy Administration

Open Source Used In Cisco TelePresence TC Console TC7.1

BES10 Self-Service. Version: User Guide

Adeptia Suite LDAP Integration Guide

Fritz Speed Documentation

2 How to Set the Firewall when Using OptoLyzer Suite?

SimbaEngine SDK 9.5. OLE DB Implementation Guide. Simba Technologies Inc.

Release Notes. BlackBerry Web Services. Version 12.1

Python DNS Failover Documentation

Other Component Agreement Readme for the BACnet Field Panel Web Server Solution Software

Source Code Management for Continuous Integration and Deployment. Version 1.0 DO NOT DISTRIBUTE

SPARROW Gateway. Developer Data Vault Payment Type API. Version 2.7 (6293)

Installation and Configuration Guide Simba Technologies Inc.

Dell Spotlight on Active Directory Server Health Wizard Configuration Guide

Using Filter as JEE LoadBalancer for Enterprise Application Integration(EAI)

Avaya VPN Client Software Release (build 022)

Remote Desktop Services

Transcription:

Flask-SSO Documentation Release 0.3.0 CERN July 30, 2015

Contents 1 Contents 3 1.1 Installation................................................ 3 1.2 Quickstart................................................ 4 1.3 Configuration............................................... 5 1.4 API.................................................... 5 1.5 Changelog................................................ 6 1.6 Contributing............................................... 7 1.7 License.................................................. 7 1.8 Authors.................................................. 8 Python Module Index 9 i

ii

Flask-SSO is a Flask extension permitting to set up Shibboleth Single-Sign-On authentication in Flask based web applications. Contents 1

2 Contents

CHAPTER 1 Contents Installation Requirements Quickstart A Minimal Example Configuration SSO_ATTRIBUTE_MAP SSO_LOGIN_URL SSO_LOGIN_ENDPOINT API Flask-SSO Changelog Contributing License Authors Contributors 1.1 Installation Flask-SSO is on PyPI so all you need is : $ pip install flask-sso The development version can be downloaded from its page at GitHub. $ git clone https://github.com/inveniosoftware/flask-sso.git $ cd flask-sso $ python setup.py develop $./run-tests.sh 1.1.1 Requirements Flask-SSO has the following dependencies: Flask blinker 3

six Flask-SSO requires Python version 2.6, 2.7 or 3.3+ 1.2 Quickstart This part of the documentation will show you how to get started in using Flask-SSO with Flask. 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/. 1.2.1 A Minimal Example A minimal Flask-SSO usage example looks like this. First, let s create the application and initialise the extension: from flask import Flask, session, redirect from flask_sso import SSO app = Flask("myapp") ext = SSO(app=app) Second, let s configure the attribute map for converting environment variables to a dictionary containing user information: #: 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: @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: @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"]) 4 Chapter 1. Contents

1.3 Configuration The details of the application settings that can be customized. 1.3.1 SSO_ATTRIBUTE_MAP A dictionary mapping HTTP headers to a tuple. The tuple contains whether the attribute is required and then the name of the attribute. Example: # CERN Single-Sign-On SSO_ATTRIBUTE_MAP = { "ADFS_LOGIN": (True, nickname), "ADFS_EMAIL": (True, email), } # General Shibboleth SSO_ATTRIBUTE_MAP = { "HTTP_SHIB_IDENTITY_PROVIDER": (True, "idp"), "HTTP_SHIB_SHARED_TOKEN": (True, "shared_token"), "HTTP_SHIB_CN": (True, "cn"), "HTTP_SHIB_MAIL": (True, "email"), "HTTP_SHIB_GIVENNAME": (False, "first_name"), "HTTP_SHIB_SN": (False, "last_name"), } 1.3.2 SSO_LOGIN_URL Url of login handler. Default: /login/sso. 1.3.3 SSO_LOGIN_ENDPOINT Name of login handler endpoint to be used in url_for function. Example: >>> from flask.ext.sso.config import * >>> url_for(sso_login_endpoint) /login/sso >>> SSO_LOGIN_URL /login/sso Default: sso_login. 1.4 API This documentation section is automatically generated from Flask-SSO s source code. 1.3. Configuration 5

1.4.1 Flask-SSO Implement Shibboleth Single-Sign-On authentication. Flask-SSO is initialized like this: Initialization of the extension: >>> from flask import Flask >>> from flask_sso import SSO >>> app = Flask('myapp') >>> ext = SSO(app=app) or alternatively using the factory pattern: >>> app = Flask('myapp') >>> ext = SSO() >>> ext.init_app(app) class flask_sso.sso(app=none) Flask extension implementation. init_app(app) Initialize a Flask application. login() Implement application login endpoint for SSO. login_handler(callback) Set the callback for the login method. It takes one argument with attributes map, and should return a Flask response. Parameters callback (function) The callback for login. parse_attributes() Parse arguments from environment variables. 1.5 Changelog Here you can see the full list of changes between each Flask-SSO release. Version 0.3.0 (released 2015-07-30) The Flask-SSO extension is now released under more permissive Revised BSD License. (#6) For testing execute run-tests.sh instead of sourcing it. (#4) New minimal application example. (#8) New Tox support for Python-3.4. (#4) Version 0.2.0 (released 2014-06-26) Allowing ; separator in HTTP data. Fix for dictionary key order in tests. Fix for Python 3.3 string comparison. New dependency: Blinker. Code coverage improved to 100%. 6 Chapter 1. Contents

New configuration option SSO_LOGIN_ENDPOINT. Version 0.1 Initial public release. 1.6 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. 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: $./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% 1.7 License Flask-SSO is free software; you can redistribute it and/or modify it under the terms of the Revised BSD License quoted below. Copyright (C) 2013, 2014 CERN. All rights reserved. Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. 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. Neither the name of the copyright holder nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission. 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 HOLDERS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, IN- CIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED 1.6. Contributing 7

TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSI- NESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CON- TRACT, 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 DAM- AGE. In applying this license, CERN does not waive the privileges and immunities granted to it by virtue of its status as an Intergovernmental Organization or submit itself to any jurisdiction. 1.8 Authors Flask-SSO is developed for use in Invenio digital library software. Contact us at info@invenio-software.org 1.8.1 Contributors Jiri Kuncar <jiri.kuncar@cern.ch> Iason Andriopoulos <iason.andriopoulos@cern.ch> ThiefMaster <adrian@planetcoding.net> Tibor Simko <tibor.simko@cern.ch> 8 Chapter 1. Contents

Python Module Index f flask_sso, 6 flask_sso.config, 5 9

10 Python Module Index

Index F flask_sso (module), 6 flask_sso.config (module), 5 I init_app() (flask_sso.sso method), 6 L login() (flask_sso.sso method), 6 login_handler() (flask_sso.sso method), 6 P parse_attributes() (flask_sso.sso method), 6 S SSO (class in flask_sso), 6 11