首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >如何定义使用的领域?

如何定义使用的领域?
EN

Stack Overflow用户
提问于 2009-06-15 08:31:59
回答 1查看 1.7K关注 0票数 1

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

代码语言:javascript
复制
<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>

然而,在运行时,没有领域“用户”:

09-06-15 10:25:42.536:警告:请求/secured失败-没有领域

  • 如何定义google应用引擎下的领域?
  • 如何使用jetty.xml?它是由GAE?

联合开发的。

EN

回答 1

Stack Overflow用户

回答已采纳

发布于 2009-06-17 10:13:53

我添加了web.xml/jetty-web.xml:

代码语言:javascript
复制
<?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//secured”却不被识别。

是个虫子?

票数 1
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/995035

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档