GAE: Cannot set admin login credential for module http requests

333 views Asked by At

I am following this Google developers documentation https://developers.google.com/appengine/docs/java/modules/

It mentions that one can configure a module to accept requests from other modules by adding the <login>admin</login> specification to the module's handler.

I assume that the handler being referred to here is the web.xml document of the module that is accepting the requests.

Where in the web.xml document is one supposed to add <login>admin</login>? It seems that everywhere I add it, I get an error from eclipse.

2

There are 2 answers

2
Patrice On

You setup your modules in appengine-web.xml, the main one where you put your modules in, determine instance class and scaling and whatnot.... I am pretty sure this is where your login should go.

2
Frank R. On

What you need in web.xml is this.

<servlet>
        <servlet-name>appstats</servlet-name>
        <servlet-class>yyy</servlet-class>
</servlet>
<servlet-mapping>
        <servlet-name>appstats</servlet-name>
        <url-pattern>xxx</url-pattern>
</servlet-mapping>

<security-constraint>
        <web-resource-collection>
                <web-resource-name>admin</web-resource-name>
                <url-pattern>xxx</url-pattern>
        </web-resource-collection>
        <auth-constraint>
                <role-name>admin</role-name>
        </auth-constraint>
</security-constraint>

It's an equivalent to following yaml for Python

handlers: 
- url: /xxx
  script: yyy
  login: admin 

See https://cloud.google.com/appengine/docs/python/config/appconfig#Python_app_yaml_Requiring_login_or_administrator_status