Getekid / cas

A phpBB 3.3.x plugin to enable login with CAS Authentication
2 stars 3 forks source link

No CAS attribute --> so i use username #12

Closed devwald closed 4 years ago

devwald commented 7 years ago

Hello,

Juste to say that in your case, our server CAS doesn't give CAS attribute with (line 161 : getekid/cas/auth/provider/cas.php) so the plugin doesn't work and i have "EMAIL TOO SHORT" after login CAS

$cas_attributes = phpCAS::getAttributes();

so i ajuste the code (line 180 : getekid/cas/auth/provider/cas.php) :

// Get email from CAS attributes //$user_email = ($this->config['cas_register_mail']) ? $cas_attributes[$this->config['cas_register_mail']] : $cas_attributes['mail']; //MODIFICATION RENNES 2 $user_email = $username.'@univ-rennes2.fr';

Regards.

devwald commented 7 years ago

Finally i use my LDAP to have email of the user :

I add this code (line 180 of getekid/cas/auth/provider/cas.php)

// Get email from CAS attributes //$user_email = ($this->config['cas_register_mail']) ? $cas_attributes[$this->config['cas_register_mail']] : $cas_attributes['mail']; //MODIFICATION RENNES 2 $user_email = '';

$ds=ldap_connect("ldap://ldap.xxxxx.fr:389"); // doit être un serveur LDAP valide ! if ($ds) { $r=ldap_bind($ds); // connexion anonyme, typique // pour un accès en lecture seule. // Recherche $sr=ldap_search($ds,"ou=people,dc=xxxx,dc=xxxx,dc=xx", "uid=".$username); $info = ldap_get_entries($ds, $sr); for ($i=0; $i<$info["count"]; $i++) { $user_email = $info[$i]["mail"][0]; } ldap_close($ds);

} else { trigger_error("Impossible de se connecter au serveur LDAP."); }

Getekid commented 7 years ago

Hello, I didn't have time to work on this project before but now I'm getting back to it. Thanks for the issue.

Does your CAS server store your email at all? Is there any other way to call it that I should include? In case it's a different key in the array returned by the getAttributes() function you can always set it in the CAS settings in the ACP.

I can see for sure there is a need for people to be able to edit the data before it is passed to the user. I will add a PHP Event at that point so that people can extend it without having to hack the plugin.

Getekid commented 4 years ago

Not sure why I never closed this one, as mentioned the solution would be to add an event to allow developers to manipulate the CAS attributes once fetched, which is covered in issue #13 .

Therefore closing this one.