DMXzone Security Provider PHP Support Product Page

Answered

Authentication not working - SqlBuilder problem

Asked 10 Oct 2016 09:10:54
1
has this question
10 Oct 2016 09:10:54 David Woolley posted:
I'm using a table 'users' to authenticate with the Bootstrap Modal Dialog, but getting an 'Invalid Username/Password' error message.

Network in Chrome Dev Tools reports the following error:

[b]Fatal error[/b]:  Class 'lib\auth\SqlBuilder' not found in [b]C:\xampp\htdocs\digipath2015\dmxConnectLib\lib\auth\DatabaseProvider.php[/b] on line [b]22[/b]<br />
{"code":1,"file":"C:\\xampp\\htdocs\\digipath2015\\dmxConnectLib\\lib\\auth\\DatabaseProvider.php","line":22,"message":"Class 'lib\\auth\\SqlBuilder' not found"}


If I select the Single User Type in the Server Connect Security Provider action, then it authenticates properly, so just a problem with the database table 'users' not being recognized.

DWCS6
W10
DMXzone Ext Manager up to date
Links relative to Document

Replies

Replied 11 Oct 2016 10:47:44
11 Oct 2016 10:47:44 David Woolley replied:
Any suggestions?
I can't move forward with securing all my pages, until this is sorted.
Dave
Replied 11 Oct 2016 11:00:17
11 Oct 2016 11:00:17 Teodor Kuduschiev replied:
Hello David,
Bootstrap Modal method is no longer supported and will soon be removed from the extension. Please use a custom form in order to log users in, as explained in the tutorials:
www.dmxzone.com/go/32338/filtering-a-database-query-using-the-identity-of-the-logged-in-user
www.dmxzone.com/go/32197/restricting-access-to-pages
Replied 11 Oct 2016 12:16:08
11 Oct 2016 12:16:08 David Woolley replied:
Hi Teodor

I really like the Bootstrap Modal form - I suppose I could create my own with Bootstrap Components or Lightbox. Is that feasable?

Is this video still valid?
www.dmxzone.com/go/32196/database-security-provider-and-permissions

www.dmxzone.com/go/32197/restricting-access-to-pages
follows on from the permissions video above.

I think you should remove the Security Provider videos that don't apply anymore, especially the ones from a couple of years ago before Server Connect was released. Otherwise it's quite confusing. I've only been following the most recent 4 videos on the list, but some people may not realize.

Dave

Replied 11 Oct 2016 17:27:32
11 Oct 2016 17:27:32 David Woolley replied:
I've done what you suggest, following the 2 videos.
Here's how I set it up:

Created a custom form on the login page: login.php

Server Connect:
Imported form to globals $_POST.username & $_POST.pwd
Added DB Connection
Added a Security Provider 'loginSec' using database option, checked DB Users Source options without any permissions
Added a Security Login using $_POST.username & $_POST.pwd
Linked Security Provider then saved the action 'Login'

Data Bindings:
Created a Server Connect Action Executor 'loginUser'
Form Submit
Server Action: 'Login'
loginForm
POST
Options > Behaviors > onSuccess > Go To URL > landing_page.php

landing_page.php:
Site > Security Provider Enforcer
+ Restrict Access with Security Provider
Security Provider: 'loginSec'

then After Restrict pages x2

Still a problem logging in, so I debugged with Chrome Dev Tools
Same error as previously reported:


<b>Fatal error</b>:  Class 'lib\auth\SqlBuilder' not found in <b>C:\xampp\htdocs\digipath2015\dmxConnectLib\lib\auth\DatabaseProvider.php</b> on line <b>22</b><br />
{"code":1,"file":"C:\\xampp\\htdocs\\digipath2015\\dmxConnectLib\\lib\\auth\\DatabaseProvider.php","line":22,"message":"Class 'lib\\auth\\SqlBuilder' not found"}


So it looks like it's not related to the Bootstrap Modal Form method that I used originally.

Single User method works fine with a Bootstrap Modal Form as I mentioned in the first post in this thread.

Dave


Replied 12 Oct 2016 08:56:29
12 Oct 2016 08:56:29 Teodor Kuduschiev replied:
I believe your dmxConnectLib\lib\auth\DatabaseProvider.php file is an old version. Please remove this file locally, make sure you have the latest security provider installed and then SAVE your action file, so it can generate the new dmxConnectLib\lib\auth\DatabaseProvider.php file. then upload it to your server.
Replied 12 Oct 2016 11:08:37
12 Oct 2016 11:08:37 David Woolley replied:
Hi Teodor
Not quite there yet!
After doing as you suggested, I'm now getting a 401 Unauthorized error in Chrome dev tools on: dmxConnect/api/Security/Login.php where /Security/ is a folder in the server actions.

I tried removing the enforcer code from landing_page.php, but same error.

Should I try uninstalling the DB Security Provider extension then reinstall?

Dave

Replied 12 Oct 2016 12:13:18
12 Oct 2016 12:13:18 Teodor Kuduschiev replied:
Please try removing the whole dmxconnectLib folder, and save your action file, then upload the newly generated dmxConnectLib folder to your server.
Replied 12 Oct 2016 12:52:06
12 Oct 2016 12:52:06 David Woolley replied:
Removed the dmxConnectLib folder
No change - still get the 401 Unauthorized error

By the way I'm testing on local XAMPP.

Could it be a DW CS6 problem?
I had another issue with the Validation Data action to check if a record exists - just gives a grey screen.
https://www.dmxzone.com/support/32315/topic/61521
You thought that could be a DW CS6 problem.

Dave
Replied 12 Oct 2016 13:06:53
12 Oct 2016 13:06:53 Teodor Kuduschiev replied:
No, the login is not CS6 related - when exactly do you see this unauthorized error?
Replied 12 Oct 2016 13:21:06
12 Oct 2016 13:21:06 David Woolley replied:
As soon as I click the Login button
Chrome dev tools console reports:
jquery-latest.pack.js:4 POST localhost/digipath2015/dmxConnect/api/Security/Login.php 401 (Unauthorized)
Replied 12 Oct 2016 14:04:50
12 Oct 2016 14:04:50 Teodor Kuduschiev replied:
Then there is something wrong with your database users setup, please double check it.
Replied 12 Oct 2016 15:00:16
12 Oct 2016 15:00:16 David Woolley replied:
Nothing wrong with my list of users - just created a page to display the list using a simple query & executor.
Replied 12 Oct 2016 15:13:53
12 Oct 2016 15:13:53 Teodor Kuduschiev replied:
I am not referring to your list of users, but to the setup of the security provider. Please check the selected id/user/pass column etc. in the security provider step and reapply it.
Replied 12 Oct 2016 15:34:30
12 Oct 2016 15:34:30 David Woolley replied:
Security Provider options are fine - I've checked that many times just in case.
Then I removed the security provider then created a new one with same options for id/username/pwd
Still not working - same error

I see in the video that the Security Login step has a {{$_POST.remember}} entered even though there's no checkbox for this on the form. So this should be left blank - not so?

Dave
Replied 12 Oct 2016 16:03:07
12 Oct 2016 16:03:07 Teodor Kuduschiev replied:
The remember me checkbox is not related to this error. Please provide a link to your page, with the login details to
Replied 13 Oct 2016 10:31:25
13 Oct 2016 10:31:25 David Woolley replied:
Things are looking up!
I've managed to get it working using a Bootstrap Modal form with the same server action above, but using the Security Provider Executor instead of a Server Connect Action Executor.
A custom form does not work with the Security Provider Executor, as one can't select the form ID.
But you say the Bootstrap Modal form is deprecated and will be removed soon, so I should get the login working with a Server Connect Action Executor.

I've tried putting the site on a remote server for you to view, but unfortunately I can only access it via VPN. I'll try to get the hosting service to relax the security.
Replied 18 Oct 2016 19:43:26
18 Oct 2016 19:43:26 David Woolley replied:
I've got it all working now using the Server Connect Action Executor method in the latest video - logging in, logging out & restricting access based on user role, so no need to troubleshoot further.
Thanks
Dave

Reply to this topic