Skip to content

Commit

Permalink
Improve skip SSO on 2FA log messages
Browse files Browse the repository at this point in the history
  • Loading branch information
MKodde committed Sep 19, 2023
1 parent a2867b2 commit b7c48f7
Show file tree
Hide file tree
Showing 5 changed files with 16 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,13 @@ public function selectSecondFactorForVerificationAction($authenticationMode, Req
$ssoCookie = $this->getCookieService()->read($request);
// Test if the SSO cookie can satisfy the second factor authentication requirements
if ($this->getCookieService()->maySkipAuthentication($requiredLoa->getLevel(), $identityNameId, $ssoCookie)) {
$logger->notice('Skipping second factor authentication. Required LoA was met by the LoA recorded in the cookie');
$logger->notice(
'Skipping second factor authentication. Required LoA was met by the LoA recorded in the cookie',
[
'required-loa' => $requiredLoa->getLevel(),
'cookie-loa' => $ssoCookie->getLoa()
]
);
// We use the SF from the cookie as the SF that was used for authenticating the second factor authentication
$secondFactor = $this->getSecondFactorService()->findByUuid($ssoCookie->secondFactorId());
$this->getResponseContext($authenticationMode)->saveSelectedSecondFactor($secondFactor);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -174,7 +174,7 @@ public function preconditionsAreMet(ResponseContext $responseContext): bool
if (!$remoteSp->allowSsoOn2fa()) {
$this->logger->notice(
sprintf(
'Ignoring SSO on 2FA for SP: %s',
'SSO on 2FA is disabled by config for SP: %s',
$remoteSp->getEntityId()
)
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,4 +29,6 @@ public function meetsRequiredLoa(float $requiredLoa): bool;
public function authenticationTime(): int;

public function secondFactorId(): string;

public function getLoa(): float;
}
Original file line number Diff line number Diff line change
Expand Up @@ -44,4 +44,9 @@ public function secondFactorId(): string
{
return '';
}

public function getLoa(): float
{
// TODO: Implement getLoa() method.
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -199,7 +199,7 @@ public function test_check_preconditions_is_remote_sp_disabled()

$this->logger
->shouldReceive('notice')
->with('Ignoring SSO on 2FA for SP: https://remote.sp.stepup.example.com');
->with('SSO on 2FA is disabled by config for SP: https://remote.sp.stepup.example.com');

self::assertFalse($this->service->preconditionsAreMet($this->responseContext));
}
Expand Down

0 comments on commit b7c48f7

Please sign in to comment.