草庐IT

ntlm-authentication

全部标签

python - Django-rest-framework教程中的AttributeError 4 : authentication

我正在学习django-rest-framework教程,但我无法弄清楚这里发生了什么。我创建了一个带有snippets属性的UserSerializer类,并完成了所有的导入#--!-coding:utf-8fromrest_frameworkimportserializersfromsnippets.modelsimportSnippetfromdjango.contrib.auth.modelsimportUserclassSnippetSerializer(serializers.ModelSerializer):owner=serializers.ReadOnlyField(

Python NTLM 登录

我正在尝试从需要NTLM登录的url中提取信息。我最初收到401错误,经过一些调整后能够拉出页面,说明我输入了无效凭据。用户名和密码正确,但我无法通过无效凭据页面。Lgn2.py:importurllib2importHTTPNtlmAuthHandlerlogin=open('c:/temp/login.txt')open=login.read()to=open.split()user=str(to[0])password=str(to[1])url="http://INSERTURLHERE.com/"passman=urllib2.HTTPPasswordMgrWithDefau

python - Flask 用户管理 : How to make Stateless Server using better authentication ways?

我在多个地方阅读过,建议Web服务器应该是Stateles和sharenothingarchitecture。这有助于他们更好地扩展。这意味着每个请求都包含处理该请求所需的所有信息。当您有需要身份验证的REST端点时,这会变得棘手。我一直在寻找Flask扩展的方法,并且FlaskLogin扩展定义为Flask-LoginprovidesusersessionmanagementforFlask.Ithandlesthecommontasksofloggingin,loggingout,andrememberingyourusers’sessionsoverextendedperiods

python - Tastypie : Authentication for GET and Anonymous for POST

我使用Django/Tastypie来管理我的用户集合。是否可以允许匿名用户在API中进行POST(在某个端点创建新用户时)并限制经过身份验证的用户仅获取他们自己的用户,而不是所有用户?感谢您的帮助。 最佳答案 我发现最简单的事情是将我正在使用的身份验证类子类化。只需覆盖is_authenticated方法即可在该方法为POST时返回True。classAnonymousPostAuthentication(BasicAuthentication):"""Noauthonpost/forusercreation"""defis_au

python - django request.user.is_authenticated 总是正确的吗?

谁能告诉我为什么在下面的代码中我被重定向到yahoo.com而不是google.com?网址urlpatterns=patterns('',(r'^$',initialRequest,))查看definitialRequest(request):ifrequest.user.is_authenticated:returnHttpResponseRedirect('http://yahoo.com')else:returnHttpResponseRedirect('http://google.com') 最佳答案 不应该是reques

python - 通过 Exchange 使用集成 Windows 身份验证 (NTLM) 使用 Python 的 SMTP

我想使用已登录Windows用户的凭据来验证与使用NTLM的Exchange服务器的SMTP连接。我知道python-ntlm模块和twopatches为SMTP启用NTLM身份验证,但是我想使用当前用户的安全token,而不必提供用户名和密码。与WindowsAuthenticationwithPythonandurllib2非常相似的问题. 最佳答案 虽然下面的解决方案仅使用PythonWin32扩展(PythonWin32扩展中包含的sspi示例代码非常有帮助),但问题中提到的python-ntlmIMAP和SMTP补丁也可作

python - 类型错误 : 'bool' object is not callable g. user.is_authenticated()

这个问题在这里已经有了答案:Flask-LoginraisesTypeError:'bool'objectisnotcallablewhentryingtooverrideis_activeproperty(2个答案)关闭7年前。我正在尝试在我的Flask应用程序中执行此操作。但是我收到这样的错误TypeError:'bool'objectisnotcallable.对应的代码如下:@app.before_requestdefbefore_request():g.user=current_userifg.user.is_authenticated():g.search_form=Non

python - Flask-Login 中使用的 "is_authenticated"方法有什么意义?

我正在学习FlaskMega-Tutorial,我遇到了这段代码:classUser(db.Model):id=db.Column(db.Integer,primary_key=True)nickname=db.Column(db.String(64),unique=True)email=db.Column(db.String(120),unique=True)role=db.Column(db.SmallInteger,default=ROLE_USER)posts=db.relationship('Post',backref='author',lazy='dynamic')defi

python - is_authenticated() 引发 TypeError TypeError : 'bool' object is not callable

这个问题在这里已经有了答案:Flask-LoginraisesTypeError:'bool'objectisnotcallablewhentryingtooverrideis_activeproperty(2个答案)关闭7年前。我尝试在View中使用is_authenticated(),但收到错误“TypeError:'bool'objectisnotcallable”。为什么会出现此错误以及如何解决?@auth.before_app_requestdefbefore_request():ifcurrent_user.is_authenticated()\andnotcurrent_

python - Django Tastypie : How to Authenticate with API Key

我正在使用TastyPie制作一个内部API。我有fromtastypie.authenticationimportApiKeyAuthenticationclassMyResource(ModelResource):Meta:authentication=ApiKeyAuthentication()在禁用身份验证规则的情况下,我的API运行良好。启用它后,无论我尝试什么,我都会收到401(未经授权)响应。我敢肯定,一旦您看到它的实际效果,这是非常明显的事情之一,但与此同时,请告知如何发出请求(GET)。 最佳答案 将用户名和api