Deeplink login

Using Servoy to administrate the content of your website? Discuss all webrelated Servoy topics on this forum!

Re: Deeplink login

Postby Janssenjos » Thu Oct 27, 2011 8:49 am

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.
Jos Janssen
Software Developer
Axerrio
http://www.axerrio.com
Janssenjos
 
Posts: 136
Joined: Thu Aug 13, 2009 3:55 pm
Location: Bergen op Zoom

Re: Deeplink login

Postby mboegem » Thu Oct 27, 2011 10:27 am

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.
_____________________
Marc Boegem
Solutiative / JBS Group, Partner
• Servoy Certified Developer
• Servoy Valued Professional
• Freelance SAN Developer

Image
User avatar
mboegem
 
Posts: 1449
Joined: Sun Oct 14, 2007 1:34 pm
Location: Hoofddorp, The Netherlands

Re: Deeplink login

Postby rogel » Tue Nov 01, 2011 12:40 am

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!
rogel
 
Posts: 264
Joined: Mon Jul 04, 2011 9:09 am

Re: Deeplink login

Postby rogel » Tue Nov 22, 2011 8:27 am

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
rogel
 
Posts: 264
Joined: Mon Jul 04, 2011 9:09 am

Re: Deeplink login

Postby mboegem » Tue Nov 22, 2011 3:52 pm

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...)
_____________________
Marc Boegem
Solutiative / JBS Group, Partner
• Servoy Certified Developer
• Servoy Valued Professional
• Freelance SAN Developer

Image
User avatar
mboegem
 
Posts: 1449
Joined: Sun Oct 14, 2007 1:34 pm
Location: Hoofddorp, The Netherlands

Re: Deeplink login

Postby rogel » Tue Nov 22, 2011 9:39 pm

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?
rogel
 
Posts: 264
Joined: Mon Jul 04, 2011 9:09 am

Re: Deeplink login

Postby mboegem » Tue Nov 22, 2011 11:02 pm

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.
_____________________
Marc Boegem
Solutiative / JBS Group, Partner
• Servoy Certified Developer
• Servoy Valued Professional
• Freelance SAN Developer

Image
User avatar
mboegem
 
Posts: 1449
Joined: Sun Oct 14, 2007 1:34 pm
Location: Hoofddorp, The Netherlands

Re: Deeplink login

Postby ngervasi » Wed Nov 23, 2011 1:37 am



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.
ngervasi
 
Posts: 1475
Joined: Tue Dec 21, 2004 12:47 pm
Location: Arezzo, Italy

Re: Deeplink login

Postby Harjo » Wed Nov 23, 2011 7:11 am

indeed!, use https, or use for example not a password, but an generated UUID-token.....
Harjo Kompagnie
Direct ICT / Servoy Hosting / ServoyCamp
Servoy Certified Developer
Servoy Valued Professional
SAN Developer
User avatar
Harjo
 
Posts: 4290
Joined: Fri Apr 25, 2003 11:42 pm
Location: DEN HAM OV, The Netherlands

Re: Deeplink login

Postby mboegem » Wed Nov 23, 2011 10:14 am

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...)
_____________________
Marc Boegem
Solutiative / JBS Group, Partner
• Servoy Certified Developer
• Servoy Valued Professional
• Freelance SAN Developer

Image
User avatar
mboegem
 
Posts: 1449
Joined: Sun Oct 14, 2007 1:34 pm
Location: Hoofddorp, The Netherlands

Re: Deeplink login

Postby rogel » Wed Nov 23, 2011 9:45 pm

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. :)
rogel
 
Posts: 264
Joined: Mon Jul 04, 2011 9:09 am

Re: Deeplink login

Postby rogel » Mon Nov 28, 2011 8:24 am

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;
}
}
rogel
 
Posts: 264
Joined: Mon Jul 04, 2011 9:09 am

Re: Deeplink login

Postby dpearce » Mon Jul 30, 2012 9:32 pm

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
dpearce
 
Posts: 469
Joined: Sun Dec 03, 2006 11:53 am

Re: Deeplink login

Postby dpearce » Tue Jul 31, 2012 9:23 pm

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.
dpearce
 
Posts: 469
Joined: Sun Dec 03, 2006 11:53 am

Previous

Return to Web Development

Who is online

Users browsing this forum: No registered users and 3 guests

cron