summaryrefslogtreecommitdiffstats
path: root/sca-cpp/trunk/modules/edit/htdocs
diff options
context:
space:
mode:
authorjsdelfino <jsdelfino@13f79535-47bb-0310-9956-ffa450edef68>2011-11-14 07:10:15 +0000
committerjsdelfino <jsdelfino@13f79535-47bb-0310-9956-ffa450edef68>2011-11-14 07:10:15 +0000
commit4bf0a7052b448315eda710857acafe24bb112a5b (patch)
tree89b47bf8471da886a2c523721d76c6ebd5860c28 /sca-cpp/trunk/modules/edit/htdocs
parent1b4cab13b70f2d596ecb98e81073dbb45e0e85df (diff)
Change authentication scheme from Form based auth to OpenID + OAuth.
git-svn-id: http://svn.us.apache.org/repos/asf/tuscany@1201614 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'sca-cpp/trunk/modules/edit/htdocs')
-rw-r--r--sca-cpp/trunk/modules/edit/htdocs/app/cache-manifest.cmf8
-rw-r--r--sca-cpp/trunk/modules/edit/htdocs/app/index.html20
-rw-r--r--sca-cpp/trunk/modules/edit/htdocs/cache-manifest.cmf8
-rw-r--r--sca-cpp/trunk/modules/edit/htdocs/index.html24
-rw-r--r--sca-cpp/trunk/modules/edit/htdocs/login/index.html97
-rw-r--r--sca-cpp/trunk/modules/edit/htdocs/logout/index.html8
-rw-r--r--sca-cpp/trunk/modules/edit/htdocs/public/notauth/index.html (renamed from sca-cpp/trunk/modules/edit/htdocs/notauth/index.html)11
-rw-r--r--sca-cpp/trunk/modules/edit/htdocs/public/notfound/index.html (renamed from sca-cpp/trunk/modules/edit/htdocs/notfound/index.html)11
-rw-r--r--sca-cpp/trunk/modules/edit/htdocs/public/notyet/index.html (renamed from sca-cpp/trunk/modules/edit/htdocs/notyet/index.html)11
-rw-r--r--sca-cpp/trunk/modules/edit/htdocs/public/oops/index.html (renamed from sca-cpp/trunk/modules/edit/htdocs/oops/index.html)11
10 files changed, 143 insertions, 66 deletions
diff --git a/sca-cpp/trunk/modules/edit/htdocs/app/cache-manifest.cmf b/sca-cpp/trunk/modules/edit/htdocs/app/cache-manifest.cmf
index b478c7cd3d..6ea53970aa 100644
--- a/sca-cpp/trunk/modules/edit/htdocs/app/cache-manifest.cmf
+++ b/sca-cpp/trunk/modules/edit/htdocs/app/cache-manifest.cmf
@@ -4,12 +4,12 @@ CACHE MANIFEST
# App resources
/favicon.ico
-/notauth/
-/notfound/
-/notyet/
-/oops/
/public/iframe-min.html
/public/img.png
+/public/notauth/
+/public/notfound/
+/public/notyet/
+/public/oops/
/public/touchicon.png
NETWORK:
diff --git a/sca-cpp/trunk/modules/edit/htdocs/app/index.html b/sca-cpp/trunk/modules/edit/htdocs/app/index.html
index 97ea0a3f79..0b01c1d3bd 100644
--- a/sca-cpp/trunk/modules/edit/htdocs/app/index.html
+++ b/sca-cpp/trunk/modules/edit/htdocs/app/index.html
@@ -48,6 +48,8 @@ appcache.get = function(uri) {
if (http.status == 200) {
if (http.getResponseHeader("X-Login") != null) {
if (log) log('http error', u, 'X-Login');
+ // Redirect to login page if not signed in
+ document.location = '/login/';
return null;
} else if (http.responseText == '' || http.getResponseHeader("Content-Type") == null) {
if (log) log('http error', u, 'No-Content');
@@ -57,6 +59,9 @@ appcache.get = function(uri) {
return http.responseText;
}
if (log) log('http error', u, http.status, http.statusText);
+ // Redirect to login page if not signed in
+ if (http.status == 403)
+ document.location = '/login/';
return null;
};
@@ -69,6 +74,10 @@ appcache.get = function(uri) {
document.head.appendChild(ui.declareCSS(appcache.get('/ui-min.css')));
})();
+// Redirect to login page if not signed in
+if (document.location.protocol == 'https:' && !ui.signedin())
+ document.location = '/login/';
+
</script>
</head>
<body class="delayed" onload="onload();">
@@ -77,7 +86,7 @@ appcache.get = function(uri) {
<div id="headdiv" class="hsection">
<script type="text/javascript">
(function() {
-$('headdiv').appendChild(ui.declareScript(appcache.get('/headconfig-min.js')));
+$('headdiv').appendChild(ui.declareScript(appcache.get('/config-min.js')));
})();
</script>
</div>
@@ -117,8 +126,8 @@ var locationcomp = sca.httpclient('location', '/' + appname + '/location');
var appresources = [
['/all-min.js'],
['/ui-min.css'],
- ['/footconfig-min.js'],
- ['/headconfig-min.js'],
+ ['/config-min.js'],
+ ['/public/config-min.js']
];
/**
@@ -889,11 +898,6 @@ function onload() {
</script>
<div id="footdiv" class="fsection">
-<script type="text/javascript">
-(function() {
-$('footdiv').appendChild(ui.declareScript(appcache.get('/footconfig-min.js')));
-})();
-</script>
</div>
</div>
diff --git a/sca-cpp/trunk/modules/edit/htdocs/cache-manifest.cmf b/sca-cpp/trunk/modules/edit/htdocs/cache-manifest.cmf
index 0be3e662d7..cb76f773a3 100644
--- a/sca-cpp/trunk/modules/edit/htdocs/cache-manifest.cmf
+++ b/sca-cpp/trunk/modules/edit/htdocs/cache-manifest.cmf
@@ -5,12 +5,12 @@ CACHE MANIFEST
# App resources
/
/favicon.ico
-/notauth/
-/notfound/
-/notyet/
-/oops/
/public/iframe-min.html
/public/img.png
+/public/notauth/
+/public/notfound/
+/public/notyet/
+/public/oops/
/public/touchicon.png
NETWORK:
diff --git a/sca-cpp/trunk/modules/edit/htdocs/index.html b/sca-cpp/trunk/modules/edit/htdocs/index.html
index 547c11652a..0a57717a06 100644
--- a/sca-cpp/trunk/modules/edit/htdocs/index.html
+++ b/sca-cpp/trunk/modules/edit/htdocs/index.html
@@ -48,6 +48,8 @@ appcache.get = function(uri) {
if (http.status == 200) {
if (http.getResponseHeader("X-Login") != null) {
if (log) log('http error', u, 'X-Login');
+ // Redirect to login page if not signed in
+ document.location = '/login/';
return null;
} else if (http.responseText == '' || http.getResponseHeader("Content-Type") == null) {
if (log) log('http error', u, 'No-Content');
@@ -57,6 +59,9 @@ appcache.get = function(uri) {
return http.responseText;
}
if (log) log('http error', u, http.status, http.statusText);
+ // Redirect to login page if not signed in
+ if (http.status == 403)
+ document.location = '/login/';
return null;
};
@@ -69,6 +74,10 @@ appcache.get = function(uri) {
document.head.appendChild(ui.declareCSS(appcache.get('/ui-min.css')));
})();
+// Redirect to login page if not signed in
+if (document.location.protocol == 'https:' && !ui.signedin())
+ document.location = '/login/';
+
</script>
</head>
<body class="delayed" onload="onload();">
@@ -77,7 +86,7 @@ appcache.get = function(uri) {
<div id="headdiv" class="hsection">
<script type="text/javascript">
(function() {
-$('headdiv').appendChild(ui.declareScript(appcache.get('/headconfig-min.js')));
+$('headdiv').appendChild(ui.declareScript(appcache.get('/config-min.js')));
})();
</script>
</div>
@@ -117,13 +126,13 @@ var appresources = [
['/account/', 'flip'],
['/clone/', 'flip'],
['/create/', 'flip'],
- ['/footconfig-min.js'],
['/graph/', 'flip'],
- ['/headconfig-min.js'],
+ ['/config-min.js'],
['/home/', 'right'],
['/home/home.b64'],
['/page/', 'flip'],
['/public/app.b64'],
+ ['/public/config-min.js'],
['/public/grid72.b64'],
['/public/iframe-min.html'],
['/public/img.b64'],
@@ -249,7 +258,9 @@ function showmenu(mdiv, view, appname) {
ui.menu('Stats', '/#view=stats&app=' + appname, '_view', view == 'stats'),
ui.menu('Page', '/#view=page&app=' + appname, '_view', view == 'page'),
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.menu('Sign out', '/logout/', '_self', false)));
+ mklist(
+ ui.menu('Account', '/#view=account', '_view', view == 'account'),
+ ui.signedin()? ui.menu('Sign out', '/logout/', '_self', false) : ui.menu('Sign in', '/login/', '_self', false)));
}
/**
@@ -486,11 +497,6 @@ function onload() {
</script>
<div id="footdiv" class="fsection">
-<script type="text/javascript">
-(function() {
-$('footdiv').appendChild(ui.declareScript(appcache.get('/footconfig-min.js')));
-})();
-</script>
</div>
</div>
diff --git a/sca-cpp/trunk/modules/edit/htdocs/login/index.html b/sca-cpp/trunk/modules/edit/htdocs/login/index.html
index 76709af15e..982f8cf446 100644
--- a/sca-cpp/trunk/modules/edit/htdocs/login/index.html
+++ b/sca-cpp/trunk/modules/edit/htdocs/login/index.html
@@ -32,7 +32,8 @@
<h1>Sign in</h1>
-<form name="formSignin" onsubmit="submitSignin();" method="POST" action="/login/dologin/">
+<!--
+<form name="passwordSignin" onsubmit="submitPasswordSignin();" method="POST" action="/login/dologin/">
<table border="0">
<tr><td><b>Username:</b></td></tr>
<tr><td><input type="text" id="httpd_username" name="httpd_username" value="" size="15" autocapitalize="off" placeholder="Enter your user name" style="width: 300px;"/></td></tr>
@@ -42,6 +43,33 @@
</table>
<input type="hidden" name="httpd_location" value="/"/>
</form>
+-->
+
+<form name="openIDForm">
+<table border="0">
+<tr><td><b>Sign in with your Google account</b></td></tr>
+<tr><td><input type="button" value="Sign in" class="graybutton" style="font-weight: bold;" onclick="submitOpenIDSignin(withGoogle)"/></td></tr>
+</table>
+</form>
+
+<form name="oauth2Form">
+<table border="0">
+<tr><td><b>Sign in with your Facebook account</b></td></tr>
+<tr><td><input type="button" value="Sign in" class="graybutton" style="font-weight: bold;" onclick="submitOAuth2Signin(withFacebook)"/></td></tr>
+</table>
+</form>
+
+<form name="openIDSignin" action="/" method="GET">
+<input type="hidden" name="openid_identifier" value=""/>
+</form>
+
+<form name="oauth2Signin" action="/" method="GET">
+<input type="hidden" name="mod_oauth2_authorize" value=""/>
+<input type="hidden" name="mod_oauth2_access_token" value=""/>
+<input type="hidden" name="mod_oauth2_client_id" value=""/>
+<input type="hidden" name="mod_oauth2_info" value=""/>
+<input type="hidden" name="mod_oauth2_step" value="authorize"/>
+</form>
<script type="text/javascript">
function queryParams() {
@@ -55,7 +83,7 @@ function queryParams() {
return qp;
}
-function oauthReferrer() {
+function formReferrer() {
r = queryParams()['openauth_referrer'];
if (typeof(r) == 'undefined')
return '/';
@@ -68,11 +96,68 @@ function oauthReferrer() {
return r;
}
-function submitSignin() {
- var reset = 'TuscanyOpenAuth=;expires=' + new Date(1970,01,01).toGMTString() + ';domain=.' + domainname(window.location.hostname) + ';path=/';
+function openauthReferrer() {
+ r = queryParams()['openauth_referrer'];
+ if (typeof(r) == 'undefined')
+ return '/';
+ q = r.indexOf('?');
+ if (q > 0)
+ return r.substring(0, q);
+ return r;
+}
+
+/**
+ * Signin with a userid and password.
+ */
+function submitPasswordSignin() {
+ var reset = 'TuscanyOpenAuth=; expires=' + new Date(1970,01,01).toGMTString() + '; domain=.' + domainname(window.location.hostname) + '; path=/';
+ document.cookie = reset;
+ localStorage.removeItem('/r/EditWidget/accounts');
+ localStorage.removeItem('/r/EditWidget/dashboards');
+ //localStorage.clear();
+ document.passwordSignin.httpd_location.value = formReferrer();
+ document.passwordSignin.submit();
+}
+
+/**
+ * Signin with OpenID.
+ */
+function submitOpenIDSignin(w) {
+ var reset = 'TuscanyOpenAuth=; expires=' + new Date(1970,01,01).toGMTString() + '; domain=.' + domainname(window.location.hostname) + '; path=/';
+ document.cookie = reset;
+ localStorage.removeItem('/r/EditWidget/accounts');
+ localStorage.removeItem('/r/EditWidget/dashboards');
+ //localStorage.clear();
+ document.openIDSignin.openid_identifier.value = w();
+ document.openIDSignin.action = openauthReferrer();
+ document.openIDSignin.submit();
+}
+
+function withGoogle() {
+ return 'https://www.google.com/accounts/o8/id';
+}
+
+/**
+ * Signin with OAuth 2.0.
+ */
+function submitOAuth2Signin(w) {
+ parms = w();
+ var reset = 'TuscanyOpenAuth=; expires=' + new Date(1970,01,01).toGMTString() + '; domain=.' + domainname(window.location.hostname) + '; path=/';
document.cookie = reset;
- document.formSignin.httpd_location.value = oauthReferrer();
- document.formSignin.submit();
+ localStorage.removeItem('/r/EditWidget/accounts');
+ localStorage.removeItem('/r/EditWidget/dashboards');
+ //localStorage.clear();
+ 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();
+ document.oauth2Signin.submit();
+}
+
+function withFacebook() {
+ var parms = ['https://graph.facebook.com/oauth/authorize', 'https://graph.facebook.com/oauth/access_token', 'facebook.com', 'https://graph.facebook.com/me'];
+ return parms;
}
/**
diff --git a/sca-cpp/trunk/modules/edit/htdocs/logout/index.html b/sca-cpp/trunk/modules/edit/htdocs/logout/index.html
index f5dd06ee99..133b6b7348 100644
--- a/sca-cpp/trunk/modules/edit/htdocs/logout/index.html
+++ b/sca-cpp/trunk/modules/edit/htdocs/logout/index.html
@@ -32,16 +32,18 @@
<h1>Sign out</h1>
-<form name="signout" onsubmit="submitSignout();" action="/" method="GET">
+<form name="signout" onsubmit="submitSignout();" action="/login/" method="GET">
<input type="submit" id="signOut" value="Sign out" class="graybutton" style="font-weight: bold"/>
</form>
<script type="text/javascript">
function submitSignout() {
- // Clear session cookie and local storage
+ // 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;
- localStorage.clear();
+ localStorage.removeItem('/r/EditWidget/accounts');
+ localStorage.removeItem('/r/EditWidget/dashboards');
+ //localStorage.clear();
document.signout.submit();
return true;
}
diff --git a/sca-cpp/trunk/modules/edit/htdocs/notauth/index.html b/sca-cpp/trunk/modules/edit/htdocs/public/notauth/index.html
index b44ccb26e9..8a688c9aa5 100644
--- a/sca-cpp/trunk/modules/edit/htdocs/notauth/index.html
+++ b/sca-cpp/trunk/modules/edit/htdocs/public/notauth/index.html
@@ -76,7 +76,7 @@ appcache.get = function(uri) {
<div id="headdiv" class="hsection">
<script type="text/javascript">
(function() {
-$('headdiv').appendChild(ui.declareScript(appcache.get('/headconfig-min.js')));
+$('headdiv').appendChild(ui.declareScript(appcache.get('/public/config-min.js')));
})();
</script>
</div>
@@ -109,8 +109,8 @@ var cdiv = $('content');
*/
function showmenu(mdiv) {
mdiv.innerHTML = ui.menubar(
- mklist(ui.menu('Home', '/', '_view', false), ui.menu('Store', '/#view=store', '_view', false)),
- mklist(ui.menu('Account', '/#view=account', '_view', false), ui.menu('Sign out', '/logout/', '_self', false)));
+ mklist(ui.menu('Home', '/', '_view', false)),
+ mklist(ui.signedin()? ui.menu('Sign out', '/logout/', '_self', false) : ui.menu('Sign in', '/login/', '_self', false)));
}
showmenu(mdiv);
@@ -145,11 +145,6 @@ function onload() {
</script>
<div id="footdiv" class="fsection">
-<script type="text/javascript">
-(function() {
-$('footdiv').appendChild(ui.declareScript(appcache.get('/footconfig-min.js')));
-})();
-</script>
</div>
</div>
diff --git a/sca-cpp/trunk/modules/edit/htdocs/notfound/index.html b/sca-cpp/trunk/modules/edit/htdocs/public/notfound/index.html
index 6b3bb09824..b7ba34c416 100644
--- a/sca-cpp/trunk/modules/edit/htdocs/notfound/index.html
+++ b/sca-cpp/trunk/modules/edit/htdocs/public/notfound/index.html
@@ -76,7 +76,7 @@ appcache.get = function(uri) {
<div id="headdiv" class="hsection">
<script type="text/javascript">
(function() {
-$('headdiv').appendChild(ui.declareScript(appcache.get('/headconfig-min.js')));
+$('headdiv').appendChild(ui.declareScript(appcache.get('/public/config-min.js')));
})();
</script>
</div>
@@ -110,8 +110,8 @@ var cdiv = $('content');
*/
function showmenu(mdiv) {
mdiv.innerHTML = ui.menubar(
- mklist(ui.menu('Home', '/', '_view', false), ui.menu('Store', '/#view=store', '_view', false)),
- mklist(ui.menu('Account', '/#view=account', '_view', false), ui.menu('Sign out', '/logout/', '_self', false)));
+ mklist(ui.menu('Home', '/', '_view', false)),
+ mklist(ui.signedin()? ui.menu('Sign out', '/logout/', '_self', false) : ui.menu('Sign in', '/login/', '_self', false)));
}
showmenu(mdiv);
@@ -146,11 +146,6 @@ function onload() {
</script>
<div id="footdiv" class="fsection">
-<script type="text/javascript">
-(function() {
-$('footdiv').appendChild(ui.declareScript(appcache.get('/footconfig-min.js')));
-})();
-</script>
</div>
</div>
diff --git a/sca-cpp/trunk/modules/edit/htdocs/notyet/index.html b/sca-cpp/trunk/modules/edit/htdocs/public/notyet/index.html
index d01e535299..ca164f3172 100644
--- a/sca-cpp/trunk/modules/edit/htdocs/notyet/index.html
+++ b/sca-cpp/trunk/modules/edit/htdocs/public/notyet/index.html
@@ -76,7 +76,7 @@ appcache.get = function(uri) {
<div id="headdiv" class="hsection">
<script type="text/javascript">
(function() {
-$('headdiv').appendChild(ui.declareScript(appcache.get('/headconfig-min.js')));
+$('headdiv').appendChild(ui.declareScript(appcache.get('/public/config-min.js')));
})();
</script>
</div>
@@ -110,8 +110,8 @@ var cdiv = $('content');
*/
function showmenu(mdiv) {
mdiv.innerHTML = ui.menubar(
- mklist(ui.menu('Home', '/', '_view', false), ui.menu('Store', '/#view=store', '_view', false)),
- mklist(ui.menu('Account', '/#view=account', '_view', false), ui.menu('Sign out', '/logout/', '_self', false)));
+ mklist(ui.menu('Home', '/', '_view', false)),
+ mklist(ui.signedin()? ui.menu('Sign out', '/logout/', '_self', false) : ui.menu('Sign in', '/login/', '_self', false)));
}
showmenu(mdiv);
@@ -146,11 +146,6 @@ function onload() {
</script>
<div id="footdiv" class="fsection">
-<script type="text/javascript">
-(function() {
-$('footdiv').appendChild(ui.declareScript(appcache.get('/footconfig-min.js')));
-})();
-</script>
</div>
</div>
diff --git a/sca-cpp/trunk/modules/edit/htdocs/oops/index.html b/sca-cpp/trunk/modules/edit/htdocs/public/oops/index.html
index aeb5ae5d2c..8cfe2f6537 100644
--- a/sca-cpp/trunk/modules/edit/htdocs/oops/index.html
+++ b/sca-cpp/trunk/modules/edit/htdocs/public/oops/index.html
@@ -76,7 +76,7 @@ appcache.get = function(uri) {
<div id="headdiv" class="hsection">
<script type="text/javascript">
(function() {
-$('headdiv').appendChild(ui.declareScript(appcache.get('/headconfig-min.js')));
+$('headdiv').appendChild(ui.declareScript(appcache.get('/public/config-min.js')));
})();
</script>
</div>
@@ -109,8 +109,8 @@ var cdiv = $('content');
*/
function showmenu(mdiv) {
mdiv.innerHTML = ui.menubar(
- mklist(ui.menu('Home', '/', '_view', false), ui.menu('Store', '/#view=store', '_view', false)),
- mklist(ui.menu('Account', '/#view=account', '_view', false), ui.menu('Sign out', '/logout/', '_self', false)));
+ mklist(ui.menu('Home', '/', '_view', false)),
+ mklist(ui.signedin()? ui.menu('Sign out', '/logout/', '_self', false) : ui.menu('Sign in', '/login/', '_self', false)));
}
showmenu(mdiv);
@@ -145,11 +145,6 @@ function onload() {
</script>
<div id="footdiv" class="fsection">
-<script type="text/javascript">
-(function() {
-$('footdiv').appendChild(ui.declareScript(appcache.get('/footconfig-min.js')));
-})();
-</script>
</div>
</div>