草庐IT

authenticity

全部标签

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 - 类型错误 : '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

html - 为什么 Rails 给我 "Can' t verify CSRF token authenticity”错误?

我在Rails生产中收到“无法验证CSRFtoken真实性”。我的问题是:为什么要这样做?我该如何解决?这是我的Heroku日志(一些值已匿名):2016-02-13T01:18:54.118956+00:00heroku[router]:at=infomethod=POSTpath="/login"host=[MYURL]request_id=[IDSTRING]fwd="FWDIP"dyno=web.1connect=0msservice=6msstatus=422bytes=17832016-02-13T01:18:54.116581+00:00app[web.1]:Starte

authentication - 如何用HTML或JAVASCRIPT制作登录认证页面

我是电子学出身,所以不太懂网页设计。我正在做一个以太网项目,为此我需要制作一个网页,但在该网页之前我还需要制作一个登录身份验证网页。我以某种方式设法使用HTMLJAVASCRIPT做到了,但问题是任何人都可以通过查看页面源代码来查看用户名密码。我很难进行身份验证。我有HTML和JAVASCRIPT的基本知识,但准备学习。我在谷歌上只能找到登录模板,但我什至不知道如何使用它们。任何人都可以给我一个例子或给我一些好的链接。 最佳答案 HTML和Javascript在clientside上被解释。出于登录目的,服务器端代码通常用于验证凭据

ios - 轨道 API : Authenticate users from native mobile apps using username/password or facebook token

因此,我已经绞尽脑汁好几天了,试图弄清楚如何将用户名/密码身份验证添加到我的Rails移动API。以下是我当前身份验证流程的简要概述:用户在移动客户端上选择“使用Facebook登录”,客户端重定向到Facebook应用程序并请求access_token成功后,Facebook使用访问token和客户端进行响应重定向回我的应用。客户端将访问token发送到我的API我的API使用koalagem检查访问token是否有效。如果token有效,Facebook会将用户数据发送到API创建新用户的地方。如果用户已经存在,我的API会向下发送用户数据。我的API在步骤4中处理访问token,