1

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.

Harshal Patil
  • 6,659
  • 8
  • 41
  • 57
Alvin M
  • 21
  • 4

2 Answers2

0

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.

Patrice
  • 4,641
  • 9
  • 33
  • 43
  • Thanks for the answer, @Julldar. I inserted the line `admin` into the appengine-web.xml of the module, but on running the EAR I got the following error: `"Invalid appengine-web.xml ... - Unrecognized element "`. I then thought that you meant the file appengine-application.xml. But I get a similar error if I put the login in there. – Alvin M Aug 12 '14 at 15:57
  • nah I actually meant the appengine-webxml in the module. They do say login has to do with scaling, so you should put them at the same place.... if it doesn't fix your problem... I don't really know :( – Patrice Aug 12 '14 at 16:18
0

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

Frank R.
  • 1,732
  • 18
  • 21
  • There is no in web.xml. See * https://cloud.google.com/appengine/docs/java/config/webxml * http://docs.oracle.com/cd/E13222_01/wls/docs81/webapp/web_xml.html The doc for Java https://cloud.google.com/appengine/docs/java/modules/#Java_Communication_between_modules is suspected to be (inproperly) translated word-by-word from the one for Python https://cloud.google.com/appengine/docs/python/modules/#Python_Communication_between_modules – Frank R. Oct 01 '14 at 01:43
  • Here is a sample for Securing URLs for tasks in web.xml, https://cloud.google.com/appengine/docs/java/taskqueue/overview-push#Java_Securing_URLs_for_tasks – Frank R. Oct 01 '14 at 01:48