You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@tuscany.apache.org by js...@apache.org on 2010/07/01 08:04:44 UTC
svn commit: r959522 - in /tuscany/sca-cpp/trunk/modules/openid: ./ htdocs/
htdocs/protected/ htdocs/protected/login/ htdocs/protected/logout/
Author: jsdelfino
Date: Thu Jul 1 06:04:43 2010
New Revision: 959522
URL: http://svn.apache.org/viewvc?rev=959522&view=rev
Log:
Refactor OpenID test pages and add test methods returning the user info.
Added:
tuscany/sca-cpp/trunk/modules/openid/htdocs/protected/login/
tuscany/sca-cpp/trunk/modules/openid/htdocs/protected/login/index.html
tuscany/sca-cpp/trunk/modules/openid/htdocs/protected/logout/
tuscany/sca-cpp/trunk/modules/openid/htdocs/protected/logout/index.html
- copied, changed from r959521, tuscany/sca-cpp/trunk/modules/openid/htdocs/protected/logout.html
tuscany/sca-cpp/trunk/modules/openid/start-test
- copied, changed from r959521, tuscany/sca-cpp/trunk/modules/openid/server-test
tuscany/sca-cpp/trunk/modules/openid/stop-test (contents, props changed)
- copied, changed from r959521, tuscany/sca-cpp/trunk/modules/openid/Makefile.am
tuscany/sca-cpp/trunk/modules/openid/user-info.scm
- copied, changed from r959521, tuscany/sca-cpp/trunk/modules/openid/server-test.scm
Removed:
tuscany/sca-cpp/trunk/modules/openid/htdocs/login.html
tuscany/sca-cpp/trunk/modules/openid/htdocs/protected/logout.html
tuscany/sca-cpp/trunk/modules/openid/server-test
tuscany/sca-cpp/trunk/modules/openid/server-test.scm
Modified:
tuscany/sca-cpp/trunk/modules/openid/Makefile.am
tuscany/sca-cpp/trunk/modules/openid/htdocs/index.html
tuscany/sca-cpp/trunk/modules/openid/htdocs/protected/index.html
tuscany/sca-cpp/trunk/modules/openid/openid-conf
tuscany/sca-cpp/trunk/modules/openid/openid.composite
Modified: tuscany/sca-cpp/trunk/modules/openid/Makefile.am
URL: http://svn.apache.org/viewvc/tuscany/sca-cpp/trunk/modules/openid/Makefile.am?rev=959522&r1=959521&r2=959522&view=diff
==============================================================================
--- tuscany/sca-cpp/trunk/modules/openid/Makefile.am (original)
+++ tuscany/sca-cpp/trunk/modules/openid/Makefile.am Thu Jul 1 06:04:43 2010
@@ -25,8 +25,8 @@ mod_DATA = openid.prefix
openid.prefix: $(top_builddir)/config.status
echo ${MODAUTHOPENID_PREFIX} >openid.prefix
-EXTRA_DIST = openid.composite server-test.scm htdocs/index.html htdocs/login.html htdocs/protected/index.html
+EXTRA_DIST = openid.composite user-info.scm htdocs/index.html htdocs/login/index.html htdocs/logout/index.html htdocs/protected/index.html
-dist_noinst_SCRIPTS = server-test
+dist_noinst_SCRIPTS = start-test stop-test
endif
Modified: tuscany/sca-cpp/trunk/modules/openid/htdocs/index.html
URL: http://svn.apache.org/viewvc/tuscany/sca-cpp/trunk/modules/openid/htdocs/index.html?rev=959522&r1=959521&r2=959522&view=diff
==============================================================================
--- tuscany/sca-cpp/trunk/modules/openid/htdocs/index.html (original)
+++ tuscany/sca-cpp/trunk/modules/openid/htdocs/index.html Thu Jul 1 06:04:43 2010
@@ -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>
Modified: tuscany/sca-cpp/trunk/modules/openid/htdocs/protected/index.html
URL: http://svn.apache.org/viewvc/tuscany/sca-cpp/trunk/modules/openid/htdocs/protected/index.html?rev=959522&r1=959521&r2=959522&view=diff
==============================================================================
--- tuscany/sca-cpp/trunk/modules/openid/htdocs/protected/index.html (original)
+++ tuscany/sca-cpp/trunk/modules/openid/htdocs/protected/index.html Thu Jul 1 06:04:43 2010
@@ -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>
Added: tuscany/sca-cpp/trunk/modules/openid/htdocs/protected/login/index.html
URL: http://svn.apache.org/viewvc/tuscany/sca-cpp/trunk/modules/openid/htdocs/protected/login/index.html?rev=959522&view=auto
==============================================================================
--- tuscany/sca-cpp/trunk/modules/openid/htdocs/protected/login/index.html (added)
+++ tuscany/sca-cpp/trunk/modules/openid/htdocs/protected/login/index.html Thu Jul 1 06:04:43 2010
@@ -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>
Copied: tuscany/sca-cpp/trunk/modules/openid/htdocs/protected/logout/index.html (from r959521, tuscany/sca-cpp/trunk/modules/openid/htdocs/protected/logout.html)
URL: http://svn.apache.org/viewvc/tuscany/sca-cpp/trunk/modules/openid/htdocs/protected/logout/index.html?p2=tuscany/sca-cpp/trunk/modules/openid/htdocs/protected/logout/index.html&p1=tuscany/sca-cpp/trunk/modules/openid/htdocs/protected/logout.html&r1=959521&r2=959522&rev=959522&view=diff
==============================================================================
--- tuscany/sca-cpp/trunk/modules/openid/htdocs/protected/logout.html (original)
+++ tuscany/sca-cpp/trunk/modules/openid/htdocs/protected/logout/index.html Thu Jul 1 06:04:43 2010
@@ -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>
Modified: tuscany/sca-cpp/trunk/modules/openid/openid-conf
URL: http://svn.apache.org/viewvc/tuscany/sca-cpp/trunk/modules/openid/openid-conf?rev=959522&r1=959521&r2=959522&view=diff
==============================================================================
--- tuscany/sca-cpp/trunk/modules/openid/openid-conf (original)
+++ tuscany/sca-cpp/trunk/modules/openid/openid-conf Thu Jul 1 06:04:43 2010
@@ -30,11 +30,30 @@ LoadModule authopenid_module $openid_pr
<Location /protected>
AuthOpenIDEnabled On
-AuthOpenIDLoginPage /login.html
+AuthOpenIDCookiePath /
+AuthOpenIDLoginPage /protected/login
AuthOpenIDAXAdd EMAIL http://axschema.org/contact/email
</Location>
-<Location /login>
+<Location /components>
+AuthOpenIDEnabled On
+AuthOpenIDCookiePath /
+AuthOpenIDLoginPage /protected/login
+AuthOpenIDAXAdd EMAIL http://axschema.org/contact/email
+</Location>
+
+<Location /references>
+AuthOpenIDEnabled On
+AuthOpenIDCookiePath /
+AuthOpenIDLoginPage /protected/login
+AuthOpenIDAXAdd EMAIL http://axschema.org/contact/email
+</Location>
+
+<Location /protected/login>
+AuthOpenIDEnabled Off
+</Location>
+
+<Location /protected/logout>
AuthOpenIDEnabled Off
</Location>
Modified: tuscany/sca-cpp/trunk/modules/openid/openid.composite
URL: http://svn.apache.org/viewvc/tuscany/sca-cpp/trunk/modules/openid/openid.composite?rev=959522&r1=959521&r2=959522&view=diff
==============================================================================
--- tuscany/sca-cpp/trunk/modules/openid/openid.composite (original)
+++ tuscany/sca-cpp/trunk/modules/openid/openid.composite Thu Jul 1 06:04:43 2010
@@ -22,13 +22,18 @@
targetNamespace="http://tuscany.apache.org/xmlns/sca/components"
name="openid">
- <component name="hello">
- <t:implementation.scheme script="server-test.scm"/>
- <service name="hello">
- <t:binding.jsonrpc uri="protected/hello"/>
+ <component name="Protected">
+ <t:implementation.widget location="protected/index.html"/>
+ <reference name="userInfo" target="UserInfo"/>
+ </component>
+
+ <component name="UserInfo">
+ <t:implementation.scheme script="user-info.scm"/>
+ <service name="info">
+ <t:binding.jsonrpc uri="protected/info"/>
</service>
- <property name="user">nobody</property>
- <property name="email">nobody@nowhere.org</property>
+ <property name="user">anonymous</property>
+ <property name="email">anonymous@example.com</property>
</component>
</composite>
Copied: tuscany/sca-cpp/trunk/modules/openid/start-test (from r959521, tuscany/sca-cpp/trunk/modules/openid/server-test)
URL: http://svn.apache.org/viewvc/tuscany/sca-cpp/trunk/modules/openid/start-test?p2=tuscany/sca-cpp/trunk/modules/openid/start-test&p1=tuscany/sca-cpp/trunk/modules/openid/server-test&r1=959521&r2=959522&rev=959522&view=diff
==============================================================================
--- tuscany/sca-cpp/trunk/modules/openid/server-test (original)
+++ tuscany/sca-cpp/trunk/modules/openid/start-test Thu Jul 1 06:04:43 2010
@@ -28,13 +28,4 @@ SCAComposite openid.composite
EOF
../../modules/http/httpd-start tmp
-sleep 2
-# Test
-#./client-test 2>/dev/null
-rc=$?
-
-# Cleanup
-#../../modules/http/httpd-stop tmp
-#sleep 2
-return $rc
Copied: tuscany/sca-cpp/trunk/modules/openid/stop-test (from r959521, tuscany/sca-cpp/trunk/modules/openid/Makefile.am)
URL: http://svn.apache.org/viewvc/tuscany/sca-cpp/trunk/modules/openid/stop-test?p2=tuscany/sca-cpp/trunk/modules/openid/stop-test&p1=tuscany/sca-cpp/trunk/modules/openid/Makefile.am&r1=959521&r2=959522&rev=959522&view=diff
==============================================================================
--- tuscany/sca-cpp/trunk/modules/openid/Makefile.am (original)
+++ tuscany/sca-cpp/trunk/modules/openid/stop-test Thu Jul 1 06:04:43 2010
@@ -1,3 +1,5 @@
+#!/bin/sh
+
# 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
@@ -15,18 +17,6 @@
# specific language governing permissions and limitations
# under the License.
+# Cleanup
+../../modules/http/httpd-stop tmp
-if WANT_OPENID
-
-dist_mod_SCRIPTS = openid-conf
-moddir = $(prefix)/modules/openid
-
-mod_DATA = openid.prefix
-openid.prefix: $(top_builddir)/config.status
- echo ${MODAUTHOPENID_PREFIX} >openid.prefix
-
-EXTRA_DIST = openid.composite server-test.scm htdocs/index.html htdocs/login.html htdocs/protected/index.html
-
-dist_noinst_SCRIPTS = server-test
-
-endif
Propchange: tuscany/sca-cpp/trunk/modules/openid/stop-test
------------------------------------------------------------------------------
svn:executable = *
Copied: tuscany/sca-cpp/trunk/modules/openid/user-info.scm (from r959521, tuscany/sca-cpp/trunk/modules/openid/server-test.scm)
URL: http://svn.apache.org/viewvc/tuscany/sca-cpp/trunk/modules/openid/user-info.scm?p2=tuscany/sca-cpp/trunk/modules/openid/user-info.scm&p1=tuscany/sca-cpp/trunk/modules/openid/server-test.scm&r1=959521&r2=959522&rev=959522&view=diff
==============================================================================
--- tuscany/sca-cpp/trunk/modules/openid/server-test.scm (original)
+++ tuscany/sca-cpp/trunk/modules/openid/user-info.scm Thu Jul 1 06:04:43 2010
@@ -17,5 +17,10 @@
; OpenID support test case
-(define (get id user email) (list "text/html" (list "<html><body><p>Hello " (user) ", " (email) "</p></body></html>")))
+(define (get id user email) (list "text/html" (list
+ "<html><body><p>The following info is generated on the server:</p><div>User: " (user) "</div><div>Email: " (email) "</div></body></html>")))
+
+(define (getuser user email) (user))
+
+(define (getemail user email) (email))