Skip to content

Commit

Permalink
Removing userCertificate;binary LDAP attribute before XML parse
Browse files Browse the repository at this point in the history
  • Loading branch information
northway committed Jan 24, 2018
1 parent c8352a4 commit caee91c
Showing 1 changed file with 12 additions and 3 deletions.
15 changes: 12 additions & 3 deletions www/login.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
* @author Tamas Frank, NIIFI
*
*/

// Get session object
$session = SimpleSAML_Session::getSession();

Expand Down Expand Up @@ -37,7 +36,7 @@
$attributes = $session->getAuthData($as['mainAuthSource'], 'Attributes');
$state['Attributes'] = $attributes;

$uid = $attributes[ $as['uidField'] ][0];
$uid = $attributes[$as['uidField']][0];
$state['UserID'] = $uid;
$isEnabled = $gaLogin->isEnabled2fa($uid);

Expand All @@ -52,7 +51,7 @@
$t->data['todo'] = 'generateGA';
$t->data['autofocus'] = 'otp';
$totpIssuer = empty($as['totpIssuer']) ? 'dev_aai_teszt_IdP' : $as['totpIssuer'];
$t->data['qrcode'] = $gaLogin->getQRCodeGoogleUrl($totpIssuer.':'.$uid, $totpIssuer, $gaKey);
$t->data['qrcode'] = $gaLogin->getQRCodeGoogleUrl($totpIssuer . ':' . $uid, $totpIssuer, $gaKey);
} elseif ($_POST['setEnable2f'] == 0) {
$gaLogin->disable2fa($uid);
SimpleSAML_Auth_Source::completeAuth($state);
Expand All @@ -68,6 +67,11 @@

if ($loggedIn) {
$state['saml:AuthnContextClassRef'] = $gaLogin->tfa_authencontextclassref;

if (isset($state['Attributes']['userCertificate;binary'])) {
unset($state['Attributes']['userCertificate;binary']);
}

SimpleSAML_Auth_Source::completeAuth($state);
} else {
$errorCode = 'WRONGOTP';
Expand All @@ -78,6 +82,11 @@
$t->data['todo'] = 'loginOTP';
}
} else {

if (isset($state['Attributes']['userCertificate;binary'])) {
unset($state['Attributes']['userCertificate;binary']);
}

// User has set up not to use 2 factor, so he is logged in
SimpleSAML_Auth_Source::completeAuth($state);
}
Expand Down

0 comments on commit caee91c

Please sign in to comment.