summaryrefslogtreecommitdiffstats
path: root/sca-cpp/trunk/modules/openid
diff options
context:
space:
mode:
authorjsdelfino <jsdelfino@13f79535-47bb-0310-9956-ffa450edef68>2010-06-27 00:47:05 +0000
committerjsdelfino <jsdelfino@13f79535-47bb-0310-9956-ffa450edef68>2010-06-27 00:47:05 +0000
commitd7cc8057a36fb87292568989adb19c354b26a181 (patch)
tree3b6e3b62dffa921575f54ef10ef2a0d1bcebfc72 /sca-cpp/trunk/modules/openid
parentdde314a44064dd8ddc63375078dacbaebbdd9a3f (diff)
Add support for user and email component properties, and minimal support for sign in using OpenID.
git-svn-id: http://svn.us.apache.org/repos/asf/tuscany@958305 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'sca-cpp/trunk/modules/openid')
-rw-r--r--sca-cpp/trunk/modules/openid/Makefile.am32
-rw-r--r--sca-cpp/trunk/modules/openid/htdocs/index.html21
-rw-r--r--sca-cpp/trunk/modules/openid/htdocs/login/index.html38
-rw-r--r--sca-cpp/trunk/modules/openid/htdocs/protected/index.html21
-rwxr-xr-xsca-cpp/trunk/modules/openid/openid-conf41
-rw-r--r--sca-cpp/trunk/modules/openid/openid.composite34
-rwxr-xr-xsca-cpp/trunk/modules/openid/server-test40
-rw-r--r--sca-cpp/trunk/modules/openid/server-test.scm21
8 files changed, 248 insertions, 0 deletions
diff --git a/sca-cpp/trunk/modules/openid/Makefile.am b/sca-cpp/trunk/modules/openid/Makefile.am
new file mode 100644
index 0000000000..90ca3f1f6c
--- /dev/null
+++ b/sca-cpp/trunk/modules/openid/Makefile.am
@@ -0,0 +1,32 @@
+# 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.
+
+
+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
diff --git a/sca-cpp/trunk/modules/openid/htdocs/index.html b/sca-cpp/trunk/modules/openid/htdocs/index.html
new file mode 100644
index 0000000000..5681f551ca
--- /dev/null
+++ b/sca-cpp/trunk/modules/openid/htdocs/index.html
@@ -0,0 +1,21 @@
+<!--
+ 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>Unprotected area - It works!</h1></body></html>
+
diff --git a/sca-cpp/trunk/modules/openid/htdocs/login/index.html b/sca-cpp/trunk/modules/openid/htdocs/login/index.html
new file mode 100644
index 0000000000..6270c7efbd
--- /dev/null
+++ b/sca-cpp/trunk/modules/openid/htdocs/login/index.html
@@ -0,0 +1,38 @@
+<!--
+ 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 using an OpenID provider</h1>
+<form 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 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 action="/protected" method="GET">
+<input type="hidden" name="openid_identifier" value="https://me.myopenid.com"/>
+<input type="submit" value="Sign in with your MyOpenID account"/>
+</form>
+<form 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>
+</body></html>
diff --git a/sca-cpp/trunk/modules/openid/htdocs/protected/index.html b/sca-cpp/trunk/modules/openid/htdocs/protected/index.html
new file mode 100644
index 0000000000..3483c300a8
--- /dev/null
+++ b/sca-cpp/trunk/modules/openid/htdocs/protected/index.html
@@ -0,0 +1,21 @@
+<!--
+ 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>Protected area - It works!</h1></body></html>
+
diff --git a/sca-cpp/trunk/modules/openid/openid-conf b/sca-cpp/trunk/modules/openid/openid-conf
new file mode 100755
index 0000000000..b5d2994dcc
--- /dev/null
+++ b/sca-cpp/trunk/modules/openid/openid-conf
@@ -0,0 +1,41 @@
+#!/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 Axis2 server conf
+here=`readlink -f $0`; here=`dirname $here`
+root=`readlink -f $1`
+htdocs=`readlink -f $2`
+openid_prefix=`cat openid.prefix`
+
+# 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
+AuthOpenIDLoginPage /login
+AuthOpenIDAXAdd EMAIL http://axschema.org/contact/email
+</Location>
+
+<Location /login>
+AuthOpenIDEnabled Off
+</Location>
+
+EOF
diff --git a/sca-cpp/trunk/modules/openid/openid.composite b/sca-cpp/trunk/modules/openid/openid.composite
new file mode 100644
index 0000000000..7310661dc0
--- /dev/null
+++ b/sca-cpp/trunk/modules/openid/openid.composite
@@ -0,0 +1,34 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * 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.
+-->
+<composite xmlns="http://docs.oasis-open.org/ns/opencsa/sca/200912"
+ xmlns:t="http://tuscany.apache.org/xmlns/sca/1.1"
+ 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"/>
+ </service>
+ <property name="user">nobody</property>
+ <property name="email">nobody@nowhere.org</property>
+ </component>
+
+</composite>
diff --git a/sca-cpp/trunk/modules/openid/server-test b/sca-cpp/trunk/modules/openid/server-test
new file mode 100755
index 0000000000..f0df198901
--- /dev/null
+++ b/sca-cpp/trunk/modules/openid/server-test
@@ -0,0 +1,40 @@
+#!/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.
+
+# Setup
+../../modules/http/httpd-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
+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
diff --git a/sca-cpp/trunk/modules/openid/server-test.scm b/sca-cpp/trunk/modules/openid/server-test.scm
new file mode 100644
index 0000000000..19f914b5ce
--- /dev/null
+++ b/sca-cpp/trunk/modules/openid/server-test.scm
@@ -0,0 +1,21 @@
+; 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.
+
+; OpenID support test case
+
+(define (get id user email) (list "text/html" (list "<html><body><p>Hello " (user) ", " (email) "</p></body></html>")))
+