diff options
Diffstat (limited to 'sca-cpp/trunk/modules/openid/htdocs')
-rw-r--r-- | sca-cpp/trunk/modules/openid/htdocs/index.html | 3 | ||||
-rw-r--r-- | sca-cpp/trunk/modules/openid/htdocs/login.html | 62 | ||||
-rw-r--r-- | sca-cpp/trunk/modules/openid/htdocs/protected/index.html | 23 | ||||
-rw-r--r-- | sca-cpp/trunk/modules/openid/htdocs/protected/login/index.html | 97 | ||||
-rw-r--r-- | sca-cpp/trunk/modules/openid/htdocs/protected/logout/index.html (renamed from sca-cpp/trunk/modules/openid/htdocs/protected/logout.html) | 12 |
5 files changed, 125 insertions, 72 deletions
diff --git a/sca-cpp/trunk/modules/openid/htdocs/index.html b/sca-cpp/trunk/modules/openid/htdocs/index.html index ff69115cda..1134201389 100644 --- a/sca-cpp/trunk/modules/openid/htdocs/index.html +++ b/sca-cpp/trunk/modules/openid/htdocs/index.html @@ -20,5 +20,6 @@ <html><body> <h1>Unprotected area - It works!</h1> <p><a href="protected">Protected area</a></p> -<p><a href="login.html">Sign in</a></p> +<p><a href="protected/login">Sign in</a></p> +<p><a href="/protected/logout">Sign out</a></p> </body></html> diff --git a/sca-cpp/trunk/modules/openid/htdocs/login.html b/sca-cpp/trunk/modules/openid/htdocs/login.html deleted file mode 100644 index b7b87aac04..0000000000 --- a/sca-cpp/trunk/modules/openid/htdocs/login.html +++ /dev/null @@ -1,62 +0,0 @@ -<!-- - 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 provider</h1> - -<form "googleSignin" action="/protected" method="GET"> -<input type="hidden" name="openid_identifier" value="https://www.google.com/accounts/o8/id"/> -<input type="submit" value="Sign in with your Google account"/> -</form> - -<form name="yahooSignin" action="/protected" method="GET"> -<input type="hidden" name="openid_identifier" value="https://me.yahoo.com/"/> -<input type="submit" value="Sign in with your Yahoo account"/> - -</form> - -<form name="myOpenIDSignin" action="/protected" method="GET"> -<input type="hidden" name="openid_identifier" value="http://www.myopenid.com/xrds"/> -<input type="submit" value="Sign in with your MyOpenID account"/> -</form> - -<form name="verisignSignin" action="/protected" method="GET"> -<input type="hidden" name="openid_identifier" value="https://pip.verisignlabs.com/"/> -<input type="submit" value="Sign in with your Verisign account"/> -</form> - -<form name="googleAppsSignin" action="/protected" method="GET"> -<script type="text/javascript"> -function initOpenIDIdentifier() { - document.googleAppsSignin.openid_identifier.value = 'https://www.google.com/accounts/o8/site-xrds?ns=2&hd=' + document.googleAppsSignin.domain.value; - return true; -} -</script> -<!-- Enter your Google apps domain, e.g example.com --> -<input type="text" size="20" name="domain" value="example.com"/><br/> -<input type="hidden" size=50 name="openid_identifier" value=""/> -<input type="submit" onclick="initOpenIDIdentifier()" value="Sign in with a Google Apps domain"/> -</form> - -<form name="xrdsEndpointSignin" action="/protected" method="GET"> -<!-- Enter your OpenID XRDS endpoint, e.g. https://www.google.com/accounts/o8/id --> -<input type="text" size="50" name="openid_identifier" value="https://www.google.com/accounts/o8/id"/><br/> -<input type="submit" value="Sign in with an OpenID XRDS endpoint"/> -</form> -</body></html> diff --git a/sca-cpp/trunk/modules/openid/htdocs/protected/index.html b/sca-cpp/trunk/modules/openid/htdocs/protected/index.html index 1799bc1006..4c7bc4f5a3 100644 --- a/sca-cpp/trunk/modules/openid/htdocs/protected/index.html +++ b/sca-cpp/trunk/modules/openid/htdocs/protected/index.html @@ -17,8 +17,25 @@ under the License. --> -<html><body> +<html> +<head> +<script type="text/javascript" src="/js/tuscany-ref.js"></script> +<script language="JavaScript"> + var component = new tuscany.sca.Component("Protected"); + var userInfo = new tuscany.sca.Reference("userInfo"); + var user = userInfo.apply("getuser"); + var email = userInfo.apply("getemail"); +</script> +</head> +<body> <h1>Protected area - It works!</h1> -<p><a href="hello">Hello component</a></p> -<p><a href="logout.html">Sign out</a></p> +<p>The following info is returned by a JSONRPC service:</p> +<div id="user"></div> +<div id="email"></div> +<p><a href="/protected/info">User info</a></p> +<p><a href="/protected/logout">Sign out</a></p> +<script language="JavaScript"> + document.getElementById('user').innerHTML="User: " + user; + document.getElementById('email').innerHTML="Email: " + email; +</script> </body></html> diff --git a/sca-cpp/trunk/modules/openid/htdocs/protected/login/index.html b/sca-cpp/trunk/modules/openid/htdocs/protected/login/index.html new file mode 100644 index 0000000000..a3c0119839 --- /dev/null +++ b/sca-cpp/trunk/modules/openid/htdocs/protected/login/index.html @@ -0,0 +1,97 @@ +<!-- + 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 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 openidReferrer() { + r = queryParams()['modauthopenid.referrer']; + if (typeof(r) == 'undefined') + return r; + q = r.indexOf('?'); + if (q > 0) + return r.substring(0, q); + return r; +} + +if (typeof(openidReferrer()) == 'undefined') { + document.location = '/protected'; +} + +function submitSignin(w) { + document.signin.openid_identifier.value = w(); + document.signin.action = openidReferrer(); + document.signin.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 withGoogleApps() { + return 'https://www.google.com/accounts/o8/site-xrds?ns=2&hd=' + document.fields.domain.value; +} + +function withXRDSEndpoint() { + return document.fields.endpoint.value; +} +</script> + +<form name="signin" action="/protected" method="GET"> +<input type="hidden" name="openid_identifier" value="https://www.google.com/accounts/o8/id"/> +</form> + +<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 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> +<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> +</form> + +</body></html> diff --git a/sca-cpp/trunk/modules/openid/htdocs/protected/logout.html b/sca-cpp/trunk/modules/openid/htdocs/protected/logout/index.html index ec8c104c92..a92bad3086 100644 --- a/sca-cpp/trunk/modules/openid/htdocs/protected/logout.html +++ b/sca-cpp/trunk/modules/openid/htdocs/protected/logout/index.html @@ -20,15 +20,15 @@ <html><body> <h1>Sign out</h1> -<form "Signout" action="/" method="GET"> +<form name="signout" action="/" method="GET"> <script type="text/javascript"> -function deleteOpenIDSessionCookie() { - alert(document.cookie); - document.cookie = 'open_id_session_id=;expires=' + new Date(1970,01,01).toGMTString(); - alert(document.cookie); +function submitSignout() { + document.cookie = 'open_id_session_id=;expires=' + new Date(1970,01,01).toGMTString() + ';path=/'; + document.signout.action = document.referrer; + document.signout.submit(); return true; } </script> -<input type="submit" onclick="deleteOpenIDSessionCookie()" value="Sign out"/> +<input type="button" onclick="submitSignout()" value="Sign out"/> </form> </body></html> |