• We are investigating the possibility of migrating our system from using direct Active Directory/LDAP authentication to using CAS authentication.

    In our existing AD authentication process, all WordPress users created by AD follow a slightly modified naming convention, allowing us to easily distinguish which users were created automatically by the AD authentication and which users were manually created within WordPress.

    Basically, the way it’s set up, the users that were created automatically by AD authentication will be [netID][suffix], where the [suffix] is something we set up in our AD plugin settings.

    This is causing an issue when we’re trying to switch over to the CAS Maestro plugin, as it appears to expect the CAS uid to match the WordPress username exactly.

    It would be nice if there was a way to tell the plugin that the WordPress usernames are structured (and any new CAS-created users should be structured, going forward) as [uid][suffix], where we set the suffix.

    Basically, what I’d like to see would be a new option (potentially 2 new options, just in case others have used this type of functionality in old AD/LDAP plugins) in the CAS Maestro settings:

    1. Username prefix (to be prepended to the beginning of the WordPress username after CAS sends the uid back – basically, the uid would get sent to WordPress as $settings['prefix'] . $username, instead of just $username)
    2. Username suffix (to be appended to the end of the WordPress username after CAS sends the uid back – basically, the uid would get sent to WordPress as $username . $settings['suffix'], instead of just $username).

    Ideally, these two optional settings would be used together, so the code would look something like:

    $username = phpCAS::getUser();
    $password = md5($username.'wpCASAuth!"#$"!$!"%$#"%#$'.rand().$this->generateRandomString(20));
    
    $username = isset( $this->settings['prefix'] ) && ! empty( $this->settings['prefix'] ) ? $this->settings['prefix'] . $username : $username;
    $username = isset( $this->settings['suffix'] ) && ! empty( $this->settings['suffix'] ) ? $username . $this->settings['suffix'] : $username;
    $user = get_user_by('login',$username);

    As it is, since we have existing users with WordPress usernames that don’t match their CAS uid, but with WordPress email addresses do match their CAS email addresses, our users are getting successfully authenticated by CAS itself, then getting dumped to the standard wp-login page with an “Invalid username or password” error. Thanks in advance.

    https://www.ads-software.com/plugins/cas-maestro/

  • The topic ‘Alternate Username Structure’ is closed to new replies.