Django REST Framework/Django

In my project I've two different types of users: regular Django user worker - user which sends messages through application API and authenticates with token (basic Django rest framework token authentication) The problem is that Token object is connected with django User object. What would be the best solution - create new user model for my worker? I don't want to extend User model

Django REST框架/ Django

在我的项目中,我有两种不同类型的用户: 常规的Django用户 worker - 通过应用程序API发送消息并通过令牌进行身份验证的用户(基本Django rest框架令牌身份验证) 问题是令牌对象与django用户对象连接。 什么是最好的解决方案 - 为我的员工创建新的用户模型? 我不想扩展用户模型,因为我想在我的管理面板中拥有“用户”和“工作人员”。 class Worker(models.Model): ip = models.GenericIPAddressField() created

Native app rest api social login flow

I am developing a native frontend application which communicates with a backend rest api built using python django rest framework. The rest framework uses django rest framework token authentication in which every user has an authorization token and the token will have to be attached to the header of every http request to the rest api in the form of “Authorization: Token ”. My application prov

本地应用休息api社交登录流程

我正在开发一个本地前端应用程序,它与使用python django rest框架构建的后端休息API进行通信。 其余框架使用django rest框架令牌认证,其中每个用户都有一个授权令牌,令牌必须以“授权:令牌”的形式附加到每个http请求的头部。 我的应用程序为用户提供了两种主要的登录方式。 第一个是使用用户名和密码注册一个帐户。 这将创建一个django用户模型对象,并会生成一个令牌。 这种登录方法效果很好。 第二种登录方法是使

How can I use Django OAuth Toolkit with Python Social Auth?

I'm building an API using Django Rest Framework. Later this API is supposed to be consumed by iOS and Android devices. I want to allow my users to sign-up with oauth2-providers like Facebook and Google. In this case, they shouldn't have to create an account with my platform at all. But users should also be able to sign-up when not having a Facebook/Google account, for which I'm us

我如何使用Django OAuth工具包与Python社会认证?

我正在使用Django Rest Framework构建一个API。 后来这个API应该被iOS和Android设备使用。 我想允许我的用户使用Facebook和Google等oauth2提供商注册。 在这种情况下,他们不应该在我的平台上创建帐户。 但是,如果用户没有使用django-oauth-toolkit的Facebook / Google帐户,那么用户也应该可以注册,所以我拥有自己的oauth2提供商。 对于外部提供商,我使用python-social-auth,它可以正常工作并自动创建用户对象。 我

User model other than AUTH

I have an architectural problem. I'm using Django (with admin panel) and DRF (api with stateless authentication using JWT). Django has Admin users represented by model which is more or less the same as default Django User Model. Admins work with Django Admin only and can't use DRF api. DRF has API users that are allowed to use only api through DRF and can't interact with Django

AUTH以外的用户模型

我有一个建筑问题。 我正在使用Django(带管理面板)和DRF(使用JWT进行无状态身份验证的api)。 Django的管理员用户使用的模型与默认的Django用户模型差不多。 管理员只能使用Django Admin,不能使用DRF api。 DRF拥有允许通过DRF使用API​​的API用户,并且不能与Django Admin或Django Session等进行交互。 我知道最好的方法是使用多模型继承,如: class User(DjangoUserModel): pass class Admin(User): p

Django Rest Framework Authentication Errors

I'm making an angular app that authenticates in a django site using a rest api. In the doc of drf they state that a denied user authentication will result in two error, HTTP 401 and HTTP 403, as follows: When an unauthenticated request is denied permission there are two different error codes that may be appropriate. HTTP 401 Unauthorized HTTP 403 Permission Denied Howenever, when I t

Django Rest框架身份验证错误

我正在制作一个角色应用程序,使用rest api在django网站中进行身份验证。 在drf文档中,他们声明拒绝的用户认证将导致两个错误,HTTP 401和HTTP 403,如下所示: 当未经身份验证的请求被拒绝时,有两种不同的错误代码可能是合适的。 HTTP 401未经授权 HTTP 403权限被拒绝 无论何时,当我尝试使用某些虚拟数据进行身份验证时,这是错误的,我得到错误响应HTTP 400和non_field_errors 。 这里有什么问题? 首先,我使

Get Authenticated user from token in Django Rest Framework

I am new in Django and I have managed to build a small API using DRF. I have my angular.js client end posting user auth details and DRF returns a token which looks like this: { 'token' : '9944b09199c62bcf9418ad846dd0e4bbdfc6ee4b' } Based on the tutorial, I am supposed to retrieve the details from request.user But I don't know where to do this. I find it confusing since it doesn't give

在Django Rest Framework中从令牌获取经过身份验证的用户

我是Django中的新成员,并且我设法使用DRF构建了一个小型API。 我有我的angular.js客户端发布用户身份验证详细信息和DRF返回一个令牌,看起来像这样: { 'token' : '9944b09199c62bcf9418ad846dd0e4bbdfc6ee4b' } 根据教程,我应该从request.user检索详细信息但我不知道该在哪里做。 我发现它令人困惑,因为它没有给出一个好例子。 任何人有关于如何解决它的想法? 您的意见非常感谢。 以下是我的视图和序列化程序的代码

Trying to connect Django dev server from remote

I have deployed my django application in server or machine A. I want to access my web page from machine B. My machine B runs in a virtual box and I did a ssh to machine A. I started the django development server at machine A using the command: python manage.py runserver 0.0.0.0:8000 I go to machine B try to access my webpage using: http://ip-machine-A:8000/appname/login/ However,I'm unable to

尝试从远程连接Django dev服务器

我已经在服务器或机器A中部署了我的django应用程序。我想从机器B访问我的网页。我的机器B在虚拟机箱中运行,并且我对机器A执行了ssh。我使用机器A启动了django开发服务器命令:python manage.py runserver 0.0.0.0:8000我去机器B尝试访问我的网页使用:http:// ip-machine -A:8000 / appname / login /然而,我无法连接。 我已经通过类似的问题,我已经尝试了所有的解决方案,如将settings.py中的allowed_hosts修改为['*&

Access request object from within django admin's authenticate()

Is this anyhow possible to access the request object from within the django admin's authenticate() in custom auth backend? The reason for this is I want to keep and re-use the user's password (or a Kerberos ticket - not sure yet) to authorize an operation in another system, which uses the same LDAP backend. For this purpose I wanted to use request.session - but it doesn't seem to b

从django admin的authenticate()中访问请求对象

无论如何,无论如何可以在自定义身份验证后端访问django admin的authenticate()中的请求对象 ? 原因是我想保留并重新使用用户的密码(或Kerberos票据 - 尚不确定)来授权另一个使用相同LDAP后端系统的操作。 为此,我想使用request.session - 但它似乎不可访问,至少不是简单的方法。 如果有任何其他可能性将验证值传递给模型,我很乐意获得一个建议。 谢谢。 我相信,为了安全起见,在会话中存储原始密码是一个坏

LDAP authentication error in django

I am working on a django app and have to incorporate the LDAP authentication mechanism. Currently my files look like: ---settings.py import ldap from django_auth_ldap.config import LDAPSearch AUTHENTICATION_BACKENDS = ( 'django_auth_ldap.backend.LDAPBackend', 'django.contrib.auth.backends.ModelBackend', ) AUTH_LDAP_SERVER_URI = 'ip_address' AUTH_LDAP_BIND_DN = 'cn=admi

django中的LDAP验证错误

我正在研究一个django应用程序,并且必须包含LDAP认证机制。 目前我的文件如下所示: ---settings.py import ldap from django_auth_ldap.config import LDAPSearch AUTHENTICATION_BACKENDS = ( 'django_auth_ldap.backend.LDAPBackend', 'django.contrib.auth.backends.ModelBackend', ) AUTH_LDAP_SERVER_URI = 'ip_address' AUTH_LDAP_BIND_DN = 'cn=admin,dc=******,dc=com' AUTH_LDAP_BIND_PAS

Single sign on to Django site via remote Active Directory

I developed an Intranet for a client using Django. The users sign on to their computers via Active Directory. Currently, I log them in via standard Django contrib.auth, and use Active Directory via custom login backends. What I'd like is for users to be able to use SSO via their existing Active Directory login to be automatically logged into the Django site. I understand that this shoul

通过远程Active Directory单点登录到Django站点

我为使用Django的客户开发了一个Intranet。 用户通过Active Directory登录到他们的计算机。 目前,我通过标准的Django contrib.auth登录它们,并通过自定义登录后端使用Active Directory。 我希望用户能够通过他们现有的Active Directory登录使用SSO来自动登录到Django站点。 我知道这应该通过REMOTE_USER完成(https://docs.djangoproject.com/en/dev/howto/auth-remote-user/),但文档说:“Web服务器设置REMOTE_USER环