1 <?php declare(strict_types=1);
40 $this->db =
$GLOBALS[
'DIC']->database();
41 $this->idp_id = $a_idp_id;
43 if ($this->idp_id > 0) {
54 $idps = self::getActiveIdpList();
55 if (count($idps) > 0) {
56 return current($idps);
68 if (!isset(self::$instances[$a_idp_id]) || !(self::$instances[$a_idp_id] instanceof
self)) {
69 self::$instances[$a_idp_id] =
new self($a_idp_id);
72 return self::$instances[$a_idp_id];
78 private function read() : void
80 $query =
'SELECT * FROM saml_idp_settings WHERE idp_id = ' . $this->db->quote($this->
getIdpId(),
'integer');
82 while ($record = $this->db->fetchAssoc(
$res)) {
96 $this->
setIdpId((
int) $this->db->nextId(
'saml_idp_settings'));
102 'idp_id' => [
'integer', $this->
getIdpId()]
105 'is_active' => [
'integer', (
int) $this->
isActive()],
120 public function delete() :
void 125 $this->db->manipulateF(
126 'UPDATE usr_data SET auth_mode = %s WHERE auth_mode = %s',
127 array(
'text',
'text'),
131 $this->db->manipulate(
'DELETE FROM saml_idp_settings WHERE idp_id = ' . $this->db->quote(
160 $this->
setIdpId((
int) $record[
'idp_id']);
161 $this->
setActive((
bool) $record[
'is_active']);
187 $this->
setEntityId((
string) $metadata->getIdpMetadataParser()->getEntityId());
197 $GLOBALS[
'DIC']->logger()->auth()->write(__METHOD__ .
': No auth mode given..............');
201 $auth_arr = explode(
'_', $a_auth_mode);
203 count($auth_arr) === 2 &&
204 (
int) $auth_arr[0] === (
int)
AUTH_SAML &&
205 strlen($auth_arr[1]) > 0
215 if (self::isAuthModeSaml($a_auth_mode)) {
216 $auth_arr = explode(
'_', $a_auth_mode);
217 return (
int) $auth_arr[1];
229 foreach (self::getAllIdps() as $idp) {
230 if ($idp->isActive() && $idp->getEntityId() ===
$entityId) {
231 return $idp->getIdpId();
245 foreach (self::getAllIdps() as $idp) {
246 if ($idp->isActive()) {
261 $res = $DIC->database()->query(
'SELECT * FROM saml_idp_settings');
264 while ($row = $DIC->database()->fetchAssoc(
$res)) {
266 $idp->bindDbRecord($row);
280 $auth_arr = explode(
'_', $a_auth_key);
281 if (count((array) $auth_arr) > 1) {
282 return 'saml_' . $auth_arr[1];
294 $auth_arr = explode(
'_', $a_auth_mode);
295 if (count((array) $auth_arr) > 1) {
363 $this->allow_local_auth = $status;
379 $this->default_role_id = $role_id;
387 $this->uid_claim = $claim;
403 $this->login_claim = $claim;
427 $this->sync_status = $sync;
443 $this->account_migration_status = $status;
bindDbRecord(array $record)
static geIdpIdByEntityId($entityId)
static isAuthModeSaml(string $a_auth_mode)
setActive(bool $is_active)
setDefaultRoleId(int $role_id)
static getInstanceByIdpId(int $a_idp_id)
static getIdpIdByAuthMode(string $a_auth_mode)
setEntityId(string $entity_id)
setLocalLocalAuthenticationStatus(bool $status)
setUidClaim(string $claim)
Class ilExternalAuthUserAttributeMapping.
setLoginClaim(string $claim)
foreach($_POST as $key=> $value) $res
__construct(int $a_idp_id=0)
if(!defined('PATH_SEPARATOR')) $GLOBALS['_PEAR_default_error_mode']
static getKeyByAuthMode(string $a_auth_mode)
setAccountMigrationStatus(bool $status)
static getAuthModeByKey(string $a_auth_key)
isAccountMigrationEnabled()
$account_migration_status
allowLocalAuthentication()
static getActiveIdpList()
isSynchronizationEnabled()
setSynchronizationStatus(bool $sync)
static getFirstActiveIdp()