代码之家  ›  专栏  ›  技术社区  ›  dfa

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

  •  1
  • dfa  · 技术社区  · 16 年前

    我的应用程序存在安全限制:

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

    • 如何在谷歌应用引擎下定义领域?
    • 使用jetty.xml?它被GAE认证了吗?
    1 回复  |  直到 16 年前
        1
  •  1
  •   dfa    16 年前

    我添加了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上。然而,当我尝试获得/保护时,会出现一个纯格式的http,但无法识别“dfa/secret”。

    是虫子吗?