Skip to content

Instantly share code, notes, and snippets.

@kawahara
Created April 10, 2010 09:30
Show Gist options
  • Save kawahara/361939 to your computer and use it in GitHub Desktop.
Save kawahara/361939 to your computer and use it in GitHub Desktop.
<?xml version="1.0" encoding="UTF-8"?>
<Module>
<ModulePrefs title="Activity Test" description="Activityのテスト">
<Link rel="event.addapp" href="http://debian/oauth/t.php" method="POST" />
<Link rel="event.removeapp" href="http://debian/oauth/t.php" method="POST" />
<Require feature="opensocial-0.8" />
<Require feature="dynamic-height" />
</ModulePrefs>
<Content type="html"><![CDATA[
Hello!<br />
<a href="#" id="invite">Invite</a>
<script type="text/javascript">
(function(){
function init()
{
document.getElementById("invite").onclick = function() {
var message = opensocial.newMessage('abc', {});
opensocial.requestShareApp("VIEWER_FRIENDS", message, function (response) {
});
}
gadgets.window.adjustHeight();
}
gadgets.util.registerOnLoadHandler(init);
})();
</script>
]]></Content>
</Module>
?php
// OpenSocial RSA-SHA1での署名の検証
// ライブラリとして http://oauth.googlecode.com/svn/code/php/ を利用しています。
include_once 'lib/OAuth.php';
class OAuthSignatureMethod_RSA_SHA1_opOpenSocialPlugin extends OAuthSignatureMethod_RSA_SHA1
{
protected function fetch_private_cert(&$request) {
throw new Exception();
}
protected function fetch_public_cert(&$request) {
return <<<EOT
-----BEGIN CERTIFICATE-----
PUBLIC CERT
-----END CERTIFICATE-----
EOT;
}
}
$request = OAuthRequest::from_request(null, null, null);
$signature_method = new OAuthSignatureMethod_RSA_SHA1_opOpenSocialPlugin();
var_dump($signature_method->check_signature($request, null, null, $request->get_parameter('oauth_signature')));
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment