PWB CEF Autologin to a Site

Questions and comments about currently under development PWB v3

Moderators: Tyler, Scott

Post Reply
mjbaraymond
Observer
Observer
Posts: 6
Joined: Tue Sep 15, 2020 1:50 pm

PWB CEF Autologin to a Site

Post 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?

Scott
Site Admin
Site Admin
Posts: 2527
Joined: Mon Dec 16, 2002 12:31 pm
Location: Rochester, MN
Contact:

Re: PWB CEF Autologin to a Site

Post by Scott »

Is it just a normal login with an HTML post form a form?

What is the URL of the page?

--Scott

mjbaraymond
Observer
Observer
Posts: 6
Joined: Tue Sep 15, 2020 1:50 pm

Re: PWB CEF Autologin to a Site

Post by mjbaraymond »


Scott
Site Admin
Site Admin
Posts: 2527
Joined: Mon Dec 16, 2002 12:31 pm
Location: Rochester, MN
Contact:

Re: PWB CEF Autologin to a Site

Post 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

mjbaraymond
Observer
Observer
Posts: 6
Joined: Tue Sep 15, 2020 1:50 pm

Re: PWB CEF Autologin to a Site

Post 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?

Scott
Site Admin
Site Admin
Posts: 2527
Joined: Mon Dec 16, 2002 12:31 pm
Location: Rochester, MN
Contact:

Re: PWB CEF Autologin to a Site

Post 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

mjbaraymond
Observer
Observer
Posts: 6
Joined: Tue Sep 15, 2020 1:50 pm

Re: PWB CEF Autologin to a Site

Post 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!

Scott
Site Admin
Site Admin
Posts: 2527
Joined: Mon Dec 16, 2002 12:31 pm
Location: Rochester, MN
Contact:

Re: PWB CEF Autologin to a Site

Post 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

Scott
Site Admin
Site Admin
Posts: 2527
Joined: Mon Dec 16, 2002 12:31 pm
Location: Rochester, MN
Contact:

Re: PWB CEF Autologin to a Site

Post 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

Scott
Site Admin
Site Admin
Posts: 2527
Joined: Mon Dec 16, 2002 12:31 pm
Location: Rochester, MN
Contact:

Re: PWB CEF Autologin to a Site

Post by Scott »

See attached files for an example.

[Files]
JavaScriptFilterFile=signinfilter.txt

[Security]
CheckJavaScriptAccess=True

--Scott
Attachments
signinjavascript.txt
(166 Bytes) Downloaded 1154 times
signinfilter.txt
(67 Bytes) Downloaded 1192 times

mjbaraymond
Observer
Observer
Posts: 6
Joined: Tue Sep 15, 2020 1:50 pm

Re: PWB CEF Autologin to a Site

Post 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.

Scott
Site Admin
Site Admin
Posts: 2527
Joined: Mon Dec 16, 2002 12:31 pm
Location: Rochester, MN
Contact:

Re: PWB CEF Autologin to a Site

Post 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

mjbaraymond
Observer
Observer
Posts: 6
Joined: Tue Sep 15, 2020 1:50 pm

Re: PWB CEF Autologin to a Site

Post by mjbaraymond »

It was a typo! Had the wrong case on an element id.

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

Scott
Site Admin
Site Admin
Posts: 2527
Joined: Mon Dec 16, 2002 12:31 pm
Location: Rochester, MN
Contact:

Re: PWB CEF Autologin to a Site

Post by Scott »

PWB 3.05.9 should be released this week. We are just waiting on one more sign off.

--Scott

Scott
Site Admin
Site Admin
Posts: 2527
Joined: Mon Dec 16, 2002 12:31 pm
Location: Rochester, MN
Contact:

Re: PWB CEF Autologin to a Site

Post by Scott »


Post Reply