Skip to content

Commit

Permalink
NOJIRA Support user creation in Shibboleth authentication adapter
Browse files Browse the repository at this point in the history
Currently there is a chicken and egg situation with the Shibboleth (SAML) authentication adapter. The ca_users::authenticate() method calls the AuthenticationManager::authenticate() which then calls Shibboleth::authenticate()  which will always fail because the adapter (shibboleth) says it supports (__CA_AUTH_ADAPTER_FEATURE_AUTOCREATE_USERS__ = true) auto creating users but then in the authenticate method it does a check to see whether the user exists in the CA database.

ca_users then goes on to say ok what's the username for the user from SAML and tries to get more user information for a username which it doesn't have because the user has not been authenticated.

This commit fixes that issue.
  • Loading branch information
kehh committed Feb 7, 2023
1 parent 8f7495c commit 27df40a
Showing 1 changed file with 1 addition and 4 deletions.
5 changes: 1 addition & 4 deletions app/lib/Auth/Adapters/Shibboleth.php
Original file line number Diff line number Diff line change
Expand Up @@ -74,10 +74,7 @@ public function authenticate($username, $password = '', $options=null) {
$map = array_flip($this->auth_config->get('shibboleth_field_map'));
$uid = array_shift($attrs[$map['uid']]);
if (!$uid) { return false; }
if (ca_users::find(['user_name' => $uid], ['returnAs' => 'count']) > 0) {
return true;
}
return false;
return true;
}
# --------------------------------------------------------------------------------
/**
Expand Down

0 comments on commit 27df40a

Please sign in to comment.