SimpleSAML\Test\Module\saml\Auth\Process\FilterScopesTest::testInvalidScopes PHP Method

testInvalidScopes() public method

Test invalid scopes.
public testInvalidScopes ( )
    public function testInvalidScopes()
    {
        // test scope not matching anything, empty attribute
        $config = array();
        $request = array('Source' => array('SingleSignOnService' => array(array('Binding' => 'urn:oasis:names:tc:SAML:2.0:bindings:HTTP-Redirect', 'Location' => 'https://example.org/saml2/idp/SSOService.php')), 'scope' => array('example.com', 'example.net')), 'Attributes' => array('eduPersonPrincipalName' => array('[email protected]')));
        $result = $this->processFilter($config, $request);
        $this->assertEquals(array(), $result['Attributes']);
        // test some scopes allowed and some others not
        $request['Attributes']['eduPersonPrincipalName'][] = '[email protected]';
        $result = $this->processFilter($config, $request);
        $this->assertEquals(array('eduPersonPrincipalName' => array('[email protected]')), $result['Attributes']);
        // test attribute missing scope
        $request['Attributes'] = array('eduPersonPrincipalName' => array('jdoe'));
        $result = $this->processFilter($config, $request);
        $this->assertEquals($request['Attributes'], $result['Attributes']);
    }