Getekid / cas

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

phpCAS error with phpBB 3.2 #10

Closed devwald closed 7 years ago

devwald commented 7 years ago

Hello,

I test this plugin with phpBB 3.2 I have this error when i want login with CAS :

phpCAS error: phpCAS::setFixedServiceURL(): this method should only be called after phpCAS::proxy() in /var/www/phpBB3/ext/getekid/cas/auth/provider/cas.php on line 154

Any idea ?

Thanks.

Getekid commented 7 years ago

Hello,

I'll have to look at this to be sure, can you comment out that line and try again? I can provide a patch at some point if needed.

In general the extention isn't using the phpCAS::proxy() so this line should be removed, but it needs testing.

Thank you

devwald commented 7 years ago

Hello,

If i comment only this line i have the same error with another line (157, 159 and 160)

But if i comment line 154, 157, 159 and 160 there is no CAS authentification.

Any idea ?

Thanks

capture d ecran 2017-02-15 a 14 30 47 capture d ecran 2017-02-15 a 14 28 11

Getekid commented 7 years ago

I think I found the issue, are you sure that in your CAS settings you have no URI? The plugin assumes there should be one.

If so, then remove the && $this->config['cas_uri'] part from line 71, in other words the line should be

if ($this->config['cas_host'] && $this->config['cas_port'])

Let me know if it works as that would mean I need to change it.

Thanks again

devwald commented 7 years ago

Yes, i don't have URI Now, i have this error :

[phpBB Debug] PHP Warning: in file [ROOT]/ext/getekid/cas/auth/provider/CAS-1.3.4/CAS/Client.php on line 3167: DOMDocument::loadXML(): Empty string supplied as input CAS Authentication failed!

You were not authenticated.

You may submit your request again by clicking here.

If the problem persists, you may contact the administrator of this site. Fatal error: Uncaught exception 'CAS_AuthenticationException' in /var/www/phpBB3/ext/getekid/cas/auth/provider/CAS-1.3.4/CAS/Client.php:3169 Stack trace: #0 /var/www/phpBB3/ext/getekid/cas/auth/provider/CAS-1.3.4/CAS/Client.php(1419): CAS_Client->validateCAS20('https://cas.uhb...', '', NULL, false) #1 /var/www/phpBB3/ext/getekid/cas/auth/provider/CAS-1.3.4/CAS/Client.php(1249): CAS_Client->isAuthenticated() #2 /var/www/phpBB3/ext/getekid/cas/auth/provider/CAS-1.3.4/CAS.php(1080): CAS_Client->forceAuthentication() #3 /var/www/phpBB3/ext/getekid/cas/auth/provider/cas.php(158): phpCAS::forceAuthentication() #4 /var/www/phpBB3/phpbb/auth/auth.php(939): getekid\cas\auth\provider\cas->login('', '') #5 /var/www/phpBB3/ext/getekid/cas/event/cas_login_listener.php(74): phpbb\auth\auth->login('', '') #6 [internal function]: getekid\cas\event\cas_login_listener->login_after_cas_redirect(Object(phpbb\event\data), 'core.update_ses...', Object(phpbb\event\dispatcher)) #7 /var/www/phpBB3/vendor/symfony/event-dispatcher/EventDispatcher.p in /var/www/phpBB3/ext/getekid/cas/auth/provider/CAS-1.3.4/CAS/Client.php on line 3169

PS : now, i'm using version 1.3.4 of phpCAS to do this test

Getekid commented 7 years ago

Try to rename the folder "CAS-1.3.4" to "CAS" and it will work, it's the Step 3 in the Guidelines.

devwald commented 7 years ago

It's a symbolic link :

root@v-dev-fw:/var/www/phpBB3/ext/getekid/cas/auth/provider# ls -alrt total 28 drwxr-xr-x 3 root root 4096 Feb 15 11:24 .. drwxr-xr-x 3 root root 4096 Feb 15 14:15 CAS-OLD lrwxrwxrwx 1 root root 9 Feb 15 14:55 CAS -> CAS-1.3.4 drwxr-xr-x 4 root root 4096 Feb 15 15:06 CAS-1.3.4 -rw-r--r-- 1 root root 10058 Feb 15 15:08 cas.php drwxr-xr-x 4 root root 4096 Feb 15 15:09 .

devwald commented 7 years ago

It's OK with version 1.3.0 of PHPCAS and when i put "/" in CAS URI capture d ecran 2017-02-15 a 15 21 04

Thanks.

devwald commented 7 years ago

t's OK also with version 1.3.4 of PHPCAS and when i put CAS VERSION 2 (in reality we have CAS VERSION 3) capture d ecran 2017-02-15 a 15 29 45

So you can close this issue.

Thanks.

Getekid commented 7 years ago

Apologies, I should have looked at the error more closely.

Great to see it works. I was about to suggest this, can you verify it also works with 1.3.4. ? Also maybe line 154 is not needed out any more.

Thanks

devwald commented 7 years ago

Yes. Cf. https://github.com/Getekid/phpbb3-CAS-Auth-plugin/issues/10#issuecomment-280025725

Getekid commented 7 years ago

Needing version 2 is unexpected as the validation error function is the same for 2 and 3. But good to see it works.

This topic has been a bit off, the original issue was about an error with phpBB 3.2.x but it turned out to be independent. I opened another issue for the URI to be / by default, #11 , therefore this one can close.

Best