且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

在Google App Engine中自定义登录

更新时间:2023-12-04 23:08:40

Nick Johnson最近发布了一个alpha版本的您可以使用的WSGI中间件。该API与应用程序引擎中的标准用户API非常相似。这是一种通过OpenID支持身份验证的方式(Alex Martelli在他的回答)。因此,您可以支持Google作为身份提供者以及其他人。如果你只是想为某些原因支持谷歌账户,你当然只能将它们列入白名单。

Nick的博客


  • 用户由其OpenID端点唯一标识。

  • 您无法构建用户对象,而不指定OpenID URL。

  • 昵称和电子邮件地址是用户提供的,因此不保证它们是唯一的或经过验证的。 is_current_user_admin )尚未实现。

  • 登录:app.yaml中的子句不受AEoid影响 - 它们仍使用常规用户API进行身份验证。

>

I need to add few more options for login and therefore need to customize create_login_url with some HTML code.

Is there a way to add on your code in default login screen of Google?

Environment: Python (Google App Engine)

I want to continue having the default Google ext class Users behavior in place.

Nick Johnson recently released an alpha version of a WSGI middleware that you could use. The API is very similar to the standard Users API in app engine. It is a way to support auth via OpenID (something Alex Martelli suggested in his answer). Therefore you are able to support Google as Identity Provider as well as others. If you only want to support Google accounts for some reason, you could certainly only whitelist them though.

Nick's blog announcement also lists some things to consider (these might be deal-breakers for you):

  • Users are identified uniquely by their OpenID endpoint.
  • You can't construct a User object without specifying an OpenID URL.
  • Nicknames and email addresses are user-supplied, so they're not guaranteed unique or validated.
  • is_current_user_admin() is not yet implemented.
  • login: clauses in app.yaml are not affected by AEoid - they still authenticate using the regular Users API.