CAS Authentication
[closed] to make CAS Authentication working for WordPress 3.4.1 (22 posts)

  1. Richard
    Posted 4 years ago #

    I am trying to use this plug in with WordPress 3.4.1, but it won't work.

    It took me a while to figure out how to make it work.

    If anyone wants to know how to make it work, please let me know and I can show you the changes I made to get it work.

    It's a really nice plugin, when it's working ...


  2. Richard
    Posted 4 years ago #

    changes I have made:

    line 64:

    add_filter('authenticate', array('CASAuthentication', 'authenticate'), 10, 3);

    line 85:

    function authenticate($user, $username, $password) {

    line 121:

    return $user;

  3. guix69
    Posted 4 years ago #

    Hello, thanks for your reply, and for the timing :)

    I tried what you suggested but I still get an error. Chrome tells me about an error when "extracting" something, followed by the CAS ticker URL. -> Error HTTP 500

  4. Richard
    Posted 4 years ago #

    What's your CAS version?
    I am using CAS 3.4.11.

    Also the version of phpCAS?
    I am using phpCAS 1.3.1.

    Did you get redirected to CAS?
    Can you login?

  5. guix69
    Posted 4 years ago #

    Well I found out that curl was not installed on the server and it was the reason for the authentification not working. I'll test this plugin some more after august 15th and I'll get back to you if I have some questions :)


  6. Bradford Luten
    Posted 4 years ago #

    @Richard I'm trying to get this working. The wp-login.php redirects to our CAS login page, which I sign into, but it returns to the wp-login.php page (standard WordPress login page displayed) with a red error box.

    I know my CAS login is successful as I can get to other CAS protected pages.

  7. Richard
    Posted 4 years ago #

    Hi BLLuten,

    From your post, I can tell:

    1. your CAS is working
    2. the plugin is working

    things to check:

    in CAS Authentication settings, make sure the CAS.php path is correct. For example, mine is /var/CAS-1.3.1/CAS.php

    if "Auto-register new users?" is off, make sure you login with an existing user, that means before activating this plugin, create a new user with the username you are going to login through CAS.

    Happy to help, good luck.

  8. Bradford Luten
    Posted 4 years ago #

    Interesting... If I enable "Auto-register new users?" I can log in.

    If I turn it off, I get the expected "ERROR: <username> is not registered with this blog."

    When this plugin is enabled, if I try to add a new user, I get "ERROR: Please enter your password.", since the password fields are missing from the add user page.

    If I deactivate the plugin, add a new user, enable the plugin, and try to log in as that user, I get what I described previously: WordPress login page with "ERROR: The password you entered for the username <username> is incorrect."

    So part of this clearly works, but the way I was hoping to use it doesn't work for me.

  9. Richard
    Posted 4 years ago #

    I think you are very close, just need more luck ...

    This plugin disabled password field, if you want to enable it, you can change the plugin code, search for function show_password_fields, return true will enable it.

    For me, if I enable the plugin, I can login via CAS without any problem. Sorry, but, did you make the changes to CAS authentication plugin, as I posted above?

    And maybe you are using a different version of wordpress or phpCAS?

  10. Bradford Luten
    Posted 4 years ago #

    @Richard- I had tried this plugin without and with the changes you suggested above, before I made my initial post. I'm currently exploring it without your suggested changes.

    I'm using WordPress 3.4.1, phpCAS 1.3.1, & php 5.4.6.

    Changing the return value of the show_password_fields function from false to true doesn't seem to change the behavior on the add new user page. I'm still exploring (i.e. the add_filter('show_password_fields' action).

  11. Bradford Luten
    Posted 4 years ago #

    Ack. Ignore the last paragraph in my last post above. Changing the show_password_fields function does work as expected.

  12. Richard
    Posted 4 years ago #


  13. Bradford Luten
    Posted 4 years ago #

    If I set show_password_fields to true, and use the MD5 of the return value from the passwordRoot function I can now pre-create users for CAS authentication.

    I wonder if its possible to hook the add user page so that this password was used when the show_password_fields was set to false.

    Its been interesting taking this apart. :-)

  14. Bradford Luten
    Posted 4 years ago #

    In regards to the add new user issue, when the password fields are hidden, it looks like the wpCAS plugin addresses this with a hook to check_passwords that sets the password. Seems like CAS Authenticate could be patched in a similar fashion.

  15. poz81
    Posted 3 years ago #

    Richard you save my life with your changes to this plugin.
    In my case the login went wrong after changing the password of a CAS user, with yours fix all works good!

    Thanks a lot!!

  16. Richard
    Posted 3 years ago #

    Glad it worked for you.

  17. aklassen
    Posted 3 years ago #

    Hi Richard,

    can you upload your modified version of the cas plugin? Unfortunately the source isn't available via http://wordpress.org/extend/plugins/cas-authentication/.



  18. Bradford Luten
    Posted 3 years ago #

    @Andre- That's interesting. Looks like the source is still in Trac:


  19. Richard
    Posted 3 years ago #

    Hi Andre,

    I tried to upload to this website, using the name cas-authentication, but it says the name already exists.

    However, you can download from here:


    Good luck.



  20. Richard
    Posted 3 years ago #

    Forgot to mention:

    the size is about 14K, and phpCAS is not included.

    Only cas-authentication.php, gpl-2.0.txt, readme.txt.

  21. rbottomley
    Posted 3 years ago #

    I just discovered that wpCAS is broken for creating new users. I installed cas-authentication and it is working for existing users (just like wpCAS); but when I try to create a new user I get:

    ERROR: Please enter your password.

    Any ideas?

    I am running:

    • WordPress 3.5.1
    • phpCAS 1.3.2
    • CAS Authentication 2.4
  22. WPyogi
    Forum Moderator
    Posted 3 years ago #

    @rbottomley - if you are running WP3.5.1, posting in a thread titled WP3.4.1 probably isn't a great place to get help. Please see:


    and go here to start a new thread:


Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic