authentic2 mon.service-public.fr插件
authentic2-auth-msp的Python项目详细描述
authentic2验证msp
用于对mon.service-public.fr法语进行身份验证的authentic2插件 公民门户。
安装
使用pip install authentic2-auth-msp
安装将A2_MSP_ENABLED = True添加到local_settings.py文件中
定义所需的参数:
MSP_CLIENT_ID = 'id assigned by DIMAP' MSP_CLIENT_SECRET = 'secret assigned by DIMAP' MSP_CLIENT_CERTIFICATE = ('/my-path/my-certificate.crt', '/my-path/my-certificate.key') MSP_VERIFY_CERTIFICATE = False
测试
在mon.service-public.fr的测试平台上重新测试时,必须更改 local_settings.py文件中的默认终结点url:: 必须通过添加以下内容将应用程序视图插入到urls.py文件中 内容:
MSP_AUTHORIZE_URL = 'https://mon.service-public.fr/apis/app/oauth/authorize' MSP_TOKEN_URL = 'https://mon.service-public.fr/apis/app/oauth/token' MSP_API_URL = 'https://mon.service-public.fr/apis/'
MSP网关
如果要使用OAuth2代理共享对MSP API的访问,则必须 用户共享缓存后端:通过memcached、redis或orm。为了 例如,如果安装了memcached,只需将以下片段添加到 您的设置:
CACHES = { 'default': { 'BACKEND': 'django.core.cache.backends.memcached.MemcachedCache', 'LOCATION': '127.0.0.1:11211', } }
如果您想要msp插件的特定缓存后端,请使用msp名称 而不是default。 msp应用程序还提供了一个到msp的oauth2网关。将其配置为 只需要提供一个客户机ID列表,客户机密码对 设置,如:
MSP_CLIENT_CREDENTIALS = (('client_id1', 'client_secret1'),)
提供以下网址:
- /msp/authorize:类似于msp的授权url
- /msp/access_token:类似于msp的access_token url
- /msp/documents/:类似于msp的文档列表rest api端点
- /msp/documents/<;id>;/:类似于msp的文档检索rest api端点