使用python social auth I';M希望访问管道中间的人使用的后端提供程序

使用python social auth I';M希望访问管道中间的人使用的后端提供程序,python,oauth,python-social-auth,Python,Oauth,Python Social Auth,我的管线在下面 PIPELINE = ( 'social.pipeline.social_auth.social_details', 'social.pipeline.social_auth.social_uid', 'social.pipeline.social_auth.auth_allowed', 'social.pipeline.social_auth.social_user', 'create_user_and_set_email_as_user

我的管线在下面

PIPELINE = (
    'social.pipeline.social_auth.social_details',
    'social.pipeline.social_auth.social_uid',
    'social.pipeline.social_auth.auth_allowed',
    'social.pipeline.social_auth.social_user',
    'create_user_and_set_email_as_username',
    'social.pipeline.social_auth.associate_by_email',
    'social.pipeline.social_auth.associate_user',
    'social.pipeline.social_auth.load_extra_data',
    'social.pipeline.user.user_details',
    )
create\u user\u和\u set\u email\u as\u username
是我为用户做一些额外事情而构建的功能。在这个功能中,我希望能够将不使用特定oauth客户端的用户踢出。(我们有一些公司客户希望强制其员工使用azure oauth2)

我不知道如何访问该函数中当前使用的后端。即用户刚刚点击的内容以及他们尝试使用的服务。尝试了pdb'ing并查看了策略的组成部分,但没有看到任何有用的内容

我是不是想在正确的地方做这件事


如何访问他们试图使用的后端。尝试了策略。获取后端()但列表可能不是当前列表。

我明白了我该做什么

假设
expected\u oauth\u provider
是您希望他们使用的。然后,在添加到管道中的任何函数中,您应该接收**KWARG,并可以访问它们在那里真正使用的内容

 if expected_oauth_provider != kwargs.get('backend').name:
     return HttpResponse("You cannot use your companies accounts that are not " + rule.force_oauth_provider, status=405)