Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » scout » How to extend the LoginDialog(Passing additional parameters or branding the dialog)
How to extend the LoginDialog [message #1011836] Wed, 20 February 2013 10:38 Go to next message
Urs Beeli is currently offline Urs Beeli
Messages: 330
Registered: October 2012
Location: Bern, Switzerland
Senior Member
In the thread at http://www.eclipse.org/forums/index.php/mv/msg/454525/1010781/#msg_1010781 I explored the possibilities of authenticating against LDAP.

As that is now working, I'm taking things a bit further with two motivations:

  • We might like to brand the LoginDialog to show a logo or some additional text
  • In our current applications, the users have the possibility to specify additional parameters (that are used when authenticating them but also later on (like overriding the default language))


I was looking into how to do that. As to passing additional input that is relevant to authentication to the server, I thought that I could tack that onto the HttpRquest's header as an additional parameter after the username and password, extracting that information in MySecurityFilter.negotiate() would be trivial. The "only" question that remained was how and where to add this information to the header.

Looking at the LoginDialog class I saw that it shouldn't be to hard to add additional elements to the dialog (both decorative like logos and text as well as interactive for additional settings).

I also saw where in InternalAuthenticator.getPasswordAuthentication I could then read these values from the LoginDialog. However, it seems that even if I were to somehow modify InternalAuthenticator, InternalEclipseAuthenticator and EclipseAuthenticator so that I could pass back additional parameters, in the end these are all called from java.net.Authenticator.requestPasswordAuthentication() which I don't see how I could modify it.

So I guess I my first question is:

  • is there any way to pass additional parameters back to the server through the HttpRequest from the LoginDialog?


Even if I can't pass additional parameters, I would still like to brand the LoginDialog. And here comes my second question:

  • How would I replace org.eclipse.scout.rt.ui.swt.login.internal with my own implementation?
Re: How to extend the LoginDialog [message #1013893 is a reply to message #1011836] Sun, 24 February 2013 16:24 Go to previous messageGo to next message
Beat Schwarzentrub is currently offline Beat Schwarzentrub
Messages: 43
Registered: November 2010
Member
Urs,

I think you just have to implement your own Authenticator class if you want to customize the login dialog. The Authenticator concept is not specific to Scout, so you might find information about this on Oracle's website or other resources on the Internet. The starting point in a Scout application is the class org.eclipse.scout.net.NetActivator which is usually installed at a very early stage of the client startup.

Beat
Re: How to extend the LoginDialog [message #1014115 is a reply to message #1013893] Mon, 25 February 2013 07:36 Go to previous message
Urs Beeli is currently offline Urs Beeli
Messages: 330
Registered: October 2012
Location: Bern, Switzerland
Senior Member
Thanks Beat

While waiting for an answer here I did some more research based on the information in http://wiki.eclipse.org/Scout/Concepts/Security, namely
Quote:
This can be easily overwritten by registering an OSGi service with the name java.net.Authenticator and a ranking higher than -2. Alternatively, you can register an extension to the Eclipse extension point org.eclipse.core.net.authenticator that contains your custom java.net.Authenticator.


Based on this, I've been able to create my own ExtendedNetAuthenticator, ExtendedLoginDialog, ExtendedAuthStatus and ExtendedSecurePreferences classes. I now have a login dialog that shows the desired icons in the title bar and the form and includes three radio button groups to select various additional configuration values. I've also managed to store the last selection in my ExtendedSecurePreferences between login attempts.

However, I'm still stuck on two things:
Passing information to the client
Two of the settings the user chooses with the radio buttons is relevant to the client operation later on. I'm currently using
ClientSession.get().setParameterX(status.getParameterX());
to pass these values. Is this safe to do?

Passing information to the server
One of the parameters is relevant for the SecurityFilter that will check the credentials (it influences which LDAP server to check the credentials against (test or production)). How do I forward this information back to the security filter?
I was hoping to add this to the HttpRequest's header information (same as username and password). However, it seems that this is not done by the NetAuthenticator (which only returns a PasswordAuthentication object) to java.net.Authenticator which in turn returns it to sun.net.www.protocol.http.HttpUrlConnection. Is there a way to extend even these two classes? Or is there a way to access the HttpRequest's header from my ExtendedNetAuthenticator class?
The only other thing I could think of was to add this additional information to either the username or password and then extracting this explicitely in the SecurityFilter (say using a name=value;name=value approach).

Can anyone think of a more elegant or even canonical way of doing this that I'm missing?
Previous Topic:New scout plugin and settings
Next Topic:Modifying table behaviour
Goto Forum:
  


Current Time: Fri Sep 19 06:11:23 GMT 2014

Powered by FUDForum. Page generated in 0.01758 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software