diff options
author | jsdelfino <jsdelfino@13f79535-47bb-0310-9956-ffa450edef68> | 2010-09-06 23:26:11 +0000 |
---|---|---|
committer | jsdelfino <jsdelfino@13f79535-47bb-0310-9956-ffa450edef68> | 2010-09-06 23:26:11 +0000 |
commit | f75296a86350e41c01a355c945ca348082260cf9 (patch) | |
tree | 7635ae4a46ab4904609c7b662acc04a3c0f6efa8 /sca-cpp/trunk/modules/oauth/htdocs/login | |
parent | cc3bc602c8cb2c10aa542eab1e480d8604760007 (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 '')
-rw-r--r-- | sca-cpp/trunk/modules/oauth/htdocs/login/index.html | 10 | ||||
-rw-r--r-- | sca-cpp/trunk/modules/oauth/htdocs/login/mixed.html | 158 |
2 files changed, 163 insertions, 5 deletions
diff --git a/sca-cpp/trunk/modules/oauth/htdocs/login/index.html b/sca-cpp/trunk/modules/oauth/htdocs/login/index.html index fcf5a870c0..a8ed099fae 100644 --- a/sca-cpp/trunk/modules/oauth/htdocs/login/index.html +++ b/sca-cpp/trunk/modules/oauth/htdocs/login/index.html @@ -32,7 +32,7 @@ function queryParams() { } function oauthReferrer() { - r = queryParams()['mod_oauth_referrer']; + r = queryParams()['openauth_referrer']; if (typeof(r) == 'undefined') return r; q = r.indexOf('?'); @@ -67,10 +67,10 @@ function withGithub() { </script> <form name="signin" action="/" method="GET"> -<input type="hidden" name="mod_oauth_authorize" value="https://graph.facebook.com/oauth/authorize"/> -<input type="hidden" name="mod_oauth_access_token" value="https://graph.facebook.com/oauth/access_token"/> -<input type="hidden" name="mod_oauth_client_id" value="app1234"/> -<input type="hidden" name="mod_oauth_info" value="https://graph.facebook.com/me"/> +<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> diff --git a/sca-cpp/trunk/modules/oauth/htdocs/login/mixed.html b/sca-cpp/trunk/modules/oauth/htdocs/login/mixed.html new file mode 100644 index 0000000000..16246cc621 --- /dev/null +++ b/sca-cpp/trunk/modules/oauth/htdocs/login/mixed.html @@ -0,0 +1,158 @@ +<!-- + Licensed to the Apache Software Foundation (ASF) under one + or more contributor license agreements. See the NOTICE file + distributed with this work for additional information + regarding copyright ownership. The ASF licenses this file + to you under the Apache License, Version 2.0 (the + "License"); you may not use this file except in compliance + with the License. You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, + software distributed under the License is distributed on an + "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + KIND, either express or implied. See the License for the + specific language governing permissions and limitations + under the License. +--> + +<html><body><h1>Sign in with an OpenID or OAuth 2.0 provider</h1> + +<script type="text/javascript"> +function queryParams() { + qp = new Array(); + qs = window.location.search.substring(1).split('&'); + for (i = 0; i < qs.length; i++) { + e = qs[i].indexOf('='); + if (e > 0) + qp[qs[i].substring(0, e)] = unescape(qs[i].substring(e + 1)); + } + return qp; +} + +function openauthReferrer() { + r = queryParams()['openauth_referrer']; + if (typeof(r) == 'undefined') + return r; + q = r.indexOf('?'); + if (q > 0) + return r.substring(0, q); + return r; +} + +if (typeof(openauthReferrer()) == 'undefined') { + document.location = '/'; +} + +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'; +} + +function withYahoo() { + return 'https://me.yahoo.com/'; +} + +function withMyOpenID() { + return 'http://www.myopenid.com/xrds'; +} + +function withVerisign() { + return 'https://pip.verisignlabs.com/'; +} + +function withMySpace() { + return 'https://api.myspace.com/openid'; +} + +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; +} + +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="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="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="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> |