Package: ags_client
Accessing GaaP Services ClientPython package providing a WSGI middleware for accessing GaaP services.Installationpip3installags_clientUsageRegistrationYou will need aclient IDandclient secretfrom the GaaP Identity Broker.
You can’t get these yet, but soon will by emailing us with a brief summary of:who you arewhat project you’re going to be using it onQuick StartFlaskFor example: given your Flask app is defined inwebservice.pyin a variable
namedapp, create a file calledwsgi.py:importagsfromwebserviceimportappapp.wsgi_app=ags.Client(app.wsgi_app)Then start your app with a WSGI server such as Gunicorn or uWSGI. Eg:gunicornwsgi:appConfigurationThe middleware looks for certain environment variables for settings. The
following variables areREQUIRED:AGS_CLIENT_ISSUERThe URL of the OIDC identity brokerAGS_CLIENT_IDThe client ID that you have been issuedAGS_CLIENT_SECRETThe client secret that you have been issuedAGS_CLIENT_AUTHENTICATED_PATHSComma separated list of paths in your web application that require
authentication. May include regular expressions.AGS_CLIENT_SIGN_OUT_PATHPath to sign out view in your application - default:sign-outThe following variables areOPTIONAL:AGS_CLIENT_DEBUGIf set toTrue, errors will be handled by the Werkzeug debugger. DO NOT
USE IN PRODUCTION!AGS_CLIENT_LOG_PATHLog to the specified file, in addition to consoleAGS_CLIENT_SESSION_COOKIEThe name of the cookie used to store the session ID - default:ags_client_sessionAGS_CLIENT_SESSION_SECRETThe secret key use to encrypt the session cookie - default: generates a new
secret on start-upNoteOverride this value when deploying across multiple hosts, otherwise
sessions may become invalid across requestsThe following variables can be used to override defaults, but usually should
not be used:AGS_CLIENT_CALLBACK_PATHOverrides default OIDC callback pathAGS_CLIENT_FEATURE_FLAG_COOKIEThe name of the cookie used to store the feature flag status - default:ags_client_activeAGS_CLIENT_FEATURE_FLAG_DEFAULTThe default state of the feature flag if the cookie is not set - default:TrueAGS_CLIENT_VERIFY_SSLIfFalse, verification of the broker’s SSL certificate is skippedUsageWhen activated, the middleware will intercept requests to the paths specified in
theAGS_CLIENT_AUTHENTICATED_PATHSenvironment variable and perform OpenID
Connect authentication before passing the user authentication details on to the
wrapped application.It will also intercept requests to theAGS_CLIENT_SIGN_OUT_PATHand end the
session on the identity broker before passing through to the wrapped
application.ActivationThe middleware is activated by default, unless theAGS_CLIENT_FEATURE_FLAG_DEFAULTenvironment variable is set toFalse.The middleware is activated or deactivated via a feature flag cookie, which can
be toggled by browsing to/toggle-feature/{FLAG}, where{FLAG}is the
value of theAGS_CLIENT_FEATURE_FLAG_COOKIEenvironment variable or the
default valueags_client_active.SupportThis source code is provided as-is, with no incident response or support levels.
Please log all questions, issues, and feature requests in the Github issue
tracker for this repo, and we’ll take a look as soon as we can. If you’re
reporting a bug, then it really helps if you can provide the smallest possible
bit of code that reproduces the issue. A failing test is even better!ContributingCheck out the latest master to make sure the feature hasn’t been implemented
or the bug hasn’t been fixedCheck the issue tracker to make sure someone hasn’t already requested
and/or contributed the featureFork the projectStart a feature/bugfix branchCommit and push until you are happy with your contributionMake sure your changes are covered by unit tests, so that we don’t break it
unintentionally in the future.Please don’t mess with setup.py, version or history.CopyrightCopyright © 2016 HM Government (Government Digital Service). See
LICENSE for further details.