Skip to content

Commit

Permalink
The SecondFactor::getType method is now public
Browse files Browse the repository at this point in the history
The SecondFactorCollection performs the comparison on the two SF's using
the SFTService. The service expects to be called with SecondFactorType
instances. To do so, the type has been exposed publicly.
  • Loading branch information
MKodde committed Jun 8, 2017
1 parent ae875ab commit ecbd039
Show file tree
Hide file tree
Showing 6 changed files with 10 additions and 9 deletions.
5 changes: 0 additions & 5 deletions src/Surfnet/Stepup/Identity/Entity/AbstractSecondFactor.php
Original file line number Diff line number Diff line change
Expand Up @@ -33,9 +33,4 @@ public function hasTypeWithEqualOrLowerLoaComparedTo(SecondFactorType $type, Sec
{
return $service->hasEqualOrLowerLoaComparedTo($this->getType(), $type);
}

/**
* @return SecondFactorType
*/
abstract protected function getType();
}
6 changes: 6 additions & 0 deletions src/Surfnet/Stepup/Identity/Entity/SecondFactor.php
Original file line number Diff line number Diff line change
Expand Up @@ -36,4 +36,10 @@ public function hasEqualOrHigherLoaComparedTo(SecondFactor $comparable, SecondFa
* @return bool
*/
public function hasTypeWithEqualOrLowerLoaComparedTo(SecondFactorType $type, SecondFactorTypeService $service);

/**
* @return SecondFactorType
*/
public function getType();

}
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ public function getSecondFactorWithHighestLoa(SecondFactorTypeService $service)
return array_reduce(
$this->toArray(),
function (SecondFactor $carry, SecondFactor $item) use ($service) {
return $service->hasEqualOrHigherLoaComparedTo($carry, $item->getType()) ? $carry : $item;
return $service->hasEqualOrHigherLoaComparedTo($carry->getType(), $item->getType()) ? $carry : $item;
},
$this->first() ?: null
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -204,7 +204,7 @@ protected function applyIdentityForgottenEvent(IdentityForgottenEvent $event)
$this->secondFactorIdentifier = $secondFactorIdentifierClass::unknown();
}

protected function getType()
public function getType()
{
return $this->type;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -191,7 +191,7 @@ protected function applyIdentityForgottenEvent(IdentityForgottenEvent $event)
$this->secondFactorIdentifier = $secondFactorIdentifierClass::unknown();
}

protected function getType()
public function getType()
{
return $this->type;
}
Expand Down
2 changes: 1 addition & 1 deletion src/Surfnet/Stepup/Identity/Entity/VettedSecondFactor.php
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,7 @@ protected function applyIdentityForgottenEvent(IdentityForgottenEvent $event)
$this->secondFactorIdentifier = $secondFactorIdentifierClass::unknown();
}

protected function getType()
public function getType()
{
return $this->type;
}
Expand Down

0 comments on commit ecbd039

Please sign in to comment.