Skip to main content

使用 Microsoft 身份验证库 (MSAL) 登录 CKAN

项目描述

ckanext-msal

此扩展允许您使用 Microsoft 身份(Azure AD、Microsoft 帐户和 Azure AD B2C 帐户)登录用户。它使用Microsoft MSAL库。

它适用于 Microsoft 365 帐户。但在未来,情况可能会发生变化。

要求

与核心 CKAN 版本的兼容性:

CKAN版本 兼容的?
2.6 及更早版本 未测试
2.7 未测试
2.8 未测试
2.9 是的

安装

要安装 ckanext-msal:

  1. 激活您的 CKAN 虚拟环境,例如:

    . /usr/lib/ckan/default/bin/激活

  2. 克隆源代码并将其安装在 virtualenv 上

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

  3. 添加msalckan.plugins您的 CKAN 配置文件中的设置(默认情况下,配置文件位于 /etc/ckan/default/ckan.ini)。

  4. 重启 CKAN。例如,如果您在 Ubuntu 上使用 Apache 部署了 CKAN:

    sudo 服务 apache2 重新加载

配置设置

# 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

开发者安装

要安装 ckanext-msal 进行开发,请激活您的 CKAN virtualenv 并执行以下操作:

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

测试

如果您更改了某些内容 - 请务必在合并更改之前运行测试。要运行测试,请执行以下操作:

pytest --ckan-ini=test.ini

执照

AGPL

项目详情


下载文件

下载适用于您平台的文件。如果您不确定要选择哪个,请了解有关安装包的更多信息。

源分布

ckanext-msal-0.4.3.tar.gz (25.1 kB 查看哈希

已上传 source

内置分布

ckanext_msal-0.4.3-py3-none-any.whl (26.1 kB 查看哈希

已上传 py3