本文假设读者已对OOS有必定的认识了解而且已经自行成功搭建过Swift,背景还有部署方法这里就很少说了,这里Swift使用的身份认证组件为Keystone,参照官方文档步骤操做发现,对container设置ACL后仍无法实现容许任何人访问该容器下的object。后来查看Swift中间件源码中的注释得知,只需在proxy-server.conf中启动相应配置便可解决上述问题。 html
首先来看看proxy-server.conf中的pipline顺序:
[pipeline:main]
pipeline = catch_errors healthcheck proxy-logging cache bulk slo ratelimit authtoken keystoneauth container-quotas account-quotas staticweb proxy-logging proxy-server web
上面标红部分为keystone认证组件,在正常状况下,请求要顺利经过proxy-server,必需要从keystone或者cache中拿到一个有效token,然而要想拿到token的话,必需要输入Tenant、User和password等相关信息。这样来讲,swift仅提供了私有存储的服务,要想实现公有存储服务,仍需作如下操做。 shell
第一,修改proxy-server.conf配置
引用keystoneauth.py代码注释说明:
If support is required for unvalidated users (as with anonymous access) or for formpost/staticweb/tempurl middleware, authtoken will need to be configured with ``delay_auth_decision`` set to true. swift
[filter:authtoken] ... delay_auth_decision = true ...查看swift和keystone相关代码暂时没有弄懂这个设置是在哪里、经过哪个逻辑判断生效的,经过字面意思能够看出,系统暂时延迟用户身份的认证,交由后面组件来把关是否Authentication required!