在openidconnect兼容身份验证(即okta)后安全地提供静态文件
barrier的Python项目详细描述
在openidconnect兼容身份验证(即okta)之后安全地提供静态文件
openid connect provider设置
okta
以下步骤将为您提供将OKTA与受屏障保护的内容集成所需的值。
- 转到Okta管理应用程序的应用程序部分。(提示:管理应用程序的url是https://<yourorganization>>-admin.okta.com/dev/console)
- 单击添加应用程序
- 在create new application页面上,选择web并单击next
- 您需要输入有关应用程序的一些详细信息:
- 姓名:<your barrier-protected site name>
- 基本uri:https://<yourbarrier-protected domain>/
- 或者http://localhost:8000在开发过程中)
- 登录重定向uri:https://<yourbarrier-protecteddomain>/oidc/callback
- 或者在开发过程中http://localhost:8000/oidc/callback,&;http://localhost:5000/oidc/callback。
- 组分配:everyone很好,除非您有特定要求。
- 允许的授权类型:
- 代表自己行事的客户
- [ ]客户端凭据
- 代表用户的客户端
- [x]授权代码
- [ ]刷新令牌
- [ ]隐式(混合)
- 再次单击next。
- 现在,您已经进入新的okta集成的常规设置,滚动到底部并复制client id和client secret值。
- 访问dashboard页面并复制org url。
- 使用以下指南设置环境变量[1]:
- BARRIER_CLIENT_ID=客户端ID
- BARRIER_CLIENT_SECRET=客户端机密
- BARRIER_AUTH_URI=<Org URL>/oauth2/default/v1/authorize
- BARRIER_TOKEN_URI=<Org URL>/oauth2/default/v1/token
- BARRIER_ISSUER=<Org URL>/oauth2/default
- BARRIER_USERINFO_URI=<Org URL>/oauth2/default/userinfo
- 恭喜你!您已经准备好安装或部署了!
安装
$ pip install (--user) https://github.com/gadventures/barrier
命令
下面是一个简短的概述,但是您可以使用--help调用这些命令中的任何一个来获取更多信息。
- barrier-config
- 生成“client secrets.json”,这是运行其他命令所必需的。有关所需选项,请参见帮助文本。在命令行上传递的选项将覆盖环境中设置的任何值。
- barrier-dev
- 烧瓶开发服务器。如果扩展此项目以添加更多功能,则非常有用。
- barrier-wsgi Gunicorn wsgi包装。可以放在nginx、apache或任何你喜欢的东西后面。
环境
必需
Name | Description | Where to get it |
---|---|---|
^{tt20}$ | UserInfo URI. Part of OpenIDConnect secrets configuration. | OpenID Connect Provider |
^{tt18}$ | Issuer ID. Part of OpenIDConnect secrets configuration. | OpenID Connect Provider |
^{tt16}$ | Token URI. Part of OpenIDConnect secrets configuration. | OpenID Connect Provider |
^{tt14}$ | Auth URI. Part of OpenIDConnect secrets configuration. | OpenID Connect Provider |
^{tt13}$ | Client Secret Key. Part of OpenIDConnect secrets configuration. | OpenID Connect Provider |
^{tt12}$ | Client ID. Part of OpenIDConnect secrets configuration. | OpenID Connect Provider |
^{tt32}$ | Redirect URI. Part of OpenIDConnect secrets configuration. | OpenID Connect Provider, The value to set is: ^{tt33}$ |
^{tt34}$ | Used for HMAC Authentication. Generate a long random string. | Any source of random information |
可选
Name | Description | Where to get it |
---|---|---|
^{tt35}$ | Root path of static files to serve. (Default: ^{tt36}$) | Wherever you choose to add the static files in your custom layer, or add your files to the default location. | |
^{tt37}$ | The file/path that users will be redirected to after login. (Default: ^{tt38}$) | Probably not necessary to change this. |
^{tt39}$ | OpenIDConnect secrets configuration file location. If your provider allows automatic configuration download and has a different filename, override with that filename here. (Default: ^{tt40}$) | OpenID Connect Provider |
[1] | https://developer.okta.com/blog/2018/07/12/flask-tutorial-simple-user-registration-and-login#step-1-create-an-openid-connect-config-file |