微软adfs和azuread的django认证后端

cedar-adfs-forked的Python项目详细描述


django的adfs身份验证

文档状态https://img.shields.io/pypi/v/django-auth-adfs.svghttps://img.shields.io/pypi/pyversions/django-auth-adfs.svg /a> https://img.shields.io/pypi/djversions/django-auth-adfs.svghttps://travis-ci.org/jobec/django-auth-adfs.svg?branch=masterhttps://codecov.io/github/jobec/django-auth-adfs/coverage.svg?branch=master

Microsoft ADFS和Azure AD的Django身份验证后端

  • 免费软件:BSD许可证
  • 主页:https://github.com/jobec/django-auth-adfs" rel="nofollow">https://github.com/jobec/django auth-adfs
  • 文档:http://django-auth-adfs.readthedocs.io/" rel="nofollow">http://django-auth-adfs.readthedocs.io/

功能

  • 将django与Windows 2012 R2、2016或云中的azure ad上的活动目录集成。
  • 在Intranet环境中为Django项目提供无缝单点登录(SSO)。
  • 根据从ADF接收到的信息,自动创建用户并将其添加到Django组。
  • django rest framework(drf)集成:使用adfs访问令牌根据api进行身份验证。

安装

python包:

pip install django-auth-adfs

在项目的 设置中。py 添加这些设置。

AUTHENTICATION_BACKENDS=(...'django_auth_adfs.backend.AdfsAuthCodeBackend',...)INSTALLED_APPS=(...# Needed for the ADFS redirect URI to function'django_auth_adfs',...# checkout the documentation for more settingsAUTH_ADFS={"SERVER":"adfs.yourcompany.com","CLIENT_ID":"your-configured-client-id","RELYING_PARTY_ID":"your-adfs-RPT-name",# Make sure to read the documentation about the AUDIENCE setting# when you configured the identifier as a URL!"AUDIENCE":"microsoft:identityserver:your-RelyingPartyTrust-identifier","CA_BUNDLE":"/path/to/ca-bundle.pem","CLAIM_MAPPING":{"first_name":"given_name","last_name":"family_name","email":"email"},}# Configure django to redirect users to the right URL for loginLOGIN_URL="django_auth_adfs:login"LOGIN_REDIRECT_URL="/"######################### OPTIONAL SETTINGS########################MIDDLEWARE=(...# With this you can force a user to login without using# the LoginRequiredMixin on every view class## You can specify URLs for which login is not enforced by# specifying them in the LOGIN_EXEMPT_URLS setting.'django_auth_adfs.middleware.LoginRequiredMiddleware',)

在项目的 url.py 中添加以下路径:

urlpatterns=[...path('oauth2/',include('django_auth_adfs.urls')),]

这将把这些路径添加到django:

  • /oauth2/login 将用户重定向到其中,以使用adfs启动登录。
  • /oauth2/login_no_sso 将用户重定向到其中,以使用adfs启动登录,但强制显示登录屏幕。
  • /oauth2/callback 其中adfs在登录后重定向回。因此,请确保将adfs上的重定向uri设置为此。
  • /oauth2/logout 从django和adfs注销用户。

您可以在django模板中这样使用它们:

<ahref="{% url 'django_auth_adfs:logout' %}">Logout</a><ahref="{% url 'django_auth_adfs:login' %}">Login</a><ahref="{% url 'django_auth_adfs:login-no-sso' %}">Login (no SSO)</a>

贡献

对法典的贡献更多那欢迎。 有关更多详细信息,请查看 contribution.rst 文件。

欢迎加入QQ群-->: 979659372 Python中文网_新手群

推荐PyPI第三方库


热门话题
java本机方法的源代码可用吗?   java如何使父方法抛出异常?   java Android以编程方式设置不同屏幕大小/密度的布局   java如何使用一个变量来管理所有客户端请求   java输入一个txt文件,每行有一组数字   json java从jsonobject获取jsonarray错误   java将一个(WAV)写入一个文件只会说一个单词(最后一个单词)   java Telnet忽略原始字节   proguard java。运行桌面应用程序时出现lang.VerifyError   java用左键移动JLabel?   java如何在jText区域验证选项卡?   文件服务器客户端Javasocket编程中的字符串搜索   java省略了JSTL中的最后一个逗号<c:out>   java如何找到if或else代码已执行的次数?   java JavaScript WebSocket send()方法未执行   浮点数声明上的java标识符预期错误   java这是指二进制搜索算法吗?   编译mod at:reobfJar java时的minecraft问题。util。拉链ZipException:重复条目   java检测特定的震动运动(如图所示:D)