summaryrefslogtreecommitdiffstats
path: root/sca-cpp/trunk/samples
diff options
context:
space:
mode:
authorjsdelfino <jsdelfino@13f79535-47bb-0310-9956-ffa450edef68>2010-09-06 23:26:11 +0000
committerjsdelfino <jsdelfino@13f79535-47bb-0310-9956-ffa450edef68>2010-09-06 23:26:11 +0000
commitf75296a86350e41c01a355c945ca348082260cf9 (patch)
tree7635ae4a46ab4904609c7b662acc04a3c0f6efa8 /sca-cpp/trunk/samples
parentcc3bc602c8cb2c10aa542eab1e480d8604760007 (diff)
Enable OAuth and OpenID to be used together in the same app. Add a few OpenID providers to test login page.
git-svn-id: http://svn.us.apache.org/repos/asf/tuscany@993178 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'sca-cpp/trunk/samples')
-rw-r--r--sca-cpp/trunk/samples/store-cluster/htdocs/domains/jane/login/index.html96
-rw-r--r--sca-cpp/trunk/samples/store-cluster/htdocs/domains/joe/login/index.html96
-rw-r--r--sca-cpp/trunk/samples/store-cluster/htdocs/login/index.html96
-rwxr-xr-xsca-cpp/trunk/samples/store-cluster/server-ssl-conf5
4 files changed, 233 insertions, 60 deletions
diff --git a/sca-cpp/trunk/samples/store-cluster/htdocs/domains/jane/login/index.html b/sca-cpp/trunk/samples/store-cluster/htdocs/domains/jane/login/index.html
index e6b8c6fce3..16246cc621 100644
--- a/sca-cpp/trunk/samples/store-cluster/htdocs/domains/jane/login/index.html
+++ b/sca-cpp/trunk/samples/store-cluster/htdocs/domains/jane/login/index.html
@@ -17,7 +17,7 @@
under the License.
-->
-<html><body><h1>Sign in with an OpenID provider</h1>
+<html><body><h1>Sign in with an OpenID or OAuth 2.0 provider</h1>
<script type="text/javascript">
function queryParams() {
@@ -31,8 +31,8 @@ function queryParams() {
return qp;
}
-function openidReferrer() {
- r = queryParams()['modauthopenid.referrer'];
+function openauthReferrer() {
+ r = queryParams()['openauth_referrer'];
if (typeof(r) == 'undefined')
return r;
q = r.indexOf('?');
@@ -41,17 +41,16 @@ function openidReferrer() {
return r;
}
-if (typeof(openidReferrer()) == 'undefined') {
+if (typeof(openauthReferrer()) == 'undefined') {
document.location = '/';
}
-function submitSignin(w) {
- document.signin.openid_identifier.value = w();
- document.signin.action = openidReferrer();
- document.signin.submit();
+function submitOpenIDSignin(w) {
+ document.openIDSignin.openid_identifier.value = w();
+ document.openIDSignin.action = openauthReferrer();
+ document.openIDSignin.submit();
}
-
function withGoogle() {
return 'https://www.google.com/accounts/o8/id';
}
@@ -76,27 +75,84 @@ function withGoogleApps() {
return 'https://www.google.com/accounts/o8/site-xrds?ns=2&hd=' + document.fields.domain.value;
}
+function withLivejournal() {
+ return 'http://' + document.fields.ljuser.value + '.livejournal.com';
+}
+
+function withBlogspot() {
+ return 'http://' + document.fields.bsuser.value + '.blogspot.com';
+}
+
+function withBlogger() {
+ return 'http://' + document.fields.bguser.value + '.blogger.com';
+}
+
function withXRDSEndpoint() {
return document.fields.endpoint.value;
}
-</script>
-<form name="signin" action="/" method="GET">
-<input type="hidden" name="openid_identifier" value="https://www.google.com/accounts/o8/id"/>
-</form>
+function submitOAuthSignin(w) {
+ parms = w();
+ document.oauthSignin.mod_oauth_authorize.value = parms[0];
+ document.oauthSignin.mod_oauth_access_token.value = parms[1];
+ document.oauthSignin.mod_oauth_client_id.value = parms[2];
+ document.oauthSignin.mod_oauth_info.value = parms[3];
+ document.oauthSignin.action = openauthReferrer();
+ document.oauthSignin.submit();
+}
+
+function withFacebook() {
+ var parms = ['https://graph.facebook.com/oauth/authorize', 'https://graph.facebook.com/oauth/access_token', 'app1234', 'https://graph.facebook.com/me'];
+ return parms;
+}
+
+function withGithub() {
+ var parms = ['https://github.com/login/oauth/authorize', 'https://github.com/login/oauth/access_token', 'app2345', 'https://github.com/api/v2/json/user/show'];
+ return parms;
+}
+</script>
<form name="fields">
-<p>Sign in with your Google account<br/><input type="button" onclick="submitSignin(withGoogle)" value="Sign in"/></p>
-<p>Sign in with your Yahoo account<br/><input type="button" onclick="submitSignin(withYahoo)" value="Sign in"/></p>
-<p>Sign in with your MyOpenID account<br/><input type="button" onclick="submitSignin(withMyOpenID)" value="Sign in"/></p>
-<p>Sign in with your Verisign account<br/><input type="button" onclick="submitSignin(withVerisign)" value="Sign in"/></p>
-<p>Sign in with your MySpace account<br/><input type="button" onclick="submitSignin(withMySpace)" value="Sign in"/></p>
+<p>Sign in with your Google account<br/><input type="button" onclick="submitOpenIDSignin(withGoogle)" value="Sign in"/></p>
+<p>Sign in with your Yahoo account<br/><input type="button" onclick="submitOpenIDSignin(withYahoo)" value="Sign in"/></p>
+<p>Sign in with your MyOpenID account<br/><input type="button" onclick="submitOpenIDSignin(withMyOpenID)" value="Sign in"/></p>
+<p>Sign in with your Verisign account<br/><input type="button" onclick="submitOpenIDSignin(withVerisign)" value="Sign in"/></p>
+<p>Sign in with your MySpace account<br/><input type="button" onclick="submitOpenIDSignin(withMySpace)" value="Sign in"/></p>
+
<p>Sign in with a Google apps domain<br/>
<input type="text" size="20" name="domain" value="example.com"/><br/>
-<input type="button" onclick="submitSignin(withGoogleApps)" value="Sign in"/></p>
+<input type="button" onclick="submitOpenIDSignin(withGoogleApps)" value="Sign in"/></p>
+
+<p>Sign in with your Livejournal account<br/>
+<input type="text" size="10" name="ljuser" value=""/><br/>
+<input type="button" onclick="submitOpenIDSignin(withLivejournal)" value="Sign in"/></p>
+
+<p>Sign in with your Blogspot account<br/>
+<input type="text" size="10" name="bsuser" value=""/><br/>
+<input type="button" onclick="submitOpenIDSignin(withBlogspot)" value="Sign in"/></p>
+
+<p>Sign in with your Blogger account<br/>
+<input type="text" size="10" name="bguser" value=""/><br/>
+<input type="button" onclick="submitOpenIDSignin(withBlogger)" value="Sign in"/></p>
+
<p>Sign in with an OpenID endpoint<br/>
<input type="text" size="50" name="endpoint" value="https://www.google.com/accounts/o8/id"/><br/>
-<input type="button" onclick="submitSignin(withXRDSEndpoint)" value="Sign in"/></p>
+<input type="button" onclick="submitOpenIDSignin(withXRDSEndpoint)" value="Sign in"/></p>
+
+<p>Sign in with your Facebook account<br/><input type="button" onclick="submitOAuthSignin(withFacebook)" value="Sign in"/></p>
+<p>Sign in with your Github account<br/><input type="button" onclick="submitOAuthSignin(withGithub)" value="Sign in"/></p>
+</form>
+
+<form name="openIDSignin" action="/" method="GET">
+<input type="hidden" name="openid_identifier" value=""/>
+</form>
+
+<form name="oauthSignin" action="/" method="GET">
+<input type="hidden" name="mod_oauth_authorize" value=""/>
+<input type="hidden" name="mod_oauth_access_token" value=""/>
+<input type="hidden" name="mod_oauth_client_id" value=""/>
+<input type="hidden" name="mod_oauth_info" value=""/>
+<input type="hidden" name="mod_oauth_step" value="authorize"/>
</form>
</body></html>
diff --git a/sca-cpp/trunk/samples/store-cluster/htdocs/domains/joe/login/index.html b/sca-cpp/trunk/samples/store-cluster/htdocs/domains/joe/login/index.html
index e6b8c6fce3..16246cc621 100644
--- a/sca-cpp/trunk/samples/store-cluster/htdocs/domains/joe/login/index.html
+++ b/sca-cpp/trunk/samples/store-cluster/htdocs/domains/joe/login/index.html
@@ -17,7 +17,7 @@
under the License.
-->
-<html><body><h1>Sign in with an OpenID provider</h1>
+<html><body><h1>Sign in with an OpenID or OAuth 2.0 provider</h1>
<script type="text/javascript">
function queryParams() {
@@ -31,8 +31,8 @@ function queryParams() {
return qp;
}
-function openidReferrer() {
- r = queryParams()['modauthopenid.referrer'];
+function openauthReferrer() {
+ r = queryParams()['openauth_referrer'];
if (typeof(r) == 'undefined')
return r;
q = r.indexOf('?');
@@ -41,17 +41,16 @@ function openidReferrer() {
return r;
}
-if (typeof(openidReferrer()) == 'undefined') {
+if (typeof(openauthReferrer()) == 'undefined') {
document.location = '/';
}
-function submitSignin(w) {
- document.signin.openid_identifier.value = w();
- document.signin.action = openidReferrer();
- document.signin.submit();
+function submitOpenIDSignin(w) {
+ document.openIDSignin.openid_identifier.value = w();
+ document.openIDSignin.action = openauthReferrer();
+ document.openIDSignin.submit();
}
-
function withGoogle() {
return 'https://www.google.com/accounts/o8/id';
}
@@ -76,27 +75,84 @@ function withGoogleApps() {
return 'https://www.google.com/accounts/o8/site-xrds?ns=2&hd=' + document.fields.domain.value;
}
+function withLivejournal() {
+ return 'http://' + document.fields.ljuser.value + '.livejournal.com';
+}
+
+function withBlogspot() {
+ return 'http://' + document.fields.bsuser.value + '.blogspot.com';
+}
+
+function withBlogger() {
+ return 'http://' + document.fields.bguser.value + '.blogger.com';
+}
+
function withXRDSEndpoint() {
return document.fields.endpoint.value;
}
-</script>
-<form name="signin" action="/" method="GET">
-<input type="hidden" name="openid_identifier" value="https://www.google.com/accounts/o8/id"/>
-</form>
+function submitOAuthSignin(w) {
+ parms = w();
+ document.oauthSignin.mod_oauth_authorize.value = parms[0];
+ document.oauthSignin.mod_oauth_access_token.value = parms[1];
+ document.oauthSignin.mod_oauth_client_id.value = parms[2];
+ document.oauthSignin.mod_oauth_info.value = parms[3];
+ document.oauthSignin.action = openauthReferrer();
+ document.oauthSignin.submit();
+}
+
+function withFacebook() {
+ var parms = ['https://graph.facebook.com/oauth/authorize', 'https://graph.facebook.com/oauth/access_token', 'app1234', 'https://graph.facebook.com/me'];
+ return parms;
+}
+
+function withGithub() {
+ var parms = ['https://github.com/login/oauth/authorize', 'https://github.com/login/oauth/access_token', 'app2345', 'https://github.com/api/v2/json/user/show'];
+ return parms;
+}
+</script>
<form name="fields">
-<p>Sign in with your Google account<br/><input type="button" onclick="submitSignin(withGoogle)" value="Sign in"/></p>
-<p>Sign in with your Yahoo account<br/><input type="button" onclick="submitSignin(withYahoo)" value="Sign in"/></p>
-<p>Sign in with your MyOpenID account<br/><input type="button" onclick="submitSignin(withMyOpenID)" value="Sign in"/></p>
-<p>Sign in with your Verisign account<br/><input type="button" onclick="submitSignin(withVerisign)" value="Sign in"/></p>
-<p>Sign in with your MySpace account<br/><input type="button" onclick="submitSignin(withMySpace)" value="Sign in"/></p>
+<p>Sign in with your Google account<br/><input type="button" onclick="submitOpenIDSignin(withGoogle)" value="Sign in"/></p>
+<p>Sign in with your Yahoo account<br/><input type="button" onclick="submitOpenIDSignin(withYahoo)" value="Sign in"/></p>
+<p>Sign in with your MyOpenID account<br/><input type="button" onclick="submitOpenIDSignin(withMyOpenID)" value="Sign in"/></p>
+<p>Sign in with your Verisign account<br/><input type="button" onclick="submitOpenIDSignin(withVerisign)" value="Sign in"/></p>
+<p>Sign in with your MySpace account<br/><input type="button" onclick="submitOpenIDSignin(withMySpace)" value="Sign in"/></p>
+
<p>Sign in with a Google apps domain<br/>
<input type="text" size="20" name="domain" value="example.com"/><br/>
-<input type="button" onclick="submitSignin(withGoogleApps)" value="Sign in"/></p>
+<input type="button" onclick="submitOpenIDSignin(withGoogleApps)" value="Sign in"/></p>
+
+<p>Sign in with your Livejournal account<br/>
+<input type="text" size="10" name="ljuser" value=""/><br/>
+<input type="button" onclick="submitOpenIDSignin(withLivejournal)" value="Sign in"/></p>
+
+<p>Sign in with your Blogspot account<br/>
+<input type="text" size="10" name="bsuser" value=""/><br/>
+<input type="button" onclick="submitOpenIDSignin(withBlogspot)" value="Sign in"/></p>
+
+<p>Sign in with your Blogger account<br/>
+<input type="text" size="10" name="bguser" value=""/><br/>
+<input type="button" onclick="submitOpenIDSignin(withBlogger)" value="Sign in"/></p>
+
<p>Sign in with an OpenID endpoint<br/>
<input type="text" size="50" name="endpoint" value="https://www.google.com/accounts/o8/id"/><br/>
-<input type="button" onclick="submitSignin(withXRDSEndpoint)" value="Sign in"/></p>
+<input type="button" onclick="submitOpenIDSignin(withXRDSEndpoint)" value="Sign in"/></p>
+
+<p>Sign in with your Facebook account<br/><input type="button" onclick="submitOAuthSignin(withFacebook)" value="Sign in"/></p>
+<p>Sign in with your Github account<br/><input type="button" onclick="submitOAuthSignin(withGithub)" value="Sign in"/></p>
+</form>
+
+<form name="openIDSignin" action="/" method="GET">
+<input type="hidden" name="openid_identifier" value=""/>
+</form>
+
+<form name="oauthSignin" action="/" method="GET">
+<input type="hidden" name="mod_oauth_authorize" value=""/>
+<input type="hidden" name="mod_oauth_access_token" value=""/>
+<input type="hidden" name="mod_oauth_client_id" value=""/>
+<input type="hidden" name="mod_oauth_info" value=""/>
+<input type="hidden" name="mod_oauth_step" value="authorize"/>
</form>
</body></html>
diff --git a/sca-cpp/trunk/samples/store-cluster/htdocs/login/index.html b/sca-cpp/trunk/samples/store-cluster/htdocs/login/index.html
index e6b8c6fce3..16246cc621 100644
--- a/sca-cpp/trunk/samples/store-cluster/htdocs/login/index.html
+++ b/sca-cpp/trunk/samples/store-cluster/htdocs/login/index.html
@@ -17,7 +17,7 @@
under the License.
-->
-<html><body><h1>Sign in with an OpenID provider</h1>
+<html><body><h1>Sign in with an OpenID or OAuth 2.0 provider</h1>
<script type="text/javascript">
function queryParams() {
@@ -31,8 +31,8 @@ function queryParams() {
return qp;
}
-function openidReferrer() {
- r = queryParams()['modauthopenid.referrer'];
+function openauthReferrer() {
+ r = queryParams()['openauth_referrer'];
if (typeof(r) == 'undefined')
return r;
q = r.indexOf('?');
@@ -41,17 +41,16 @@ function openidReferrer() {
return r;
}
-if (typeof(openidReferrer()) == 'undefined') {
+if (typeof(openauthReferrer()) == 'undefined') {
document.location = '/';
}
-function submitSignin(w) {
- document.signin.openid_identifier.value = w();
- document.signin.action = openidReferrer();
- document.signin.submit();
+function submitOpenIDSignin(w) {
+ document.openIDSignin.openid_identifier.value = w();
+ document.openIDSignin.action = openauthReferrer();
+ document.openIDSignin.submit();
}
-
function withGoogle() {
return 'https://www.google.com/accounts/o8/id';
}
@@ -76,27 +75,84 @@ function withGoogleApps() {
return 'https://www.google.com/accounts/o8/site-xrds?ns=2&hd=' + document.fields.domain.value;
}
+function withLivejournal() {
+ return 'http://' + document.fields.ljuser.value + '.livejournal.com';
+}
+
+function withBlogspot() {
+ return 'http://' + document.fields.bsuser.value + '.blogspot.com';
+}
+
+function withBlogger() {
+ return 'http://' + document.fields.bguser.value + '.blogger.com';
+}
+
function withXRDSEndpoint() {
return document.fields.endpoint.value;
}
-</script>
-<form name="signin" action="/" method="GET">
-<input type="hidden" name="openid_identifier" value="https://www.google.com/accounts/o8/id"/>
-</form>
+function submitOAuthSignin(w) {
+ parms = w();
+ document.oauthSignin.mod_oauth_authorize.value = parms[0];
+ document.oauthSignin.mod_oauth_access_token.value = parms[1];
+ document.oauthSignin.mod_oauth_client_id.value = parms[2];
+ document.oauthSignin.mod_oauth_info.value = parms[3];
+ document.oauthSignin.action = openauthReferrer();
+ document.oauthSignin.submit();
+}
+
+function withFacebook() {
+ var parms = ['https://graph.facebook.com/oauth/authorize', 'https://graph.facebook.com/oauth/access_token', 'app1234', 'https://graph.facebook.com/me'];
+ return parms;
+}
+
+function withGithub() {
+ var parms = ['https://github.com/login/oauth/authorize', 'https://github.com/login/oauth/access_token', 'app2345', 'https://github.com/api/v2/json/user/show'];
+ return parms;
+}
+</script>
<form name="fields">
-<p>Sign in with your Google account<br/><input type="button" onclick="submitSignin(withGoogle)" value="Sign in"/></p>
-<p>Sign in with your Yahoo account<br/><input type="button" onclick="submitSignin(withYahoo)" value="Sign in"/></p>
-<p>Sign in with your MyOpenID account<br/><input type="button" onclick="submitSignin(withMyOpenID)" value="Sign in"/></p>
-<p>Sign in with your Verisign account<br/><input type="button" onclick="submitSignin(withVerisign)" value="Sign in"/></p>
-<p>Sign in with your MySpace account<br/><input type="button" onclick="submitSignin(withMySpace)" value="Sign in"/></p>
+<p>Sign in with your Google account<br/><input type="button" onclick="submitOpenIDSignin(withGoogle)" value="Sign in"/></p>
+<p>Sign in with your Yahoo account<br/><input type="button" onclick="submitOpenIDSignin(withYahoo)" value="Sign in"/></p>
+<p>Sign in with your MyOpenID account<br/><input type="button" onclick="submitOpenIDSignin(withMyOpenID)" value="Sign in"/></p>
+<p>Sign in with your Verisign account<br/><input type="button" onclick="submitOpenIDSignin(withVerisign)" value="Sign in"/></p>
+<p>Sign in with your MySpace account<br/><input type="button" onclick="submitOpenIDSignin(withMySpace)" value="Sign in"/></p>
+
<p>Sign in with a Google apps domain<br/>
<input type="text" size="20" name="domain" value="example.com"/><br/>
-<input type="button" onclick="submitSignin(withGoogleApps)" value="Sign in"/></p>
+<input type="button" onclick="submitOpenIDSignin(withGoogleApps)" value="Sign in"/></p>
+
+<p>Sign in with your Livejournal account<br/>
+<input type="text" size="10" name="ljuser" value=""/><br/>
+<input type="button" onclick="submitOpenIDSignin(withLivejournal)" value="Sign in"/></p>
+
+<p>Sign in with your Blogspot account<br/>
+<input type="text" size="10" name="bsuser" value=""/><br/>
+<input type="button" onclick="submitOpenIDSignin(withBlogspot)" value="Sign in"/></p>
+
+<p>Sign in with your Blogger account<br/>
+<input type="text" size="10" name="bguser" value=""/><br/>
+<input type="button" onclick="submitOpenIDSignin(withBlogger)" value="Sign in"/></p>
+
<p>Sign in with an OpenID endpoint<br/>
<input type="text" size="50" name="endpoint" value="https://www.google.com/accounts/o8/id"/><br/>
-<input type="button" onclick="submitSignin(withXRDSEndpoint)" value="Sign in"/></p>
+<input type="button" onclick="submitOpenIDSignin(withXRDSEndpoint)" value="Sign in"/></p>
+
+<p>Sign in with your Facebook account<br/><input type="button" onclick="submitOAuthSignin(withFacebook)" value="Sign in"/></p>
+<p>Sign in with your Github account<br/><input type="button" onclick="submitOAuthSignin(withGithub)" value="Sign in"/></p>
+</form>
+
+<form name="openIDSignin" action="/" method="GET">
+<input type="hidden" name="openid_identifier" value=""/>
+</form>
+
+<form name="oauthSignin" action="/" method="GET">
+<input type="hidden" name="mod_oauth_authorize" value=""/>
+<input type="hidden" name="mod_oauth_access_token" value=""/>
+<input type="hidden" name="mod_oauth_client_id" value=""/>
+<input type="hidden" name="mod_oauth_info" value=""/>
+<input type="hidden" name="mod_oauth_step" value="authorize"/>
</form>
</body></html>
diff --git a/sca-cpp/trunk/samples/store-cluster/server-ssl-conf b/sca-cpp/trunk/samples/store-cluster/server-ssl-conf
index 37a654b805..0b54b5cbf3 100755
--- a/sca-cpp/trunk/samples/store-cluster/server-ssl-conf
+++ b/sca-cpp/trunk/samples/store-cluster/server-ssl-conf
@@ -32,6 +32,11 @@ tar -C tmp/ssl -c `../../modules/http/ssl-cert-find tmp/ssl` | tar -C $root -x
../../modules/http/vhost-ssl-conf $root
#../../modules/http/httpd-auth-conf $root
+../../modules/oauth/oauth-conf $root
+../../modules/oauth/oauth-memcached-conf $root localhost 11211
+../../modules/oauth/oauth-memcached-conf $root localhost 11212
+../../modules/oauth/oauth-memcached-conf $root localhost 11213
+../../modules/oauth/oauth-app-conf $root app1234 secret6789
../../modules/openid/openid-conf $root
../../modules/openid/openid-step2-conf $root
../../modules/openid/openid-memcached-conf $root localhost 11211