Git Product home page Git Product logo

Comments (10)

jfritschi avatar jfritschi commented on September 22, 2024

Please check #195 and test one of our examples https://github.com/apereo/phpCAS/blob/master/docs/examples/example_logout.php

GitHub
Apereo PHP CAS Client. Contribute to apereo/phpCAS development by creating an account on GitHub.

from phpcas.

jfritschi avatar jfritschi commented on September 22, 2024

And also #212

from phpcas.

jfritschi avatar jfritschi commented on September 22, 2024

Typically the connection from the CAS server to the phpCAS service is not working: (flow of the logout signal is from client -> CAS server -> phpCAS service)

  • You need working HTTPS
  • You need a Certificate trusted by the CAS server
  • Your need working network connection/routing/dns between the systems (loadbalancers or network topology may get in the way)

from phpcas.

Cyazd avatar Cyazd commented on September 22, 2024

Thank you for your quick answer.

I doubt it is a HTTPS or certificate issue : the app has worked up to now (before I implemented the central logout feature). Besides when I look at the log files, no error message. Just a :

CD4E .=> CAS_Client::handleLogoutRequests(true, array ()) [CAS.php:1298]
CD4E .| Not a logout request [Client.php:1744]
CD4E .<= ''

Which seems strange because the guy who are managing the CAS server assured me that a logout request was send to my application.

Here's the code for the index.php :

`<?php
require_once 'config.php';
require_once $phpcas_path . '/CAS.php';
phpCAS::client(CAS_VERSION_3_0, $cas_host, $cas_port, $cas_context);
phpCAS::setCasServerCACert($cas_server_ca_cert_path);
phpCAS::handleLogoutRequests();
phpCAS::forceAuthentication();

  if (isset($_REQUEST['logout'])) {
  	phpCAS::logout();
  }
  include 'webapp.php';

?>`

from phpcas.

jfritschi avatar jfritschi commented on September 22, 2024

There is a big difference from a HTTPS certificate working in your browser (with populated trusted certificate authorities) and the certificate being accepted as "trusted" by the java library on the CAS server itself. It's not uncommon for a trust store file of a java installation to be empty....

Ask your CAS admin to check if he sees a connection denied or similar entry in the CAS server logs. Without specific ssl debugging enabled any un-trusted certificate shows up as a connection error.

I have also seen many cases were CAS servers were behind load balancers and could not initiate any outgoing TCP connections or routing/DNS was not working fully. Ask your CAS admin to use any commandline web clients to connect your application (wget, curl...)

You can also use wireshark or any network monitoring to check if any connection is established on your end. If the SSL handshake fails it will not even register in your webserver or phpCAS logs but it would be visible in the network data.

from phpcas.

Cyazd avatar Cyazd commented on September 22, 2024

Thank you very much.

I'll see with the admin then.

from phpcas.

Cyazd avatar Cyazd commented on September 22, 2024

So, I contacted the adminstrator of the CAS server, and the only thing he told me was that he's seeing a logout request sent by the CAS server (image in attachment). And he asked me to see if I received that request on my server.

Not really knowing what I was doing, I did a tcpdump listening to port 443 and I see indeed the logging into my app, and also a request with a F flag when I logout of the CAS server.

Don't know if it is of any help, neither what I'm really supposed to do now...

capture

from phpcas.

jfritschi avatar jfritschi commented on September 22, 2024

Have you checked the debug log of phpCAS? I typically just "tail -f" the debug log and than issue a logout... You can then follow the trace what phpCAS is doing with any incoming request.

If you cannot see anything in the logs the issue is outside of phpCAS....

I can only recommend that you start debugging issues like this with our simple examples to avoid to much complexity. If the session handling is not done by phpCAS itself a logout will only work if configure a custom callback handler to do whatever magic is needed in your application phpCAS::setSingleSignoutCallback()

from phpcas.

Cyazd avatar Cyazd commented on September 22, 2024

Issue has been resolved. Here's what I did :

Using SSLLabs I've tested the SSL certificate. The result was an "Incomplete Certificate". Apparently browser can overcome this issue, but it wasn't the case of the CAS server (or Curl, or Python).

I had to complete the apache ssl.conf file with the SSLCertificateChainFile option.

That being done, I could send a secure POST request with curl and python. But the logout function still wasn't working.

The phpCAS logout file showed that now the logout request was received but the server sending it was different than the one responsible for the login, so I had to add it in the phpCAS::handleLogoutRequest options.

And now, finally, it all works.

Thank you very much for all your help jfritschi (and indeed, as you stated at the beginning, it was a SSL issue) !

from phpcas.

jfritschi avatar jfritschi commented on September 22, 2024

Glad you figured it out!

from phpcas.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.