我对Django很陌生,但现在开始了。
我想在我的web应用程序中集成第三方验证服务,特别是BankID。
BankID是一种公民身份识别解决方案,允许公司、银行和政府机构在瑞典通过互联网与个人认证和签订协议。
BankID应用作登录验证(BankID & Mobile ),参见示例网站:https://e-tjanster.1177.se/mvk/login/login.xhtml
我读过他们的开发者指南:https://www.bankid.com/assets/bankid/rp/bankid-relying-party-guidelines-v3.4.pdf
但我想通过Django做这件事。Django有一个rest框架工作,我一直在尝试使用,但没有成功:https://www.django-rest-framework.org/
用Python应用bankID的示例代码(我想在Django中应用以下代码):https://github.com/fiso/smooth-bankid/blob/master/README.md https://github.com/fiso/smooth-bankid/tree/master/examples/python
我的webapp:https://defreitasbolaget.herokuapp.com
My Requirement.txt file is:
boto3==1.9.96
botocore==1.12.96
certifi==2018.10.15
cffi==1.14.1
chardet==3.0.4
cryptography==3.0
dj-database-url==0.5.0
Django==2.1
django-crispy-forms==1.7.2
django-heroku==0.3.1
django-storages==1.7.1
docutils==0.14
gunicorn==19.9.0
idna==2.7
jmespath==0.9.3
Pillow==5.2.0
psycopg2==2.7.7
pycparser==2.20
pyOpenSSL==19.1.0
python-dateutil==2.8.0
pytz==2018.5
requests==2.19.1
s3transfer==0.2.0
six==1.12.0
urllib3==1.23
whitenoise==4.1.2最后:我想将BankID (瑞典版本)集成到我的Django Python应用程序中。做这件事最好的方法是什么?任何帮助都是非常感谢的。
发布于 2020-08-13 08:29:56
你需要:
通过settings.py中的
BankID并覆盖默认的BankID请参阅https://docs.djangoproject.com/en/2.2/topics/auth/customizing/#substituting-a-custom-user-model
并仔细看看AbstractUser in https://github.com/django/django/blob/master/django/contrib/auth/models.py
通过settings.py中的
请参阅https://docs.djangoproject.com/en/3.1/topics/auth/customizing/
还可以更仔细地查看ModelBackend in https://github.com/django/django/blob/master/django/contrib/auth/backends.py
但在我看来,最好的方法是将BankID身份验证作为第三个Django扩展/包来实现,并继续独立地更新它。
更新
请参阅此项目https://pypi.org/project/pybankid/
PyBankID是作为依赖方提供BankID服务的客户端,即向最终用户提供身份验证和签名功能。此包提供了一个简化的接口,用于启动身份验证和签署订单,然后从BankID服务器收集结果。
而这个项目https://pypi.org/project/Flask-PyBankID/
用于在您的站点上使用PyBankID的烧瓶扩展。
把这个想法传递给django。
https://stackoverflow.com/questions/63389952
复制相似问题