From 54b61a4f65fb36be0bc3f190707aac2c4226a4a9 Mon Sep 17 00:00:00 2001 From: jsdelfino Date: Mon, 2 Apr 2012 06:23:35 +0000 Subject: Support multiple Auth modules in a single server or proxy config. Minor fixes to the OAuth2 module to comply with the spec. git-svn-id: http://svn.us.apache.org/repos/asf/tuscany@1308244 13f79535-47bb-0310-9956-ffa450edef68 --- sca-cpp/trunk/hosting/server/htdocs/app/index.html | 6 +- sca-cpp/trunk/hosting/server/htdocs/index.html | 10 +- .../trunk/hosting/server/htdocs/login/index.html | 83 +++++++++----- .../server/htdocs/public/notauth/index.html | 5 +- .../server/htdocs/public/notfound/index.html | 5 +- .../hosting/server/htdocs/public/notyet/index.html | 5 +- .../hosting/server/htdocs/public/oops/index.html | 5 +- sca-cpp/trunk/hosting/server/ssl-start | 52 ++++----- sca-cpp/trunk/modules/http/basic-auth-conf | 7 +- sca-cpp/trunk/modules/http/form-auth-conf | 6 +- sca-cpp/trunk/modules/http/htdocs/login/index.html | 3 +- .../trunk/modules/http/htdocs/logout/index.html | 3 +- sca-cpp/trunk/modules/http/http.hpp | 82 +++++++++----- sca-cpp/trunk/modules/http/httpd-conf | 40 +++++-- sca-cpp/trunk/modules/http/httpd-ssl-conf | 1 + sca-cpp/trunk/modules/http/httpd.hpp | 18 +-- sca-cpp/trunk/modules/http/mod-openauth.cpp | 28 ++--- sca-cpp/trunk/modules/http/open-auth-conf | 21 +++- sca-cpp/trunk/modules/http/openauth.hpp | 14 +-- sca-cpp/trunk/modules/http/proxy-conf | 20 ++++ sca-cpp/trunk/modules/http/proxy-ssl-conf | 12 +- sca-cpp/trunk/modules/js/htdocs/ui.js | 7 -- sca-cpp/trunk/modules/js/htdocs/util.js | 22 ++++ .../trunk/modules/oauth/htdocs/login/index.html | 70 +++++++----- .../trunk/modules/oauth/htdocs/login/mixed.html | 76 +++++++------ .../trunk/modules/oauth/htdocs/logout/index.html | 11 +- sca-cpp/trunk/modules/oauth/mod-oauth1.cpp | 87 +++++++-------- sca-cpp/trunk/modules/oauth/mod-oauth2.cpp | 123 ++++++++++++--------- sca-cpp/trunk/modules/oauth/start-mixed-test | 25 +++-- sca-cpp/trunk/modules/oauth/start-test | 21 ++-- .../trunk/modules/openid/htdocs/login/index.html | 11 +- .../trunk/modules/openid/htdocs/logout/index.html | 11 +- sca-cpp/trunk/modules/openid/openid-conf | 2 +- sca-cpp/trunk/modules/openid/start-test | 6 +- .../domains/jane/htdocs/login/index.html | 69 ++++++------ .../domains/jane/htdocs/logout/index.html | 3 +- .../domains/joe/htdocs/login/index.html | 69 ++++++------ .../domains/joe/htdocs/logout/index.html | 6 +- .../samples/store-cluster/htdocs/login/index.html | 69 ++++++------ .../samples/store-cluster/htdocs/logout/index.html | 3 +- .../samples/store-python/htdocs/login/index.html | 3 +- .../samples/store-python/htdocs/logout/index.html | 3 +- 42 files changed, 670 insertions(+), 453 deletions(-) (limited to 'sca-cpp') diff --git a/sca-cpp/trunk/hosting/server/htdocs/app/index.html b/sca-cpp/trunk/hosting/server/htdocs/app/index.html index 0b01c1d3bd..19fa7488a5 100644 --- a/sca-cpp/trunk/hosting/server/htdocs/app/index.html +++ b/sca-cpp/trunk/hosting/server/htdocs/app/index.html @@ -74,8 +74,12 @@ appcache.get = function(uri) { document.head.appendChild(ui.declareCSS(appcache.get('/ui-min.css'))); })(); + + + diff --git a/sca-cpp/trunk/hosting/server/htdocs/index.html b/sca-cpp/trunk/hosting/server/htdocs/index.html index 3bc1529dbb..468461cedc 100644 --- a/sca-cpp/trunk/hosting/server/htdocs/index.html +++ b/sca-cpp/trunk/hosting/server/htdocs/index.html @@ -74,8 +74,11 @@ appcache.get = function(uri) { document.head.appendChild(ui.declareCSS(appcache.get('/ui-min.css'))); })(); + + @@ -260,7 +263,7 @@ function showmenu(mdiv, view, appname) { ui.menu(isNil(config.compose)? 'Composition' : config.compose, '/#view=graph&app=' + appname, '_view', view == 'graph'))), mklist( ui.menu('Account', '/#view=account', '_view', view == 'account'), - ui.signedin()? ui.menufunc('Sign out', 'logout();', false) : ui.menu('Sign in', '/login/', '_self', false))); + hasauthcookie()? ui.menufunc('Sign out', 'logout();', false) : ui.menu('Sign in', '/login/', '_self', false))); } /** @@ -434,8 +437,7 @@ window.onloginredirect = function(e) { */ function logout() { // Clear session cookie and user-specific local storage entries - var reset = 'TuscanyOpenAuth=; expires=' + new Date(1970,01,01).toGMTString() + '; domain=.' + domainname(window.location.hostname) + '; path=/'; - document.cookie = reset; + clearauthcookie(); localStorage.removeItem('/r/EditWidget/accounts'); localStorage.removeItem('/r/EditWidget/dashboards'); //localStorage.clear(); diff --git a/sca-cpp/trunk/hosting/server/htdocs/login/index.html b/sca-cpp/trunk/hosting/server/htdocs/login/index.html index 9052abe8d3..359afc1807 100644 --- a/sca-cpp/trunk/hosting/server/htdocs/login/index.html +++ b/sca-cpp/trunk/hosting/server/htdocs/login/index.html @@ -32,31 +32,50 @@

Sign in

-
+ - - + +
Sign in with your Google account
Sign in with your Google account (using OpenID)
-
+ - - + +
Sign in with your Facebook account
Sign in with your Facebook account (using OAuth)
+
+ + + +
Sign in with your Google account (using OAuth)
+
+ +
+ + + + + +
Sign in with your user id and password
User id:
Password:
+

+ +
+
-
- - - - - - + + + + + + + +
@@ -189,20 +190,22 @@ function withTwitter() {
- - - - - + + + + + + +
- - - - - - + + + + + +
diff --git a/sca-cpp/trunk/samples/store-cluster/domains/jane/htdocs/logout/index.html b/sca-cpp/trunk/samples/store-cluster/domains/jane/htdocs/logout/index.html index 56dfa71962..91608a6523 100644 --- a/sca-cpp/trunk/samples/store-cluster/domains/jane/htdocs/logout/index.html +++ b/sca-cpp/trunk/samples/store-cluster/domains/jane/htdocs/logout/index.html @@ -33,8 +33,7 @@
@@ -189,20 +190,22 @@ function withTwitter() {
- - - - - + + + + + + +
- - - - - - + + + + + +
diff --git a/sca-cpp/trunk/samples/store-cluster/domains/joe/htdocs/logout/index.html b/sca-cpp/trunk/samples/store-cluster/domains/joe/htdocs/logout/index.html index 5f7880d626..91608a6523 100644 --- a/sca-cpp/trunk/samples/store-cluster/domains/joe/htdocs/logout/index.html +++ b/sca-cpp/trunk/samples/store-cluster/domains/joe/htdocs/logout/index.html @@ -33,12 +33,12 @@
- + + 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 5bdd1132be..fcad40bf8a 100644 --- a/sca-cpp/trunk/samples/store-cluster/htdocs/login/index.html +++ b/sca-cpp/trunk/samples/store-cluster/htdocs/login/index.html @@ -45,7 +45,7 @@ function queryParams() { function openauthReferrer() { r = queryParams()['openauth_referrer']; if (typeof(r) == 'undefined') - return r; + return '/'; q = r.indexOf('?'); if (q > 0) return r.substring(0, q); @@ -57,8 +57,7 @@ if (typeof(openauthReferrer()) == 'undefined') { } function submitOpenIDSignin(w) { - var reset = 'TuscanyOpenAuth=;expires=' + new Date(1970,01,01).toGMTString() + ';domain=.' + domainname(window.location.hostname) + ';path=/;secure=TRUE'; - document.cookie = reset; + clearauthcookie(); document.openIDSignin.openid_identifier.value = w(); document.openIDSignin.action = openauthReferrer(); document.openIDSignin.submit(); @@ -106,46 +105,48 @@ function withXRDSEndpoint() { function submitOAuth2Signin(w) { parms = w(); - var reset = 'TuscanyOpenAuth=;expires=' + new Date(1970,01,01).toGMTString() + ';domain=.' + domainname(window.location.hostname) + ';path=/;secure=TRUE'; - document.cookie = reset; - document.oauth2Signin.mod_oauth2_authorize.value = parms[0]; - document.oauth2Signin.mod_oauth2_access_token.value = parms[1]; - document.oauth2Signin.mod_oauth2_client_id.value = parms[2]; - document.oauth2Signin.mod_oauth2_info.value = parms[3]; - document.oauth2Signin.action = openauthReferrer(); + clearauthcookie(); + document.oauth2Signin.oauth2_authorize.value = parms[0]; + document.oauth2Signin.oauth2_access_token.value = parms[1]; + document.oauth2Signin.oauth2_client_id.value = parms[2]; + document.oauth2Signin.oauth2_info.value = parms[3]; + document.oauth2Signin.oauth2_scope.value = parms[4]; + document.oauth2Signin.oauth2_display.value = parms[5]; + document.oauth2Signin.openauth_referrer.value = openauthReferrer(); + document.oauth2Signin.action = '/oauth2/authorize/'; document.oauth2Signin.submit(); } function withFacebook() { - var parms = ['https://graph.facebook.com/oauth/authorize', 'https://graph.facebook.com/oauth/access_token', 'testfacebookapp', 'https://graph.facebook.com/me']; + var parms = ['https://graph.facebook.com/oauth/authorize', 'https://graph.facebook.com/oauth/access_token', 'facebook.com', 'https://graph.facebook.com/me', 'email', 'page']; return parms; } function withGithub() { - var parms = ['https://github.com/login/oauth/authorize', 'https://github.com/login/oauth/access_token', 'testgithubapp', 'https://github.com/api/v2/json/user/show']; + var parms = ['https://github.com/login/oauth/authorize', 'https://github.com/login/oauth/access_token', 'github.com', 'https://github.com/api/v2/json/user/show', 'email', '']; return parms; } function submitOAuth1Signin(w) { parms = w(); - var reset = 'TuscanyOpenAuth=;expires=' + new Date(1970,01,01).toGMTString() + ';domain=.' + domainname(window.location.hostname) + ';path=/;secure=TRUE'; - document.cookie = reset; - document.oauth1Signin.mod_oauth1_request_token.value = parms[0]; - document.oauth1Signin.mod_oauth1_authorize.value = parms[1]; - document.oauth1Signin.mod_oauth1_access_token.value = parms[2]; - document.oauth1Signin.mod_oauth1_client_id.value = parms[3]; - document.oauth1Signin.mod_oauth1_info.value = parms[4]; - document.oauth1Signin.action = openauthReferrer(); + clearauthcookie(); + document.oauth1Signin.oauth1_request_token.value = parms[0]; + document.oauth1Signin.oauth1_authorize.value = parms[1]; + document.oauth1Signin.oauth1_access_token.value = parms[2]; + document.oauth1Signin.oauth1_client_id.value = parms[3]; + document.oauth1Signin.oauth1_info.value = parms[4]; + document.oauth1Signin.openauth_referrer.value = openauthReferrer(); + document.oauth1Signin.action = '/oauth1/authorize/'; document.oauth1Signin.submit(); } function withLinkedin() { - var parms = ['https://api.linkedin.com/uas/oauth/requestToken', 'https://www.linkedin.com/uas/oauth/authorize', 'https://api.linkedin.com/uas/oauth/accessToken', 'testlinkedinapp', 'https://api.linkedin.com/v1/people/~:(id,first-name,last-name,public-profile-url)']; + var parms = ['https://api.linkedin.com/uas/oauth/requestToken', 'https://www.linkedin.com/uas/oauth/authorize', 'https://api.linkedin.com/uas/oauth/accessToken', 'linkedin.com', 'https://api.linkedin.com/v1/people/~:(id,first-name,last-name,public-profile-url)']; return parms; } function withTwitter() { - var parms = ['https://api.twitter.com/oauth/request_token', 'https://api.twitter.com/oauth/authorize', 'https://api.twitter.com/oauth/access_token', 'testtwitterapp', 'https://api.twitter.com/1/statuses/user_timeline.json']; + var parms = ['https://api.twitter.com/oauth/request_token', 'https://api.twitter.com/oauth/authorize', 'https://api.twitter.com/oauth/access_token', 'twitter.com', 'https://api.twitter.com/1/statuses/user_timeline.json']; return parms; } @@ -189,20 +190,22 @@ function withTwitter() {
- - - - - + + + + + + +
- - - - - - + + + + + +
diff --git a/sca-cpp/trunk/samples/store-cluster/htdocs/logout/index.html b/sca-cpp/trunk/samples/store-cluster/htdocs/logout/index.html index 56dfa71962..91608a6523 100644 --- a/sca-cpp/trunk/samples/store-cluster/htdocs/logout/index.html +++ b/sca-cpp/trunk/samples/store-cluster/htdocs/logout/index.html @@ -33,8 +33,7 @@