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/25 01:21:39 UTC
svn commit: r978945 - in /tuscany/sca-cpp/trunk/modules/openid: ./ htdocs/
htdocs/login/ htdocs/logout/ htdocs/protected/ htdocs/unprotected/
Author: jsdelfino
Date: Sat Jul 24 23:21:38 2010
New Revision: 978945
URL: http://svn.apache.org/viewvc?rev=978945&view=rev
Log:
Change OpenID conf to protect the entire tree under a host, and work with OpenID step2 discovery.
Added:
tuscany/sca-cpp/trunk/modules/openid/htdocs/login/
tuscany/sca-cpp/trunk/modules/openid/htdocs/login/index.html
- copied, changed from r966096, tuscany/sca-cpp/trunk/modules/openid/htdocs/protected/login/index.html
tuscany/sca-cpp/trunk/modules/openid/htdocs/logout/
tuscany/sca-cpp/trunk/modules/openid/htdocs/logout/index.html
- copied, changed from r966096, tuscany/sca-cpp/trunk/modules/openid/htdocs/protected/logout/index.html
tuscany/sca-cpp/trunk/modules/openid/htdocs/unprotected/
tuscany/sca-cpp/trunk/modules/openid/htdocs/unprotected/index.html
- copied, changed from r966096, tuscany/sca-cpp/trunk/modules/openid/htdocs/index.html
tuscany/sca-cpp/trunk/modules/openid/openid-step2-conf (with props)
Removed:
tuscany/sca-cpp/trunk/modules/openid/htdocs/protected/
Modified:
tuscany/sca-cpp/trunk/modules/openid/htdocs/index.html
tuscany/sca-cpp/trunk/modules/openid/openid-conf
tuscany/sca-cpp/trunk/modules/openid/openid.composite
tuscany/sca-cpp/trunk/modules/openid/start-test
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=978945&r1=978944&r2=978945&view=diff
==============================================================================
--- tuscany/sca-cpp/trunk/modules/openid/htdocs/index.html (original)
+++ tuscany/sca-cpp/trunk/modules/openid/htdocs/index.html Sat Jul 24 23:21:38 2010
@@ -17,9 +17,27 @@
under the License.
-->
-<html><body>
-<h1>Unprotected area - It works!</h1>
-<p><a href="protected">Protected area</a></p>
-<p><a href="protected/login">Sign in</a></p>
-<p><a href="/protected/logout">Sign out</a></p>
+<html>
+<head>
+<script type="text/javascript" src="/js/tuscany-ref.js"></script>
+<script type="text/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>The following info is returned by a JSONRPC service:</p>
+<div id="user"></div>
+<div id="email"></div>
+<script type="text/javascript">
+document.getElementById('user').innerHTML="User: " + user;
+document.getElementById('email').innerHTML="Email: " + email;
+</script>
+<p><a href="info">User info</a></p>
+<p><a href="login">Sign in</a></p>
+<p><a href="logout">Sign out</a></p>
+<p><a href="unprotected">Unprotected area</a></p>
</body></html>
Copied: tuscany/sca-cpp/trunk/modules/openid/htdocs/login/index.html (from r966096, tuscany/sca-cpp/trunk/modules/openid/htdocs/protected/login/index.html)
URL: http://svn.apache.org/viewvc/tuscany/sca-cpp/trunk/modules/openid/htdocs/login/index.html?p2=tuscany/sca-cpp/trunk/modules/openid/htdocs/login/index.html&p1=tuscany/sca-cpp/trunk/modules/openid/htdocs/protected/login/index.html&r1=966096&r2=978945&rev=978945&view=diff
==============================================================================
--- tuscany/sca-cpp/trunk/modules/openid/htdocs/protected/login/index.html (original)
+++ tuscany/sca-cpp/trunk/modules/openid/htdocs/login/index.html Sat Jul 24 23:21:38 2010
@@ -42,7 +42,7 @@ function openidReferrer() {
}
if (typeof(openidReferrer()) == 'undefined') {
- document.location = '/protected';
+ document.location = '/';
}
function submitSignin(w) {
@@ -77,7 +77,7 @@ function withXRDSEndpoint() {
}
</script>
-<form name="signin" action="/protected" method="GET">
+<form name="signin" action="/" method="GET">
<input type="hidden" name="openid_identifier" value="https://www.google.com/accounts/o8/id"/>
</form>
Copied: tuscany/sca-cpp/trunk/modules/openid/htdocs/logout/index.html (from r966096, tuscany/sca-cpp/trunk/modules/openid/htdocs/protected/logout/index.html)
URL: http://svn.apache.org/viewvc/tuscany/sca-cpp/trunk/modules/openid/htdocs/logout/index.html?p2=tuscany/sca-cpp/trunk/modules/openid/htdocs/logout/index.html&p1=tuscany/sca-cpp/trunk/modules/openid/htdocs/protected/logout/index.html&r1=966096&r2=978945&rev=978945&view=diff
==============================================================================
--- tuscany/sca-cpp/trunk/modules/openid/htdocs/protected/logout/index.html (original)
+++ tuscany/sca-cpp/trunk/modules/openid/htdocs/logout/index.html Sat Jul 24 23:21:38 2010
@@ -24,7 +24,7 @@
<script type="text/javascript">
function submitSignout() {
document.cookie = 'open_id_session_id=;expires=' + new Date(1970,01,01).toGMTString() + ';path=/';
- document.signout.action = document.referrer;
+ document.signout.action = "/login";
document.signout.submit();
return true;
}
Copied: tuscany/sca-cpp/trunk/modules/openid/htdocs/unprotected/index.html (from r966096, tuscany/sca-cpp/trunk/modules/openid/htdocs/index.html)
URL: http://svn.apache.org/viewvc/tuscany/sca-cpp/trunk/modules/openid/htdocs/unprotected/index.html?p2=tuscany/sca-cpp/trunk/modules/openid/htdocs/unprotected/index.html&p1=tuscany/sca-cpp/trunk/modules/openid/htdocs/index.html&r1=966096&r2=978945&rev=978945&view=diff
==============================================================================
--- tuscany/sca-cpp/trunk/modules/openid/htdocs/index.html (original)
+++ tuscany/sca-cpp/trunk/modules/openid/htdocs/unprotected/index.html Sat Jul 24 23:21:38 2010
@@ -17,9 +17,11 @@
under the License.
-->
-<html><body>
+<html>
+<body>
<h1>Unprotected area - It works!</h1>
-<p><a href="protected">Protected area</a></p>
-<p><a href="protected/login">Sign in</a></p>
-<p><a href="/protected/logout">Sign out</a></p>
+<p><a href="/info">User info</a></p>
+<p><a href="/login">Sign in</a></p>
+<p><a href="/logout">Sign out</a></p>
+<p><a href="/">Protected area</a></p>
</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=978945&r1=978944&r2=978945&view=diff
==============================================================================
--- tuscany/sca-cpp/trunk/modules/openid/openid-conf (original)
+++ tuscany/sca-cpp/trunk/modules/openid/openid-conf Sat Jul 24 23:21:38 2010
@@ -17,49 +17,41 @@
# specific language governing permissions and limitations
# under the License.
-# Generate an Axis2 server conf
+# Generate an OpenID server conf
here=`readlink -f $0`; here=`dirname $here`
root=`readlink -f $1`
-htdocs=`readlink -f $2`
+host=$2
+port=`echo $3 | awk -F "/" '{ print $1 }'`
+pport=`echo $3 | awk -F "/" '{ print $2 }'`
+if [ "$pport" = "" ]; then
+ pport=$port
+fi
+htdocs=`readlink -f $4`
openid_prefix=`cat openid.prefix`
-servername=`cat $root/conf/httpd.conf | grep ServerName | tail -1 | awk '{ print $2 }'`
-
# Configure HTTPD mod_auth_openid module
cat >>$root/conf/httpd.conf <<EOF
# Support for OpenID authentication
LoadModule authopenid_module $openid_prefix/modules/mod_auth_openid.so
-<Location /protected>
-AuthOpenIDEnabled On
-AuthOpenIDCookiePath /
-AuthOpenIDLoginPage /protected/login
-AuthOpenIDAXAdd EMAIL http://axschema.org/contact/email
-AuthOpenIDServerName $servername
-</Location>
-
-<Location /components>
+<Location />
AuthOpenIDEnabled On
AuthOpenIDCookiePath /
-AuthOpenIDLoginPage /protected/login
+AuthOpenIDLoginPage /login
AuthOpenIDAXAdd EMAIL http://axschema.org/contact/email
-AuthOpenIDServerName $servername
</Location>
-<Location /references>
-AuthOpenIDEnabled On
-AuthOpenIDCookiePath /
-AuthOpenIDLoginPage /protected/login
-AuthOpenIDAXAdd EMAIL http://axschema.org/contact/email
-AuthOpenIDServerName $servername
+<Location /unprotected>
+AuthOpenIDEnabled Off
</Location>
-<Location /protected/login>
+<Location /login>
AuthOpenIDEnabled Off
</Location>
-<Location /protected/logout>
+<Location /logout>
AuthOpenIDEnabled Off
</Location>
EOF
+
Added: tuscany/sca-cpp/trunk/modules/openid/openid-step2-conf
URL: http://svn.apache.org/viewvc/tuscany/sca-cpp/trunk/modules/openid/openid-step2-conf?rev=978945&view=auto
==============================================================================
--- tuscany/sca-cpp/trunk/modules/openid/openid-step2-conf (added)
+++ tuscany/sca-cpp/trunk/modules/openid/openid-step2-conf Sat Jul 24 23:21:38 2010
@@ -0,0 +1,72 @@
+#!/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
+# 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.
+
+# Generate an OpenID Step2 server conf
+here=`readlink -f $0`; here=`dirname $here`
+root=`readlink -f $1`
+host=$2
+port=`echo $3 | awk -F "/" '{ print $1 }'`
+pport=`echo $3 | awk -F "/" '{ print $2 }'`
+if [ "$pport" = "" ]; then
+ pport=$port
+fi
+htdocs=`readlink -f $4`
+
+# Configure HTTPD to serve OpenID XRDS and LRDD documents
+cat >>$root/conf/httpd.conf <<EOF
+# Serve OpenID XRDS document
+Alias /openid $root/conf/openid.xrds
+<Location /openid>
+AuthOpenIDEnabled Off
+ForceType application/xrds+xml
+</Location>
+
+# Serve OpenID LRDD document
+Alias /.well-known/host-meta $root/conf/openid.lrdd
+<Location /.well-known/host-meta>
+AuthOpenIDEnabled Off
+ForceType text/plain
+</Location>
+
+EOF
+
+# Generate OpenID XRDS document
+cat >$root/conf/openid.xrds <<EOF
+<?xml version="1.0" encoding="UTF-8"?>
+<xrds:XRDS xmlns:xrds="xri://\$xrds" xmlns="xri://\$xrd*(\$v*2.0)">
+<XRD>
+<CanonicalID>$host</CanonicalID>
+<Service priority="0">
+<Type>http://specs.openid.net/auth/2.0/server</Type>
+<Type>http://specs.openid.net/auth/2.0/signon</Type>
+<Type>http://openid.net/srv/ax/1.0</Type>
+<Type>http://specs.openid.net/extensions/ui/1.0/mode/popup</Type>
+<Type>http://specs.openid.net/extensions/ui/1.0/icon</Type>
+<Type>http://specs.openid.net/extensions/pape/1.0</Type>
+<URI>https://www.google.com/a/$host/o8/ud?be=o8</URI>
+</Service>
+</XRD>
+</xrds:XRDS>
+EOF
+
+# Generate OpenID LRDD document
+cat >$root/conf/openid.lrdd <<EOF
+Link: <https://www.google.com/accounts/o8/site-xrds?hd=$host>; rel="describedby http://reltype.google.com/openid/xrd-op"; type="application/xrds+xml"
+EOF
+
Propchange: tuscany/sca-cpp/trunk/modules/openid/openid-step2-conf
------------------------------------------------------------------------------
svn:executable = *
Modified: tuscany/sca-cpp/trunk/modules/openid/openid.composite
URL: http://svn.apache.org/viewvc/tuscany/sca-cpp/trunk/modules/openid/openid.composite?rev=978945&r1=978944&r2=978945&view=diff
==============================================================================
--- tuscany/sca-cpp/trunk/modules/openid/openid.composite (original)
+++ tuscany/sca-cpp/trunk/modules/openid/openid.composite Sat Jul 24 23:21:38 2010
@@ -30,10 +30,10 @@
<component name="UserInfo">
<t:implementation.scheme script="user-info.scm"/>
<service name="info">
- <t:binding.jsonrpc uri="protected/info"/>
+ <t:binding.jsonrpc uri="info"/>
</service>
<property name="user">anonymous</property>
<property name="email">anonymous@example.com</property>
- </component>
+ </component>
</composite>
Modified: tuscany/sca-cpp/trunk/modules/openid/start-test
URL: http://svn.apache.org/viewvc/tuscany/sca-cpp/trunk/modules/openid/start-test?rev=978945&r1=978944&r2=978945&view=diff
==============================================================================
--- tuscany/sca-cpp/trunk/modules/openid/start-test (original)
+++ tuscany/sca-cpp/trunk/modules/openid/start-test Sat Jul 24 23:21:38 2010
@@ -19,9 +19,10 @@
# Setup
../../modules/http/httpd-conf tmp localhost 8090 htdocs
+./openid-conf tmp localhost 8090 htdocs
+./openid-step2-conf tmp localhost 8090 htdocs
../../modules/server/server-conf tmp
../../modules/server/scheme-conf tmp
-./openid-conf tmp htdocs
cat >>tmp/conf/httpd.conf <<EOF
SCAContribution `pwd`/
SCAComposite openid.composite