如何定义使用Google App Engine的领域? [英] How to define realms for using by Google App Engine?
本文介绍了如何定义使用Google App Engine的领域?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我的应用程序有一个安全限制:
< security-constraint>
< display-name>个用户< / display-name>
< web-resource-collection>
< web-resource-name>所有< / web-resource-name>
< description />
< url-pattern> / secured< / url-pattern>
< http-method> GET< / http-method>
< http-method> POST< / http-method>
< http-method> HEAD< / http-method>
< http-method> PUT< / http-method>
< http-method> OPTIONS< / http-method>
< http-method> TRACE< / http-method>
< http-method> DELETE< / http-method>
< / web-resource-collection>
< auth-constraint>
< description>必须是USER< / description>
< role-name> USERS< / role-name>
< / auth-constraint>
< / security-constraint>
< login-config>
< auth-method> BASIC< / auth-method>
< / login-config>
< security-role>
< description />
< role-name> USERS< / role-name>
< / security-role>
在运行时,没有领域USERS:
2009-06-15 10:25:42.536 :: WARN:请求/安全失败 - 无域
<?xml version =1.0encoding =utf-8?>
<!DOCTYPE配置PUBLIC - // Mort Bay Consulting // DTD配置1.1 // EN
http://jetty.mortbay.org/configure_1_2.dtd\">
< Configure class =org.mortbay.jetty.webapp.WebAppContext>
< Get name =securityHandler>
< Set name =userRealm>
< New class =org.mortbay.jetty.security.HashUserRealm>
< Set name =name> MyRealm< / Set>
< Call name =addUserToRole>
< Arg> dfa< / Arg>
< Arg> *< / Arg> <! - *是GAE的内建领域 - >
< /通话>
< Call name =put>
< Arg> dfa< / Arg>
< Arg>秘密< / Arg>
< /通话>
< / New>
< / Set>
< /获取>
< / Configure>
这已在GAE上正确部署。然而,当我尝试获取/确保一个普通格式http出现,但dfa / secret未被识别。
这是一个错误?
I've a security constraint on my app:
<security-constraint>
<display-name>users</display-name>
<web-resource-collection>
<web-resource-name>all</web-resource-name>
<description/>
<url-pattern>/secured</url-pattern>
<http-method>GET</http-method>
<http-method>POST</http-method>
<http-method>HEAD</http-method>
<http-method>PUT</http-method>
<http-method>OPTIONS</http-method>
<http-method>TRACE</http-method>
<http-method>DELETE</http-method>
</web-resource-collection>
<auth-constraint>
<description>Have to be a USER</description>
<role-name>USERS</role-name>
</auth-constraint>
</security-constraint>
<login-config>
<auth-method>BASIC</auth-method>
</login-config>
<security-role>
<description/>
<role-name>USERS</role-name>
</security-role>
At runtime however there is no realm "USERS":
2009-06-15 10:25:42.536::WARN: Request /secured failed - no realm
- How to define realms under google app engine?
- By using jetty.xml? It is onorated by GAE?
解决方案
I've added WEB-INF/jetty-web.xml:
<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE Configure PUBLIC "-//Mort Bay Consulting//DTD Configure 1.1//EN"
"http://jetty.mortbay.org/configure_1_2.dtd">
<Configure class="org.mortbay.jetty.webapp.WebAppContext">
<Get name="securityHandler">
<Set name="userRealm">
<New class="org.mortbay.jetty.security.HashUserRealm">
<Set name="name">MyRealm</Set>
<Call name="addUserToRole">
<Arg>dfa</Arg>
<Arg>*</Arg> <!-- * is a "builtin" realm for GAE -->
</Call>
<Call name="put">
<Arg>dfa</Arg>
<Arg>secret</Arg>
</Call>
</New>
</Set>
</Get>
</Configure>
this is correctly deployed on GAE. However when I try to get /secured a plain form http appears but "dfa/secret" is not recognized.
It is a bug?
这篇关于如何定义使用Google App Engine的领域?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文