Esempio n. 1
0
function replace_with_rss($accts)
{
    if ($accts) {
        foreach ($accts as $acct) {
            $acct = convert_to_rss($acct);
            if ($acct) {
                $ret = safe_array_merge($ret, array($acct));
            }
        }
    }
    return $ret;
}
Esempio n. 2
0
 /** Manually set configuration option */
 function setConfig($config = array())
 {
     $this->config = safe_array_merge($this->config, $config);
 }
function getAuth($foafuri = NULL)
{
    if (!$_SERVER['HTTPS']) {
        return array('isAuthenticated' => 0, 'authDiagnostic' => 'No client certificate supplied on an unsecure connection');
    }
    if (!$_SERVER['SSL_CLIENT_CERT']) {
        return array('isAuthenticated' => 0, 'authDiagnostic' => 'No client certificate supplied');
    }
    $certrsakey = openssl_pkey_get_public_hex();
    if (!$certrsakey) {
        return array('isAuthenticated' => 0, 'authDiagnostic' => 'No RSA Key in the supplied client certificate');
    }
    $result = array('certRSAKey' => $certrsakey);
    $san = openssl_get_subjectAltName();
    $foafuri = $san['URI'];
    //	$foafuri = 'http://www.w3.org/People/Berners-Lee/card#i';
    //  $foafuri = 'http://bblfish.net/people/henry/card#me';
    //	$foafuri = 'http://danbri.org/foaf.rdf#danbri';
    //	$foafuri = 'http://foafbuilder.qdos.com/people/melvster.com/foaf.rdf';
    //	$foafuri = 'http://test.foaf-ssl.org/certs/1235593768725.rdf#accnt';
    //	$foafuri = 'http://myopenlink.net/dataspace/person/kidehen#this';
    $result = safe_array_merge($result, array('subjectAltName' => $foafuri));
    //	$foafrsakey = get_foaf_rsakey($foafuri);
    //	$result = array_merge($result, array('subjectAltNameRSAKey'=>$foafrsakey));
    if ($agent = get_agent($foafuri)) {
        $result = safe_array_merge($result, $agent);
        if ($agent['agent']['RSAKey']) {
            if (equal_rsa_keys($certrsakey, $agent['agent']['RSAKey'])) {
                $result = safe_array_merge($result, array('isAuthenticated' => 1, 'authDiagnostic' => 'Client Certificate RSAkey matches SAN RSAkey'));
            } else {
                $result = safe_array_merge($result, array('isAuthenticated' => 0, 'authDiagnostic' => 'Client Certificate RSAkey does not match SAN RSAkey'));
            }
        } else {
            $result = safe_array_merge($result, array('isAuthenticated' => 0, 'authDiagnostic' => 'No RSAKey found at supplied agent'));
        }
    } else {
        $result = safe_array_merge($result, array('isAuthenticated' => 0, 'authDiagnostic' => 'No agent found at supplied SAN'));
    }
    return $result;
}