Skip to content

Commit

Permalink
Add setters to fixed providers lightSAML#49
Browse files Browse the repository at this point in the history
  • Loading branch information
tmilos committed Oct 27, 2016
1 parent 2f134e1 commit d7216fd
Show file tree
Hide file tree
Showing 3 changed files with 64 additions and 1 deletion.
15 changes: 15 additions & 0 deletions src/LightSaml/Provider/Attribute/FixedAttributeValueProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,21 @@ public function add(Attribute $attribute)
return $this;
}

/**
* @param \LightSaml\Model\Assertion\Attribute[] $attributes
*
* @return FixedAttributeValueProvider
*/
public function setAttributes(array $attributes)
{
$this->attributes = [];
foreach ($attributes as $attribute) {
$this->add($attribute);
}

return $this;
}

/**
* @param AssertionContext $context
*
Expand Down
12 changes: 12 additions & 0 deletions src/LightSaml/Provider/NameID/FixedNameIdProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,18 @@ public function __construct(NameID $nameId = null)
$this->nameId = $nameId;
}

/**
* @param NameID|null $nameId
*
* @return FixedNameIdProvider
*/
public function setNameId(NameID $nameId = null)
{
$this->nameId = $nameId;

return $this;
}

/**
* @param AbstractProfileContext $context
*
Expand Down
38 changes: 37 additions & 1 deletion src/LightSaml/Provider/Session/FixedSessionInfoProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -27,13 +27,49 @@ class FixedSessionInfoProvider implements SessionInfoProviderInterface
* @param string $sessionIndex
* @param string $authnContextClassRef
*/
public function __construct($authnInstant, $sessionIndex, $authnContextClassRef)
public function __construct($authnInstant = 0, $sessionIndex = null, $authnContextClassRef = null)
{
$this->authnInstant = $authnInstant;
$this->sessionIndex = $sessionIndex;
$this->authnContextClassRef = $authnContextClassRef;
}

/**
* @param int $authnInstant
*
* @return FixedSessionInfoProvider
*/
public function setAuthnInstant($authnInstant)
{
$this->authnInstant = intval($authnInstant);

return $this;
}

/**
* @param string $sessionIndex
*
* @return FixedSessionInfoProvider
*/
public function setSessionIndex($sessionIndex)
{
$this->sessionIndex = $sessionIndex;

return $this;
}

/**
* @param string $authnContextClassRef
*
* @return FixedSessionInfoProvider
*/
public function setAuthnContextClassRef($authnContextClassRef)
{
$this->authnContextClassRef = $authnContextClassRef;

return $this;
}

/**
* @return int
*/
Expand Down

0 comments on commit d7216fd

Please sign in to comment.