Skip to content
Snippets Groups Projects
Commit 31ca1afc authored by Tim van Dijen's avatar Tim van Dijen
Browse files

Fixes for modules/exampleauth

parent 6de7dd36
No related branches found
No related tags found
No related merge requests found
...@@ -10,10 +10,13 @@ if (!($query instanceof \SAML2\AttributeQuery)) { ...@@ -10,10 +10,13 @@ if (!($query instanceof \SAML2\AttributeQuery)) {
$idpEntityId = $metadata->getMetaDataCurrentEntityID('saml20-idp-hosted'); $idpEntityId = $metadata->getMetaDataCurrentEntityID('saml20-idp-hosted');
$issuer = $query->getIssuer();
$spEntityId = $query->getIssuer(); if ($issuer === null) {
if ($spEntityId === null) {
throw new \SimpleSAML\Error\BadRequest('Missing <saml:Issuer> in <samlp:AttributeQuery>.'); throw new \SimpleSAML\Error\BadRequest('Missing <saml:Issuer> in <samlp:AttributeQuery>.');
} elseif (is_string($issuer)) {
$spEntityId = $issuer;
} else {
$spEntityId = $issuer->getValue();
} }
$idpMetadata = $metadata->getMetaDataConfig($idpEntityId, 'saml20-idp-hosted'); $idpMetadata = $metadata->getMetaDataConfig($idpEntityId, 'saml20-idp-hosted');
...@@ -41,6 +44,7 @@ if (count($returnAttributes) === 0) { ...@@ -41,6 +44,7 @@ if (count($returnAttributes) === 0) {
$returnAttributes = []; $returnAttributes = [];
} else { } else {
foreach ($returnAttributes as $name => $values) { foreach ($returnAttributes as $name => $values) {
/** @var array $values */
if (!array_key_exists($name, $attributes)) { if (!array_key_exists($name, $attributes)) {
// We don't have this attribute // We don't have this attribute
unset($returnAttributes[$name]); unset($returnAttributes[$name]);
......
...@@ -6,13 +6,13 @@ namespace SimpleSAML\Module\exampleautth\Auth\Process; ...@@ -6,13 +6,13 @@ namespace SimpleSAML\Module\exampleautth\Auth\Process;
* A simple processing filter for testing that redirection works as it should. * A simple processing filter for testing that redirection works as it should.
* *
*/ */
class RedirectTest extends \SimpleSAML\Auth\ProcessingFilter class RedirectTest extends \SimpleSAML\Auth\ProcessingFilter
{ {
/** /**
* Initialize processing of the redirect test. * Initialize processing of the redirect test.
* *
* @param array &$state The state we should update. * @param array &$state The state we should update.
* @return void
*/ */
public function process(&$state) public function process(&$state)
{ {
......
...@@ -22,7 +22,6 @@ namespace SimpleSAML\Module\exampleauth\Auth\Source; ...@@ -22,7 +22,6 @@ namespace SimpleSAML\Module\exampleauth\Auth\Source;
* *
* @package SimpleSAMLphp * @package SimpleSAMLphp
*/ */
class External extends \SimpleSAML\Auth\Source class External extends \SimpleSAML\Auth\Source
{ {
/** /**
...@@ -47,10 +46,11 @@ class External extends \SimpleSAML\Auth\Source ...@@ -47,10 +46,11 @@ class External extends \SimpleSAML\Auth\Source
// Do any other configuration we need here // Do any other configuration we need here
} }
/** /**
* Retrieve attributes for the user. * Retrieve attributes for the user.
* *
* @return array|NULL The user's attributes, or NULL if the user isn't authenticated. * @return array|null The user's attributes, or NULL if the user isn't authenticated.
*/ */
private function getUser() private function getUser()
{ {
...@@ -91,10 +91,12 @@ class External extends \SimpleSAML\Auth\Source ...@@ -91,10 +91,12 @@ class External extends \SimpleSAML\Auth\Source
return $attributes; return $attributes;
} }
/** /**
* Log in using an external authentication helper. * Log in using an external authentication helper.
* *
* @param array &$state Information about the current authentication. * @param array &$state Information about the current authentication.
* @return void
*/ */
public function authenticate(&$state) public function authenticate(&$state)
{ {
...@@ -172,6 +174,7 @@ class External extends \SimpleSAML\Auth\Source ...@@ -172,6 +174,7 @@ class External extends \SimpleSAML\Auth\Source
assert(false); assert(false);
} }
/** /**
* Resume authentication process. * Resume authentication process.
* *
...@@ -179,6 +182,9 @@ class External extends \SimpleSAML\Auth\Source ...@@ -179,6 +182,9 @@ class External extends \SimpleSAML\Auth\Source
* entered his or her credentials. * entered his or her credentials.
* *
* @param array &$state The authentication state. * @param array &$state The authentication state.
* @return void
* @throws \SimpleSAML\Error\BadRequest
* @throws \SimpleSAML\Error\Exception
*/ */
public static function resume() public static function resume()
{ {
...@@ -248,11 +254,13 @@ class External extends \SimpleSAML\Auth\Source ...@@ -248,11 +254,13 @@ class External extends \SimpleSAML\Auth\Source
assert(false); assert(false);
} }
/** /**
* This function is called when the user start a logout operation, for example * This function is called when the user start a logout operation, for example
* by logging out of a SP that supports single logout. * by logging out of a SP that supports single logout.
* *
* @param array &$state The logout state array. * @param array &$state The logout state array.
* @return void
*/ */
public function logout(&$state) public function logout(&$state)
{ {
......
...@@ -11,7 +11,6 @@ namespace SimpleSAML\Module\exampleauth\Auth\Source; ...@@ -11,7 +11,6 @@ namespace SimpleSAML\Module\exampleauth\Auth\Source;
* @author Olav Morken, UNINETT AS. * @author Olav Morken, UNINETT AS.
* @package SimpleSAMLphp * @package SimpleSAMLphp
*/ */
class StaticSource extends \SimpleSAML\Auth\Source class StaticSource extends \SimpleSAML\Auth\Source
{ {
/** /**
...@@ -42,10 +41,12 @@ class StaticSource extends \SimpleSAML\Auth\Source ...@@ -42,10 +41,12 @@ class StaticSource extends \SimpleSAML\Auth\Source
} }
} }
/** /**
* Log in using static attributes. * Log in using static attributes.
* *
* @param array &$state Information about the current authentication. * @param array &$state Information about the current authentication.
* @return void
*/ */
public function authenticate(&$state) public function authenticate(&$state)
{ {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment