Page 1 of 1

PWB CEF Autologin to a Site

Posted: Wed Oct 28, 2020 9:29 am
by mjbaraymond
Hello,

I've been asked to configure our public kiosks to automatically log in to our portal site with a special elevated public user account, but we also need to clear browser cookies after each session. We also can't expose the password to the public.

I'm looking at ways I might accomplish this, such as AutoHotkey. Does anyone have any suggestions?

Re: PWB CEF Autologin to a Site

Posted: Wed Oct 28, 2020 2:56 pm
by Scott
Is it just a normal login with an HTML post form a form?

What is the URL of the page?

--Scott

Re: PWB CEF Autologin to a Site

Posted: Thu Oct 29, 2020 6:44 am
by mjbaraymond

Re: PWB CEF Autologin to a Site

Posted: Thu Oct 29, 2020 11:34 am
by Scott
We can add an after page load URL filter that can run a JavaScript from a text file.

Text File:
document.getElementById('username').value='nameTest';
document.getElementById('password').value='passwordTest';
document.forms[0].submit();

Once the page is loaded, if the URL filter matched the URL the above JavaScript from file is executed on the page and fills in the user name and password and submits the form.

--Scott

Re: PWB CEF Autologin to a Site

Posted: Thu Oct 29, 2020 12:12 pm
by mjbaraymond
Thanks Scott,

Where in the ini file is the after page load URL filter defined? I'm assuming there's a key for the filter file with the URL(s) and another for the javascript file that should run, similar to how I've set up the access filter?

Re: PWB CEF Autologin to a Site

Posted: Thu Oct 29, 2020 12:24 pm
by Scott
It is not in the INI file yet. I was proposing we could program the functionary into PWB. :D

If you think it will work, it will take a few days to program it into PWB 3.05.9.

--Scott

Re: PWB CEF Autologin to a Site

Posted: Thu Oct 29, 2020 12:26 pm
by mjbaraymond
Oh, I'd misunderstood... That's awesome!

Yes, I think that'd be exactly what we'd need and a lot better than the hacky solutions I've been working on. It'd be greatly appreciated if you could!

Re: PWB CEF Autologin to a Site

Posted: Thu Oct 29, 2020 12:30 pm
by Scott
The proposed functionality seemed good to have so we are already working on it. Hopefully we will have it incorporated by early next week.

--Scott

Re: PWB CEF Autologin to a Site

Posted: Fri Oct 30, 2020 12:31 pm
by Scott
PWB 3.05.9 CEF Release Candidate 1 is now available on the Beta Downloads page.

This version contains the following functionality. The following need to be added/modified in the INI file.

[Secuity]CheckJavaScriptAccess=False
[Files]JavaScriptFilterFile=


Enabling the filter for JavaScript access will have PWB read the JavaScript filter file. The JavaScript filter works similar to the URL filter with the added functionality of running a JavaScript from a different file.

The filter file is a tab separated +/-URL and JavaScript file.

For example:

Code: Select all

-all
+https://odysseyidentityprovider.tylerhost.net/idp/account/signin?ReturnUrl=          signin.txt
If the filter matches PWB will run the JavaScript found in "signin.txt" on the page.

Careful if the JavaScript causes the page to be reloaded it could cause an infinite loop.

--Scott

Re: PWB CEF Autologin to a Site

Posted: Fri Oct 30, 2020 12:40 pm
by Scott
See attached files for an example.

[Files]
JavaScriptFilterFile=signinfilter.txt

[Security]
CheckJavaScriptAccess=True

--Scott

Re: PWB CEF Autologin to a Site

Posted: Fri Oct 30, 2020 2:05 pm
by mjbaraymond
Thanks Scott!

I had time to do some quick testing, and it doesn't seem to be firing after updating my ini and pointing it at those files. The javascript works perfectly though if I send it through the dev console in Chrome. I also created a filter for this forum and a javascript text file to attempt login as me, and I can't seem to get the javascript to trigger there either.

Is there any way to debug that? It's entirely possible I missed or typo'd something that I'll see when I pick this back up on Monday.

Re: PWB CEF Autologin to a Site

Posted: Sat Oct 31, 2020 2:38 pm
by Scott
Are you using version 3.05.9 from the Beta Downloads page?

To see if the filter is finding the URL use the History file.

[Security]
WriteHistoryFile=True
LogAccess=True

History file tokens:
https://www.teamsoftwaresolutions.com/f ... ?f=4&t=195

--Scott

Re: PWB CEF Autologin to a Site

Posted: Mon Nov 02, 2020 8:20 am
by mjbaraymond
It was a typo! Had the wrong case on an element id.

Works great, this is just what we needed. Thank you!

Re: PWB CEF Autologin to a Site

Posted: Mon Nov 02, 2020 5:05 pm
by Scott
PWB 3.05.9 should be released this week. We are just waiting on one more sign off.

--Scott

Re: PWB CEF Autologin to a Site

Posted: Tue Jul 05, 2022 12:01 pm
by Scott