django-authentication

Okta Authentication Django

断了今生、忘了曾经 提交于 2019-12-10 10:21:47
问题 I have a Django app that I am trying to add Okta authentication. I currently have created a custom backend that utilizes the Okta API to authenticate a user: class OKTABackend(ModelBackend): def __init__(self, *args, **kwargs): super().__init__(*args, **kwargs) def authenticate(self, username=None, password=None): headers = { 'Authorization': 'SSWS {}'.format(<my OKTA API token>), 'Accept': 'application/json', 'Content-type': 'application/json' } authentication_payload = { 'username':

How does default_token_generator store tokens?

折月煮酒 提交于 2019-12-10 09:32:54
问题 I recently built a Django-based authentication system using a tutorial. Within this System I created a token within a forms.py. This Token is then send (as a link) in an activation activation mail. from django.contrib.auth.tokens import default_token_generator token = default_token_generator.make_token(user) The view which receives the get request matches the token and the user-id supplied in this link and checks the token using: default_token_generator.check_token(user, token) This verifies

Django pbkdf2_sha256 JS implementation

前提是你 提交于 2019-12-10 02:20:53
问题 I have a database from django and I want to work with it from Node.js. I have a task: authenticate users. Known from database: algorithm pbkdf2_sha256, salt, 10000 iterations and base64-encoded hash. What steps I must to do in JS to encode some password to given base64-hash? UPD: found the solution in here: python (django) hashlib vs Nodejs crypto but Django-generated hash and JS-generated hash not match... Django generate next: pbkdf2_sha256$10000$NmzpPCQiTe2R$U8ipSsOy3Xz7FwWDHdH

How to use TokenAuthentication for API in django-rest-framework

跟風遠走 提交于 2019-12-08 22:41:39
问题 I have a django project, using django-rest-framework to create api. Want to use token base authentication system so api call for (put, post, delete) will only execute for authorized user. I installed 'rest_framework.authtoken' and created token for each users. So, now from django.contrib.auth.backends authenticate, it returns user, with auth_token as attribute. (when loged in successfully). Now my question is how can I send the token with post request to my api and at api side how can I

How do I access auth User's User.objects.create_user(…) in a south migration?

匆匆过客 提交于 2019-12-08 14:56:11
问题 Instead of using django's auth module I've used my own and already regret it a lot. In an effort to rectify the situation, I'm trying to migrate the data from my User model to django.auth.models.User. I've created a data migration as follows: def forwards(self, orm): """Migrate user information from mooi User model to auth User model.""" OldUser = orm['mooi.User'] User = orm['auth.User'] Profile = orm['mooi.Profile'] oldUsers = OldUser.objects.all() for oldUser in oldUsers: newUser = User

Django-axes not working with custom login view

不想你离开。 提交于 2019-12-08 13:27:02
问题 I have followed the below links before asking this question as it seems like a duplicate, but of no use. So I'm asking again. Django login with django-axes django-axes not capturing failed login attempt, but captures admin failed attempts fine The django-axes works fine with the admin site, but it is unable to capture the failed attempts from the user custom login view. My custom view at '/project/app/views.py' is as follows: from axes.decorators import watch_login @watch_login def user_login

Python Social Auth duplicating e-mails for different users

我是研究僧i 提交于 2019-12-08 05:48:25
问题 In my website it is possible to login through: username and password e-mail and password google auth 2 facebook Where I am using django user built in system and python social auth. The problem: Suppose I create the following account: username: losimonassi e-mail: lorenzosimonassi@gmail.com Then when I try to login with my gmail (lorenzosimonassi@gmail.com) python social auth creates another user with the same e-mail. So, when I try to login using my e-mail the auth system finds two similar e

django: failing tests from django.contrib.auth

China☆狼群 提交于 2019-12-07 08:00:26
问题 When I run my django test I get following errors, that are outside of my test suite: ====================================================================== ERROR: test_known_user (django.contrib.auth.tests.remote_user.RemoteUserCustomTest) ---------------------------------------------------------------------- Traceback (most recent call last): File "/usr/lib/pymodules/python2.6/django/contrib/auth/tests/remote_user.py", line 160, in test_known_user super(RemoteUserCustomTest, self).test_known

“Foreign Keys” across very separate databases in Django

懵懂的女人 提交于 2019-12-07 07:42:56
问题 I've writing a Django site that uses two different databases. One is the local, let's call it, "Django", database that stores all of the standard tables from a pretty standard install -- auth, sites, comments, etc. -- plus a few extra tables. Most of the data, including users, comes from a database on another server, let's call it the "Legacy" database. I'm looking for suggestions on clean, pythonic ways of connecting the two databases, particularly in regards to users. I'm using a proxy

Can I have two django projects sharing the same authentication model?

会有一股神秘感。 提交于 2019-12-07 07:10:29
问题 I have two very related sites, would like users using each to only to have to login once. Either two apps under one django project serving different domains? Is this possible? or is there some way to share the authentication between two separate django projects? Cheers Asim 回答1: There are lots of ways you can solve this problem. Here are some things to look into. I'm ordering based on my preference, if you've got some questions, or more specificity to your question, it could change. Use the