By andjsmit on
Hello,
I'm having some trouble getting the CAS module to work. First, the phpCAS package had to be altered to fit our attribute naming convention. Second, line 50 of the cas.php which calls variable_get() was changed to include a second required parameter set to localhost. (This is mentioned in the module's bug report). Now, I think I'm really close, but here is my current problem:
On first login, the Cas module seems to work fine. The user is created and logged in. The correct user name appears. However, on logging in for a second time, the following error message is displayed;
* user warning: Duplicate entry '***' for key 2 query: INSERT INTO users (name, pass, init, status, mail, created, uid) VALUES ('***', '***', '***', 1, '***', 1158928882, 17) in /home/drupal/www/includes/database.mysql.inc on line 120.
* warning: array_keys() [function.array-keys]: The first argument should be an array in /home/drupal/www/modules/user.module on line 351.
* warning: implode() [function.implode]: Bad arguments. in /home/drupal/www/modules/user.module on line 351.
* user warning: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ')' at line 1 query: SELECT DISTINCT(p.perm) FROM role r INNER JOIN permission p ON p.rid = r.rid WHERE r.rid IN () in /home/drupal/www/includes/database.mysql.inc on line 120.
Has anyone ran into this before and might offer some advice?
Thanks.
Comments
Problem is in the user_save function?
Well, I have made some progress. I have tracked the problem down to records not being created in the {authmaps} table, only the {users} table. Both these records should be generated in the user.module's user_save function. I was able to get around this by replacing the user_external_load function used by the CAS.module with a function that checks for the user name in the {users} table. A temporary patch, I hope. Does anyone know why the user_set_authmaps function as called from the save_user function (both in user.module} might fail with out notice?
Thanks for any help.
Final solution
After tracking down how the user_set_authmaps function in the user.module works, I see that the CAS.module is not sending any information to it. Only Key/Value pairs with the key beginning with auth_ are sent to user_set_authmaps. So I added the following line in the CAS.module while defining the $user_default array ~line45:
auth_cas=>$cas_nameSeems to do the trick. I am now able to use the original user_external_load function, so no code changes are needed in the user.module.
Would be glad to hear, from someone who might have a different solution or better explanation.
similar problem
I'm having this problem also, and i'm using the CAS module. A user logs in for the first time- CAS creates the new user alright but gives errors of this manner:
No such errors on subsequent logins. Any ideas?
I have same problem with Sean2000
I have same problem with sean2000. Thing is that it was working perfectly fine, and for some strange reasons, now this... If I find some solutions, I'll post it, but I could use some advice or ideas, also.
I solved my problem
When I set up cas, it will give me error message that is just like sean2000. Thins occurred because user was not entered into DB and drupal was try to look for this individual in DB who was trying to login through CAS. I did get this error message if user already exists in local DB then CAS authentication is successful.
I've searched high and low for solution to this problem, and I finally found what I did that caused this issue. I checked "Only site administrators can create new user accounts." in user settings. It makes sense, since CAS is trying to create a user account without being administrator. When I checked "Visitors can create accounts and no administrator approval is required.” I could login using CAS without problems. Now I just have to make sure there isn’t back way registration without CAS...
thanks for the suggestion,
thanks for the suggestion, but I do have "Visitors can create accounts and no administrator approval is required." checked and am still getting those errors.. if anyone manages to get to the root of the problem and share that here.. i would be very grateful.. thanks.
This worked for me...
Thanks msito.... This cured a problem discovered yesterday on a test site. I had the "Vistors can creat accounts and but administrator approval is required" This caused the same error. I'm curios about closing all back doors as well.
Also, I noticed that a new update was released yesterday that might be of interest.
Slightly Different
My problem is exactly the opposite. Drupal forwards me (the user) to my CAS authentication page on the CAS server, I am able to log in, I get a page on my CAS server that says "Log In Successful" but it doesn't create a new user in Drupal, and it doesn't forward me back to my site. When I go back to my site manually, I still can't get into the "CAS"-ified pages, for when I try to go there, it once again forwards me to my CAS server. At this point, my CAS server knows that I'm already logged in, so it immediately gives me th "Log In Successful" page.
I've tried this on a fresh install of Drupal 4.7.4 and CAS-4.7 (8/16/06) as well on a fresh install of Drupal 5.0b2 with CAS-HEAD (11/11/2006), and I have gotten the same result.
Do I also have to hack my CAS.php file?
SD
same as "slightly different" one
I have the same problem as the "slightly different" one. CAS does not take me back to my site. Seems some kind of disconnections between my drupal site and the CAS. Any idea? Many thanks.