Skip to main content

Login to CKAN using The Microsoft Authentication Library (MSAL)

Project description

ckanext-msal

This extension allows you to sign in users with Microsoft identities (Azure AD, Microsoft Accounts and Azure AD B2C accounts). It uses Microsoft MSAL library.

It works with Microsoft 365 accounts. But in future, the situation could change.

Requirements

Compatibility with core CKAN versions:

CKAN version Compatible?
2.10 and earlier no
2.11+ yes

Note, that this particular version of the extension is compatible with CKAN 2.11 and later. If you need to use it with CKAN 2.10 or earlier, please, use the previous version - 1.5.2.

Installation

To install ckanext-msal:

  1. Activate your CKAN virtual environment, for example:

    . /usr/lib/ckan/default/bin/activate

  2. Clone the source and install it on the virtualenv

    git clone https://github.com/DataShades/ckanext-msal.git cd ckanext-msal pip install -e . pip install -r requirements.txt

  3. Add msal to the ckan.plugins setting in your CKAN config file (by default the config file is located at /etc/ckan/default/ckan.ini).

  4. Restart CKAN. For example if you've deployed CKAN with Apache on Ubuntu:

    sudo service apache2 reload

Config settings

# The application client id. Mandatory option.
ckanext.msal.client_id = 000000-0000-0000-0000-00000000000

# The client secret. Mandatory option.
ckanext.msal.client_secret = 000000-0000-0000-0000-00000000000

# The tenant ID. If it's not provided, the common one for multi-tenant app will be used.
# In this case, the application is not guaranteed to work properly.
# (optional, default: 'common').
ckanext.msal.tenant_id = 000000-0000-0000-0000-00000000000

# The redirect path should be setted up in Azure AD web app config.
# It handles the response from Microsoft.
# (optional, default: "/get_msal_token").
ckanext.msal.redirect_path

# While the session lifespan could be manage only in Azure AD conditional policies panel,
# this option actually implies how often do we send a test request for the Microsoft Graph API
# to check if our Access token is still alive.
# (optional, default: 3600, in seconds).
ckanext.msal.session_lifetime = 3600

# The list of restricted email domains. User won't be able to login under
# an email with those domains (optional, default: None)
ckanext.msal.restrict.domain_list = gmail.com, onmicrosoft.com

# The list of allowed email domains. User won't be able to login under
# any other emails (optional, default: None)
ckanext.msal.restrict.allowed_domain_list = protonmail.com, orgname.onmicrosoft.com

# A message that will be shown to users with a restricted domain
# (optional, default: "Your email domain is restricted. Please, contact site admin.")
ckanext.msal.restrict.error_message

Developer installation

To install ckanext-msal for development, activate your CKAN virtualenv and do:

git clone https://github.com/DataShades/ckanext-msal.git
cd ckanext-msal
python setup.py develop
pip install -r dev-requirements.txt

Tests

If you changed something - be sure to run tests before merging your changes. To run tests, do:

pytest --ckan-ini=test.ini

License

AGPL

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

ckanext_msal-1.6.0.tar.gz (25.6 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

ckanext_msal-1.6.0-py3-none-any.whl (25.9 kB view details)

Uploaded Python 3

File details

Details for the file ckanext_msal-1.6.0.tar.gz.

File metadata

  • Download URL: ckanext_msal-1.6.0.tar.gz
  • Upload date:
  • Size: 25.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.11.4

File hashes

Hashes for ckanext_msal-1.6.0.tar.gz
Algorithm Hash digest
SHA256 f9f5517bfc27d56e9d636355680ee9aad220be40d36ed01cbcb78bad9832fa7d
MD5 95c19bbac382ae1329965814dc44e05b
BLAKE2b-256 a1849aba33d568ac9edfbaabcf8becc5e080ba56e40cda785bd18537323e317e

See more details on using hashes here.

File details

Details for the file ckanext_msal-1.6.0-py3-none-any.whl.

File metadata

  • Download URL: ckanext_msal-1.6.0-py3-none-any.whl
  • Upload date:
  • Size: 25.9 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.11.4

File hashes

Hashes for ckanext_msal-1.6.0-py3-none-any.whl
Algorithm Hash digest
SHA256 4c935b9e70ada46794b30fa41465893ad57233ec3801e200e58453898dca87b9
MD5 f94debd97c050385654fbb4ac0d6df77
BLAKE2b-256 33430d7ca7f054eb2dbad052329ea3f46bc81ec37a550758e19241d5ff8234e7

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page