diff options
-rw-r--r-- | Auth/OpenID/PAPE.php | 12 | ||||
-rw-r--r-- | Tests/Auth/OpenID/PAPE.php | 2 |
2 files changed, 8 insertions, 6 deletions
diff --git a/Auth/OpenID/PAPE.php b/Auth/OpenID/PAPE.php index 6b2e3f4..b9f68c8 100644 --- a/Auth/OpenID/PAPE.php +++ b/Auth/OpenID/PAPE.php @@ -237,7 +237,7 @@ class Auth_OpenID_PAPE_Response extends Auth_OpenID_Extension { function parseExtensionArgs($args, $strict=false) { $policies_str = Auth_OpenID::arrayGet($args, 'auth_policies'); - if ($policies_str) { + if ($policies_str and $policies_str != "none") { $this->auth_policies = explode(" ", $policies_str); } @@ -272,10 +272,12 @@ class Auth_OpenID_PAPE_Response extends Auth_OpenID_Extension { function getExtensionArgs() { - $ns_args = array( - 'auth_policies' => - implode(' ', $this->auth_policies) - ); + $ns_args = array(); + if (count($this->auth_policies) > 0) { + $ns_args['auth_policies'] = implode(' ', $this->auth_policies); + } else { + $ns_args['auth_policies'] = 'none'; + } if ($this->nist_auth_level !== null) { if (!in_array($this->nist_auth_level, range(0, 4), true)) { diff --git a/Tests/Auth/OpenID/PAPE.php b/Tests/Auth/OpenID/PAPE.php index 07d3b41..d53fb04 100644 --- a/Tests/Auth/OpenID/PAPE.php +++ b/Tests/Auth/OpenID/PAPE.php @@ -139,7 +139,7 @@ class PapeResponseTestCase extends PHPUnit_TestCase { } function test_getExtensionArgs() { - $this->assertEquals(array('auth_policies' => ''), $this->req->getExtensionArgs()); + $this->assertEquals(array('auth_policies' => 'none'), $this->req->getExtensionArgs()); $this->req->addPolicyURI('http://uri'); $this->assertEquals(array('auth_policies' => 'http://uri'), $this->req->getExtensionArgs()); $this->req->addPolicyURI('http://zig'); |