Skip to main content

tsgauth

A collection of CERN SSO based authentication and authorisation tools used by the CMS TSG Group

modules

flaskoidc

This adds OpenIDC Connect based authorisation for flask servers. It currently has the single function "accept_token" which decorates any routes you wish to require authorisation for

The function expects the following variables to be added to the flask application

It will add the decoded claims of the token to flask.g.oidc_token_info if the token can be validiated. If require_token is true, it will only allow access to the endpoint if there is a validiated token, otherwise it will return a 401 and a little britain reference.

oidcauth

These are a collection of clients which request and manage a sso token for a given application. Each client is for a different authentication mechansism. We currrently have the following ways of authenticating

ClientAuth : pass in a client id and secret and request a token for a given audience. This is used by applications to access other applications. Basically any script where you dont easily have a user to login with.\

KerbAuth: uses kerberos to login in as user (or service account) and request a token for a given audience

AuthGetSSOTokenAuth: uses the auth-get-sso-token command line tool to request a token for a given audience. Basically wraps the cern authz cli tool in a libary. Note you must install this tool yourself, see cern authsvc tools for mode details.

DeviceAuth: used to log in as a user who uses 2FA or can not get a kerberos ticket for some reason. Will print a url that needs to be copied into the users browser who will then authenticate the request. By default it caches the token in a file in the users home directory (~/.sso_token) which is used for subsequent requests for the next 10 hrs.

The interface of the classes is:

  • token() : returns the access token for a given application, requesting/renewing it first if necessary
  • headers() : returns the headers necessar to pass the token to target api. eg requests.get(url,headers=auth.headers())

Release files for tsgauth 0.9.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for tsgauth 0.9.1
File Size Uploaded
tsgauth-0.9.1.tar.gz 12.5 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for tsgauth 0.9.1
File Interpreter ABI Platform
tsgauth-0.9.1-py3-none-any.whl Python 3 none any Details

Total release size: 23.0 kB

Release files / tsgauth-0.9.1.tar.gz

Download URL tsgauth-0.9.1.tar.gz
Size 12.5 kB
Tags Source
SHA-256 checksum
How to use checksums
0f51f92be9aeaa2cfa5f1cdd5f30b6f61cfc91f33a8236d286966c5012edc7b5
BLAKE2b-256 checksum
How to use checksums
8a8f5da72bb6b0ac5c1062ccb14de4f87a44762471f77f52adcdee025ebc726f
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.8.0 pkginfo/1.9.6 readme-renderer/34.0 requests/2.27.1 requests-toolbelt/1.0.0 urllib3/1.26.16 tqdm/4.64.1 importlib-metadata/4.8.3 keyring/23.4.1 rfc3986/1.5.0 colorama/0.4.5 CPython/3.6.8

Release files / tsgauth-0.9.1-py3-none-any.whl

Download URL tsgauth-0.9.1-py3-none-any.whl
Size 10.5 kB
Tags Python 3
SHA-256 checksum
How to use checksums
06e7618ef3d720d7779faf353caa7db9a64fe9b83015712f63a006365f7ade9a
BLAKE2b-256 checksum
How to use checksums
15bb1cbdcda98dcd79dce7295c209d273e273790b159200f4311ceec10f6c448
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.8.0 pkginfo/1.9.6 readme-renderer/34.0 requests/2.27.1 requests-toolbelt/1.0.0 urllib3/1.26.16 tqdm/4.64.1 importlib-metadata/4.8.3 keyring/23.4.1 rfc3986/1.5.0 colorama/0.4.5 CPython/3.6.8
Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page