Skip to content

Commit

Permalink
Cleaner way of getting the value
Browse files Browse the repository at this point in the history
  • Loading branch information
mickenordin committed Nov 29, 2024
1 parent 7419da6 commit 56c56ab
Showing 1 changed file with 10 additions and 8 deletions.
18 changes: 10 additions & 8 deletions lib/Listeners/UserLoggedIn.php
Original file line number Diff line number Diff line change
Expand Up @@ -62,14 +62,16 @@ public function handle(Event $event): void
* @var IUser $user
*/
$user = $event->getUser();
$mfaVerified = '0';
$mfa_key = 'urn:oid:2.5.4.2'; // TODO: get from config
$attr = $this->session->get('user_saml.samlUserData');
if (isset($mfa_key) && isset($attr[$mfa_key])) {
$mfaVerified = $attr[$mfa_key][0];
}
if ($mfaVerified == '1') {
return;
$userbackend = $user->getBackend();
/**
* @var IUserBackend $userbackend
*/
if ($userbackend->getBackendName() == 'user_saml') {
$formatted = $userbackend->getUserData();
$mfaVerified = $formatted['formatted']['mfaVerified'];
if ($mfaVerified == '1') {
return;
}
}
$this->logger->debug('StepUpAuth running', ['app' => 'stepupauth']);
$this->session->set('two_factor_auth_uid', $user->getUID());
Expand Down

0 comments on commit 56c56ab

Please sign in to comment.