Topic on Extension talk:LDAP Authentication

Use of $_SESSION['wsDomain'] in LdapAuthentication.php causes problems

3
HermannSchwärzler (talkcontribs)

In my setup the direct use of $_SESSION['wsDomain'] at line 1237 of LdapAuthentication.php causes problems: Im my case there sometimes is a token but the wsDomain-member of the $_SESSION array is not (yet) set.

Looking through the code I came up with this solution:

diff --git a/LdapAuthentication.php b/LdapAuthentication.php
index 44e47d4..462f9c9 100644
--- a/LdapAuthentication.php
+++ b/LdapAuthentication.php
@@ -1234,7 +1234,7 @@ class LdapAuthenticationPlugin extends AuthPlugin {
                # We must set a user option if we want token based logins to work
                if ( $user->getToken( false ) ) {
                        $this->printDebug( "User has a token, setting domain in user options.", NONSENSITIVE );
-                       self::saveDomain( $user, $_SESSION['wsDomain'] );
+                       self::saveDomain( $user, $this->getDomain() );
                }
 
                # Let other extensions update the user

I think this is the correct way of doing it especially after reading the comments in getDomain(). :-)

What do you think?

62.143.213.59 (talkcontribs)

Hi Hermann, You are 100% right - I totally agree with your saying. The $_SESSION['wsDomain'] cannot be use at that moment. It is better to use $this->getDomain()

By doing so the extensions works as expected.

- Michael

206.55.83.201 (talkcontribs)

thanks Michel. It works for me.

Reply to "Use of $_SESSION['wsDomain'] in LdapAuthentication.php causes problems"