• Resolved eamallory

    (@eamallory)


    Hello we are testing CAS 6.3.4 and we’re getting the following error after authenticating via CAS. Please advise.
    Warning: Cannot modify header information – headers already sent by (output started at /data/wp/content/html/comm306/wp-content/plugins/authorizer/vendor/apereo/phpcas/source/CAS/Client.php:80) in /data/wp/content/html/comm306/wp-content/plugins/authorizer/vendor/apereo/phpcas/source/CAS/Client.php on line 1700

Viewing 6 replies - 1 through 6 (of 6 total)
  • Plugin Author Paul Ryan

    (@figureone)

    Usually this is caused by logging error messages to the client too early in the WordPress flow. Once you output anything from PHP, it triggers the sending of any queued http headers, and from that point forward you can no longer write any more headers. See the note in PHP docs:

    Remember that header() must be called before any actual output is sent, either by normal HTML tags, blank lines in a file, or from PHP. It is a very common error to read code with include, or require, functions, or another file access function, and have spaces or empty lines that are output before header() is called. The same problem exists when using a single PHP/HTML file.

    https://www.php.net/manual/en/function.header.php

    If you are using WP_DEBUG, ensure that you also have define( 'WP_DEBUG_DISPLAY', false); so that your logging goes to web server logs and not the client. If you are manually logging, ensure the same: do not echo output to the client, but write to web server logs instead.

    Thread Starter eamallory

    (@eamallory)

    Paul,
    Thanks for getting back to me.
    I checked all the debug settings in WP and in the php server settings. and still I get this error.
    files checked
    /etc/php.ini
    /etc/php-fpm.d/www.conf
    <site>/.user.ini

    I grepped for display_errors in the webroot
    I commented out any reference to WP_DEBUG and WP_DEBUG_DISPLAY
    I also configured one of our lightly used prod sites with this cas server, the behavior is different, I was able to authenticate, and then authorizer kicked me back to the cas server and killed my session.
    Right now authorizer/phpcas is the only app not working with this cas version.
    I’ll keep digging, let me know if you have any ideas.
    Thanks
    Erik

    Plugin Author Paul Ryan

    (@figureone)

    I’d try 2 things:
    * In Authorizer settings, check to see if CAS server protocol version matches what is running on your CAS server (or just try all the options to see if one works). I would assume this is SAML 1.1, but check to be sure.
    * try running Authorizer on “vanilla” WordPress (no other plugins activated, and one of the default twenty* themes provided with WordPress as the active theme) and see if the problem persists. If not, try enabling other plugins/themes one at a time to see which one might be outputting content to the client during the login process.

    Since phpCAS is provided is provided by the same folks that develop the CAS server, there shouldn’t be any incompatibilities there. Maybe look at your server logs again and see if there are other errors reported around the “Cannot modify header information” warning?

    Thread Starter eamallory

    (@eamallory)

    It fails on all protocols, SAML 1.1 CAS 3 and 2.

    from the php-fpm log… CAS server returned an Authentication Exception. Details:
    [25-Jun-2021 13:13:04 UTC] CAS URL: https://cas-dev.wichita.edu/cas/samlValidate?TARGET=https%3A%2F%2Fcomm406-test.wichita.edu%2Fwp-login.php%3Fexternal%3Dcas%26redirect_to%3Dhttps%253A%252F%252Fcomm406-test.wichita.edu%252Fwp-admin%252Fadmin.php%253Fpage%253Dauthorizer
    Authentication failure: SA not validated

    But I’ve set the ST tickets to live longer and I can verify the xml from cas.
    Okay… I started this message at 8 AM CST today and now at 16:14 I’m just now getting back to it… I turned on debug for phpCAS for one of the sites. This may be of interest.

    could not open URL 'https://cas-dev.wichita.edu/cas/serviceValidate?service=https%3A%2F%2Fcomm306-test.wichita.edu%2Fwp-login.php%3Fexternal%3Dcas%26redirect_to%3Dhttps%253A%252F%252Fcomm306-test.wichita.edu%252Fwp-admin%252F&ticket=ST-22-KDCkMZBoICJOiaRIgviJEX9jxEY-cas-dev.wichita.edu' to validate (CURL error #60: SSL certificate problem: unable to get local issuer certificate) [Client.php:3408]
    2C9D .|    |    |    |    => CAS_AuthenticationException::__construct(CAS_Client, 'Ticket not validated', 'https://cas-dev.wichita.edu/cas/serviceValidate?service=https%3A%2F%2Fcomm306-test.wichita.edu%2Fwp-login.php%3Fexternal%3Dcas%26redirect_to%3Dhttps%253A%252F%252Fcomm306-test.wichita.edu%252Fwp-admin%252F&ticket=ST-22-KDCkMZBoICJOiaRIgviJEX9jxEY-cas-dev.wichita.edu', true) [Client.php:3412]
    2C9D .|    |    |    |    |    => CAS_Client::getURL() [AuthenticationException.php:77]
    2C9D .|    |    |    |    |    <= 'https://comm306-test.wichita.edu/wp-login.php?external=cas&redirect_to=https%3A%2F%2Fcomm306-test.wichita.edu%2Fwp-admin%2F'
    Thread Starter eamallory

    (@eamallory)

    Plugin Author Paul Ryan

    (@figureone)

    Ha, I completely forgot that convo too ??

    We’ve got some code checking whether the CAS server is reachable, I wonder if we can extend it to test that certificate issue:
    https://github.com/uhm-coe/authorizer/blob/fd8b2840596870f0486d40e25a3eeb92481002a3/src/authorizer/class-helper.php#L366-L379
    If you have time let us know what the specific cause and fix are!

Viewing 6 replies - 1 through 6 (of 6 total)
  • The topic ‘CAS 6.3.4 Issue’ is closed to new replies.