Page 2 of 2

Re: Deeplink login

PostPosted: Thu Oct 27, 2011 8:49 am
by Janssenjos
Hi,

We have a deeplink solution with our webclient and our onLoad looks like this:

Code: Select all
function onLoad(event)
{
   //Get the arguments if they are specified
   var args = application.getStartupArguments();   
   
   //read args & rest of code herehere

}


With the application.getStartupArguments() you read the arguments you specified.

Re: Deeplink login

PostPosted: Thu Oct 27, 2011 10:27 am
by mboegem
Janssenjos wrote:We have a deeplink solution with our webclient and our onLoad looks like this:

CODE: SELECT ALL
function onLoad(event)
{
   //Get the arguments if they are specified
   var args = application.getStartupArguments();   
   
   //read args & rest of code herehere

}



Hi Jos,

be careful: getStartupArguments in a webclient is a bit tricky.
If a user opens the solution in a 2nd browsertab (so he/she is opening 2 sessions), I found the getStartupArguments aren't correct for the 2nd session.
So if the arguments you pass are different for each launch, you should really just ask for 'arguments' in the method you call in your deeplink.

Re: Deeplink login

PostPosted: Tue Nov 01, 2011 12:40 am
by rogel
mboegem wrote:
Janssenjos wrote:We have a deeplink solution with our webclient and our onLoad looks like this:

CODE: SELECT ALL
function onLoad(event)
{
   //Get the arguments if they are specified
   var args = application.getStartupArguments();   
   
   //read args & rest of code herehere

}



Hi Jos,

be careful: getStartupArguments in a webclient is a bit tricky.
If a user opens the solution in a 2nd browsertab (so he/she is opening 2 sessions), I found the getStartupArguments aren't correct for the 2nd session.
So if the arguments you pass are different for each launch, you should really just ask for 'arguments' in the method you call in your deeplink.


Hi Marc,

How would I implementation(deeplink URL and "arguments asking") be to address both smart and web client during login?

Thanks!

Re: Deeplink login

PostPosted: Tue Nov 22, 2011 8:27 am
by rogel
Hi Marc,

What do you mean by
Code: Select all
So if the arguments you pass are different for each launch, you should really just ask for 'arguments' in the method you call in your deeplink.


can you site an example? if my deeplink url is
http://x.x.x.x:x/servoy-client/sampledeeplink.jnlp?m=doActionBypassLogin&a=xyz&username=abc&password=123

Re: Deeplink login

PostPosted: Tue Nov 22, 2011 3:52 pm
by mboegem
Hi Rogel,

what I mean is that you should read the arguments in the 'doActionBypassLogin' method.
something like this:
Code: Select all
function doActionBypassLogin()
{
   var _args = arguments;
   // now you can work with the arguments as you like...
}


Don't use the application.getStartupArguments() (which is deprecated in v6 anyway...)

Re: Deeplink login

PostPosted: Tue Nov 22, 2011 9:39 pm
by rogel
mboegem wrote:Hi Rogel,

what I mean is that you should read the arguments in the 'doActionBypassLogin' method.
something like this:
Code: Select all
function doActionBypassLogin()
{
   var _args = arguments;
   // now you can work with the arguments as you like...
}


Don't use the application.getStartupArguments() (which is deprecated in v6 anyway...)


Can you site how the onload method of the login will look like?

Re: Deeplink login

PostPosted: Tue Nov 22, 2011 11:02 pm
by mboegem
not sure if the onOpen method will be fired if a session already exists in another tabpanel.
But it will look more or less the same as I showed you in the other method.

Re: Deeplink login

PostPosted: Wed Nov 23, 2011 1:37 am
by ngervasi


I wouldn't do this anyway, the username and password would travel in clear from the browser to the server, they could be logged by proxies, routers and sniffed by virtually anyone.

Re: Deeplink login

PostPosted: Wed Nov 23, 2011 7:11 am
by Harjo
indeed!, use https, or use for example not a password, but an generated UUID-token.....

Re: Deeplink login

PostPosted: Wed Nov 23, 2011 10:14 am
by mboegem
ngervasi wrote:I wouldn't do this anyway, the username and password would travel in clear from the browser to the server, they could be logged by proxies, routers and sniffed by virtually anyone.
Harjo wrote:indeed!, use https, or use for example not a password, but an generated UUID-token.....


If you use UUID for your user records, you can pass this UUID for example.

I used a UUID myself in a kind of blog-system.
Login to the solution was only validated by the existance of the UUID of a certain blog-item
This case the UUID is different for each deeplink to the solution. (as long as your pointing to different blogrecords...)

Re: Deeplink login

PostPosted: Wed Nov 23, 2011 9:45 pm
by rogel
mboegem wrote:
ngervasi wrote:I wouldn't do this anyway, the username and password would travel in clear from the browser to the server, they could be logged by proxies, routers and sniffed by virtually anyone.
Harjo wrote:indeed!, use https, or use for example not a password, but an generated UUID-token.....


If you use UUID for your user records, you can pass this UUID for example.

I used a UUID myself in a kind of blog-system.
Login to the solution was only validated by the existance of the UUID of a certain blog-item
This case the UUID is different for each deeplink to the solution. (as long as your pointing to different blogrecords...)


Yes, we are using UUID for the username. The password is from the URL is encrypted. I just sited an example. :)

Re: Deeplink login

PostPosted: Mon Nov 28, 2011 8:24 am
by rogel
It is still not working. :( What I am missing?

I would need to call processBackup after a successful login using the parameters passed from the deeplink.

This is how I did it
smart client deeplink url [url]http://localhost:8080/servoy-client/backuprestore.jnlp?m=start_autobackup&a=c:\dbbackup&username=B33BCB08-C4B3-4197-A57F-C924128D5AF4&password=qwerty[/url]

in solution backuprestore
loginSolutionName = login
mustauthenticate=unchecked
solution onopen = globals.backuprestore_onopen(event)
create start_autobackup in globals.js
Code: Select all
function start_autobackup()
{
   application.output("start_autobackup")
}

function processBackup() {
}


in login solution
mustauthenticate=checked
onload form login, assign onLoadBypassLogin(event) found in login.js
Code: Select all
function onLoadBypassLogin(event) {
   application.output("onLoadBypassLogin");
   var _arg0 = arguments[0]
   application.output(_arg0)
   var param1 = arguments[1]['username']
   var param2 = arguments[1]['password]
   application.output("param1="+param1)
   application.output("param2="+param2)
if(security.authenticate(LGN_SOLUTION, LGN_METHOD_LOGIN, [param1, param2)])) {
        return true;
}
}

Re: Deeplink login

PostPosted: Mon Jul 30, 2012 9:32 pm
by dpearce
Very Confusing!

Can I ask a simple question about this deeplinking with advanced security:

if i link to http://{url}/ss/s/mysolution/a/myargument

and i have a login solution call my solution_login, which is a module of my solution with advanced security.

then will the onOpen method of the login solution return

application.output(arguments[0]) as 'myargument' ??

In order to restore a webclient deeplink, I am finding it hard to get to first base, which appears to be the need to have my argument passed into the Login modules onOpen. It wont go to the solution onOpen as this is only triggered after login!

All help appreciated.

David

Re: Deeplink login

PostPosted: Tue Jul 31, 2012 9:23 pm
by dpearce
Solved!

Simple guidance for anyone else trying this in Servoy 6.

1. You must not use a method simply a single argument (but can split it with a eliminator:
http://www.yoursite.com/servoy-webclien ... -argument2 (I use -!- as a deliminator as no one would be stupid enough to put that in a normal sentance!)

2. This argument is received by the Login module in your advanced security solution in the onOpen method

Code: Select all
function CxLogin_onSolutionOpen(arguments) {
   
   if (arguments){
   var args=arguments.split('-!-')
   globals.login_username=args[0]
   globals.login_password=args[1]
      //This runs a login from deeplink - used to process corex local cases
      application.output(globals.login_username+ ' '+globals.login_password)
      forms.login.bypasslogin();
      
   }
}


3. I have used a method on my login form to bypass the normal login script as I was using this from another solution and didn't want to see a visual output. If you wanted to login then there would be nom harm in actually triggering your normal login method as you have pre-populated in this case the username and password.

4. Following that the onOpen method of your main solution will then be triggered as normal.