0
votes

I have a default GWT + app engine project. We get a GWT entry point by default.

Is it possible to create a second GWT entry point, one that is only loaded by html pages which are protected behind authentication?

For example, in my web.xml file, I've added:

<security-constraint>
  <web-resource-collection>
      <url-pattern>/myprivatestuff/*</url-pattern>
  </web-resource-collection>
  ...
</security-constraint>

and my war folder in the app engine project:

/war/myprivatestuff/index.html

and I'd like the index.html file in there to load a different GWT module. I don't want the code from this second 'admin' module to be able to be loaded by the 'main/default' GWT module.

I'm afraid that GWT will compile all my clientside code into one monolithic javascript entity, combining both the general module, and the admin module, which would be a security problem.

Is is possible to build two modules in a single project, and have their compiled code live in different javascript output, and only load one behind this protected path?

Thanks

1

1 Answers

0
votes

yes, but entry point alone wont solve your problem, you need to create a second gwt module (which will have its own HTML page and Entry point and *.gwt.xml file). so that becomes a completely different application, which will be downloaded only when you access the new url (i.e. new html page).

now at the EntryPoint of this second module, you can make an RPC call to server and check if the user is logged in, and in admin role, only then return the response and move to the next page which shows menu and all)

If you want to further secure the page, say you dont want to even download the client side code to browser unless user is admin, you can do Code Splitting, so only when the application authentication is successful and you are moving to next page, the compiled JS is transferred only then.

hope it helps.