gpt4 book ai didi

java - 如何定义 Google App Engine 使用的领域?

转载 作者:太空宇宙 更新时间:2023-11-04 09:00:00 24 4
gpt4 key购买 nike

我的应用程序有安全限制:

<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>

但是在运行时没有领域“USERS”:

2009-06-15 10:25:42.536::警告:请求/安全失败 - 无领域

  • 如何在 Google App Engine 下定义领域?
  • 通过使用 jetty.xml?它是由 GAE 赞助的吗?

最佳答案

我添加了 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>

这已正确部署在 GAE 上。但是,当我尝试获取/secured 时,会出现一个简单形式的 http,但无法识别“dfa/secret”。

这是一个错误吗?

关于java - 如何定义 Google App Engine 使用的领域?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/995035/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com