4 include_once
'Auth/Container.php';
38 public function fetchData($a_username,$a_password,$isChallengeResponse =
false)
42 $ilLog->write(__METHOD__.
': Fetch Data called');
44 $response = $this->settings->getConsumer()->complete($this->settings->getReturnLocation());
46 switch($response->status)
49 die(
"Auth cancelled");
52 die(
"Auth failed with message: ".$response->message);
55 $openid = $response->getDisplayIdentifier();
56 $esc_identity = htmlentities($openid);
57 $ilLog->write(__METHOD__.
': Auth success with identity '.$esc_identity);
59 if($response->endpoint->canonicalID)
61 $escaped_canonicalID = htmlentities($response->endpoint->canonicalID);
62 $ilLog->write(__METHOD__.
': Auth success with canonical id: '.$esc_identity);
65 include_once
'Auth/OpenID/SReg.php';
71 $this->response_data = $sreg_resp->contents();
74 $ilLog->write(__METHOD__.
' auth data: '.print_r($this->response_data,
true));
80 foreach($response->message->args->keys as $key => $mapping)
82 if($mapping[1] ==
'sreg.nickname')
84 $this->response_data[
'nickname'] = $response->message->args->values[$key];
86 if($mapping[1] ==
'sreg.email')
88 $this->response_data[
'email'] = $response->message->args->values[$key];
107 $this->force_creation =
true;
121 $this->response_data[
'nickname']
123 if(!$this->response_data[
'ilInternalAccount'])
125 if($this->settings->isCreationEnabled())
127 if($this->settings->isAccountMigrationEnabled() and !$this->force_creation and !
$_SESSION[
'force_creation'])
131 $_SESSION[
'tmp_oid_username'] = urldecode(
$_GET[
'openid_identity']);
132 $_SESSION[
'tmp_external_account'] = $this->response_data[
'nickname'];
134 $_SESSION[
'tmp_roles'] = array(0 => $this->settings->getDefaultRole());
136 ilUtil::redirect(
'ilias.php?baseClass=ilStartUpGUI&cmd=showAccountMigration&cmdClass=ilstartupgui');
139 include_once
'./Services/OpenId/classes/class.ilOpenIdAttributeToUser.php';
141 $new_name =
$new_user->create($this->response_data[
'nickname'],$this->response_data);
143 $a_auth->setAuth($new_name);
157 $a_auth->setAuth($this->response_data[
'ilInternalAccount']);
169 include_once
'./Services/OpenId/classes/class.ilOpenIdSettings.php';
171 $this->settings->initConsumer();