如何使用具有Django身份验证的惠而浦散列?

[英]How can I use the Whirlpool hash with Django authentication?


We have a system written in PHP where account passwords are stored as the first 128 chars of a whirlpool hash of the password.

我们有一个用PHP编写的系统,其中帐户密码存储为密码的惠而浦散列的前128个字符。

I'd like to transition to handling the logins with Django without changing the database or asking users to change their passwords. Also, I'd prefer to stick with whirlpool vs. the less secure hashes Django has built in. I found a python (C) implementation of Whirlpool which seems to work fine.

我希望过渡到使用Django处理登录,而无需更改数据库或要求用户更改密码。此外,我更喜欢使用whirlpool和Django内置的不太安全的散列。我发现了一个python (C)实现的Whirlpool,它似乎可以很好地工作。

How can I change the Django password checking function to use Whirlpool rather than SHA1/MD5?

如何更改Django密码检查函数以使用Whirlpool而不是SHA1/MD5?

1 个解决方案

#1


2  

Basically you want to write your own authentication back-end. Fortunately, this can be done very easily.

基本上,您希望编写自己的身份验证后端。幸运的是,这很容易做到。

It's as easy as:

这是一样容易:

class MyBackend:
    def authenticate(self, username=None, password=None):
        # Check the username/password and return a User.

Then all you need to do is specify the back-end class by setting AUTHENTICATION_BACKENDS to be ('django.contrib.auth.backends.YourCustomBackend',).

然后您需要做的就是通过设置AUTHENTICATION_BACKENDS来指定后端类(' django.致歉. authb .back . yourcustom后端')。

See: http://docs.djangoproject.com/en/dev/topics/auth/#specifying-authentication-backends

见:http://docs.djangoproject.com/en/dev/topics/auth/ specifying-authentication-backends


注意!

本站翻译的文章,版权归属于本站,未经许可禁止转摘,转摘请注明本文地址:https://www.itdaan.com/blog/2010/02/22/7200d5fb88e41e6d2cf2c9c2edc1593e.html



我可以使用Django的HTTP基本身份验证吗? - Can I use HTTP Basic Authentication with Django? 如何在CakePHP中使用cookie进行身份验证? - How can I use cookies for authentication in CakePHP? 我可以使用Django的身份验证系统的自定义模型吗? - Can I use a custom model with Django's authentication system? Rails和Omniauth—应该从身份验证散列中保存多少数据? - Rails and Omniauth - How much data from the authentication hash should I be saving? 如何让多个应用程序使用相同的身份验证系统? - How can I have several applications use the same authentication system? 如何使Google端点API使用Firebase身份验证? - How can I make google endpoints API to use Firebase authentication? 我可以在Active Directory中使用基于令牌的身份验证吗? - Can I use token based authentication with active directory? 如何为Django视图提供基本的HTTP身份验证? - How can I have Basic HTTP Authentication for a Django view? 如何使用asp.net表单身份验证来验证Google / OpenSocial小工具 - How can I use asp.net forms authentication to authenticate a Google/OpenSocial Gadget 如何通过OAuth身份验证传递参数,以便我的回调或控制器可以使用? - How can I pass parameters through an OAuth authentication so that my callback or controller can use?
 
粤ICP备14056181号  © 2014-2020 ITdaan.com