【问题标题】:Simplest way to protect a static website using oauth2使用 oauth2 保护静态网站的最简单方法
【发布时间】:2015-01-21 21:04:30
【问题描述】:

我想使用 google oauth2 保护我的公司文档(使用 Sphinx 创建的静态网站)。

实现这一目标的最简单方法是什么?我更准确地说我是一个 python 和 javascript 的家伙。欢迎提出想法或图书馆名称!

谢谢!

【问题讨论】:

  • 您的意思是通过 google 进行身份验证?为什么不只使用 htaccess 基本身份验证? ...我认为没有一种简单的方法可以满足您的要求...
  • 基本上你必须创建一个 webapp 来提供你的文档......见sphinx-doc.org/latest/web/quickstart.html#authentication...... oauth-2.0 通常很容易实现......所以我先看看该链接并让您的网站成为 Flask 应用程序

标签: python node.js oauth-2.0 python-sphinx


【解决方案1】:

如果您使用 Apache 网络服务器为网站提供服务(或在该内容之前使用 Apache 作为反向代理),您可以使用支持 Google 访问令牌验证的 mod_auth_openidc 1.7.2 版。 configuration 看起来像:

OIDCOAuthIntrospectionEndpoint https://www.googleapis.com/oauth2/v1/tokeninfo
OIDCOAuthIntrospectionTokenParamName access_token
OIDCOAuthRemoteUserClaim user_id

<Location /static/>
    Authtype oauth20
    # require specific claims to be present in the JSON
    # response returned from the token info endpoint
    Require claim issued_to:<client_id>
</Location>

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2013-04-14
    • 2011-10-01
    • 2023-03-18
    • 1970-01-01
    • 2010-12-15
    • 2014-11-20
    • 2019-11-04
    相关资源
    最近更新 更多