Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Remote Application Platform (RAP) » how to support login + password authentication?
how to support login + password authentication? [message #106635] Sun, 28 September 2008 18:20 Go to next message
David Donohue is currently offline David DonohueFriend
Messages: 104
Registered: July 2009
Senior Member
I would like to do require simple login + password to access my RAP
application. How can I do this?

Apologies if this was explained elsewhere but I cannot find how.

Thanks!
David
Re: how to support login + password authentication? [message #106837 is a reply to message #106635] Mon, 29 September 2008 15:14 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: rherrmann.innoopract.com

David,

I assume that your RAP application is workbench based.

In this case, open a modal shell or a blocking JFace dialog that
asks for the login information and only calls
PlatformUI#createAndRunWorkbench() if a valid user/password was given.


HTH
Rüdiger

David Donohue wrote:
> I would like to do require simple login + password to access my RAP
> application. How can I do this?
>
> Apologies if this was explained elsewhere but I cannot find how.
>
> Thanks!
> David
>
>
Re: how to support login + password authentication? [message #106957 is a reply to message #106837] Mon, 29 September 2008 19:00 Go to previous messageGo to next message
David Donohue is currently offline David DonohueFriend
Messages: 104
Registered: July 2009
Senior Member
Rüdiger,
Yes my app is workbench-based.
The other question is how to detect when the session has expired and show
the login dialog at that time. I found this code snippet to add a
listener. Is this the approach you would recommend?

ISessionStore sessionStore = RWT.getSessionStore();
sessionStore.addSessionStoreListener(new SessionStoreListener() {
public void beforeDestroy(final SessionStoreEvent event){
System.out.println("Session destroyed: " + sessionId);
//show login dialog
}
});

Many thanks!
David Donohue
Re: how to support login + password authentication? [message #106999 is a reply to message #106957] Tue, 30 September 2008 07:25 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: rherrmann.innoopract.com

Hi David,

not sure if I understood right. Once the session has expired, it is
not possible to show a login dialog. As any UI element needs a
session, hence no session, no login dialog.
The listener you mentioned is informed before the session is
destroyed but there is no way to cancel the destruction of the session.
However, upon the next user interaction a new session will be
created and the login dialog in your createUI method would be presented.

HTH
Rüdiger


David Donohue wrote:
> Rüdiger,
> Yes my app is workbench-based.
> The other question is how to detect when the session has expired and
> show the login dialog at that time. I found this code snippet to add a
> listener. Is this the approach you would recommend?
>
> ISessionStore sessionStore = RWT.getSessionStore();
> sessionStore.addSessionStoreListener(new SessionStoreListener() {
> public void beforeDestroy(final SessionStoreEvent event){
> System.out.println("Session destroyed: " + sessionId);
> //show login dialog }
> });
>
> Many thanks!
> David Donohue
>
Re: how to support login + password authentication? [message #107068 is a reply to message #106999] Tue, 30 September 2008 12:37 Go to previous message
David Donohue is currently offline David DonohueFriend
Messages: 104
Registered: July 2009
Senior Member
Rüdiger, That's ver clear, thanks. So for the benefit of others, I
created a LoginAction, which runs a LoginDialog. I then added some code
to my Application.java:

//display login dialog until logged in.
boolean loggedIn = false;
int numberOfAttempts = 0;
while (loggedIn == false && numberOfAttempts <
ALLOWED_NUMBER_OF_LOGIN_ATTEMPTS) {
LoginAction loginAction = new LoginAction(display.getActiveShell());
loginAction.run();
loggedIn = loginAction.wasLoginSuccessful();
numberOfAttempts++;
}

if (loggedIn) {
PlatformUI.createAndRunWorkbench( display, new
ApplicationWorkbenchAdvisor() );
return PlatformUI.RETURN_OK;
} else {
return PlatformUI.RETURN_EMERGENCY_CLOSE;
}
Previous Topic:exception when lauching the rap demo
Next Topic:Activate Menu Item depending on logged-in user
Goto Forum:
  


Current Time: Fri Apr 19 13:02:34 GMT 2024

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

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

Back to the top