Basic Auth with GWT

278 views
Skip to first unread message

pete

unread,
Oct 16, 2010, 12:44:45 AM10/16/10
to Google Web Toolkit
Hello!

I have a running GWT-App, with a DialogBox as login box, sending login
data via RPC to the server and performing the login process. Now it is
requested, that the standard basic-auth of http is used. I found one
tutorial how to upgrade the web.xml, but that didn't work with GWT 2.0
anymore...
What I want is the browser standard basic-auth dialog popping up,
entering credentials (maybe saving them if wished), then sending the
data to the server, processing the login, and if successful to load
the module, otherwise ask again...
I found how to send a http request including basic-auth information,
but that doesn't take care of integrating the standard browser dialog
window.
I also have a similar standard java servlet app, that performs all of
these tasks as part of the servlet process, by performing the
appropriate doGet() method and sending the respective response back...
Does anyone know how to accomplish this? Maybe similar to the standard
servlet app? (is there a way to not load the module immediately, but
first do a GET-Request to a standard servlet and load the module
appropriately afterwards?)
Many thanks in advance :-)

Greetz

Lothar Kimmeringer

unread,
Oct 16, 2010, 2:34:36 AM10/16/10
to google-we...@googlegroups.com


"pete" <supe...@geekcity.de> schrieb:

>What I want is the browser standard basic-auth dialog popping up,
>entering credentials (maybe saving them if wished), then sending the
>data to the server, processing the login, and if successful to load
>the module, otherwise ask again...
>I found how to send a http request including basic-auth information,
>but that doesn't take care of integrating the standard browser dialog
>window.

The dialog is shown (by the browser automatically), if the server answers with the HTTP response code for "unauthorized" and the HTTP response header informing about the available authentication types.

I'm writing this mail from my mobile phone, so you need to check for the specific values for yourself.

Keep in mind that basic authentication is sending username and password in quasi cleartext, so HTTPS should be used.


Regards, Lothar
--
Diese Nachricht wurde von meinem Android-Mobiltelefon mit K-9 Mail gesendet.

pete

unread,
Oct 16, 2010, 11:54:52 PM10/16/10
to Google Web Toolkit
Hmm, yeah, I know that the dialog pops up, if an "authorization
required" response arrives, normally. Just how do I trigger the whole
thing? If I use RequestBuilder, I can send a getRequest, and set an
appropriate response header on the server. Just that then I have to
deal with it manually in my Callback, so I don't know how to trigger
the popup then and direct all further processing back to the browser.
If try start off with a normal servlet, I just get a "your module may
need to be (re)compiled" error, when redirecting to the GWT-Module
after successful login... At least in Dev-Mode... Besides, that this
is not very elegant, disconnecting the login completely from the
module... I'd rather trigger the GWT-Module somehow to use the native
browser authorization and use the login data afterwards...

PS: I'm using https ;-)


On Oct 16, 2:34 am, Lothar Kimmeringer <j...@kimmeringer.de> wrote:
> "pete" <superp...@geekcity.de> schrieb:
Reply all
Reply to author
Forward
0 new messages