This Flask decorator can be used to check for a valid authenticated OpenAM session when serving Flask apps. Adjust the URLs and other strings accordingly, you can also append your own callback URL to the login URL.
Requires Requests for Python with various bits of SSL encouragement, so the requirements file from a pip freeze is also included.
More info on OpenAM here: https://www.forgerock.com/products/access-management/