Author: marcelkolsteren
Date: 2010-09-18 07:15:45 -0400 (Sat, 18 Sep 2010)
New Revision: 13766
Added:
modules/security/trunk/examples/openid-op/
modules/security/trunk/examples/openid-op/pom.xml
modules/security/trunk/examples/openid-op/readme.txt
modules/security/trunk/examples/openid-op/src/
modules/security/trunk/examples/openid-op/src/main/
modules/security/trunk/examples/openid-op/src/main/java/
modules/security/trunk/examples/openid-op/src/main/java/org/
modules/security/trunk/examples/openid-op/src/main/java/org/jboss/
modules/security/trunk/examples/openid-op/src/main/java/org/jboss/seam/
modules/security/trunk/examples/openid-op/src/main/java/org/jboss/seam/security/
modules/security/trunk/examples/openid-op/src/main/java/org/jboss/seam/security/examples/
modules/security/trunk/examples/openid-op/src/main/java/org/jboss/seam/security/examples/openid/
modules/security/trunk/examples/openid-op/src/main/java/org/jboss/seam/security/examples/openid/AttributeVO.java
modules/security/trunk/examples/openid-op/src/main/java/org/jboss/seam/security/examples/openid/Attributes.java
modules/security/trunk/examples/openid-op/src/main/java/org/jboss/seam/security/examples/openid/Configuration.java
modules/security/trunk/examples/openid-op/src/main/java/org/jboss/seam/security/examples/openid/DialogueAwareViewHandler.java
modules/security/trunk/examples/openid-op/src/main/java/org/jboss/seam/security/examples/openid/DialoguePhaseListener.java
modules/security/trunk/examples/openid-op/src/main/java/org/jboss/seam/security/examples/openid/Identity.java
modules/security/trunk/examples/openid-op/src/main/java/org/jboss/seam/security/examples/openid/Login.java
modules/security/trunk/examples/openid-op/src/main/java/org/jboss/seam/security/examples/openid/OpenIdProviderCustomizer.java
modules/security/trunk/examples/openid-op/src/main/java/org/jboss/seam/security/examples/openid/OpenIdProviderSpiImpl.java
modules/security/trunk/examples/openid-op/src/main/resources/
modules/security/trunk/examples/openid-op/src/main/resources/META-INF/
modules/security/trunk/examples/openid-op/src/main/webapp/
modules/security/trunk/examples/openid-op/src/main/webapp/Attributes.xhtml
modules/security/trunk/examples/openid-op/src/main/webapp/AuthenticationFailed.xhtml
modules/security/trunk/examples/openid-op/src/main/webapp/Configuration.xhtml
modules/security/trunk/examples/openid-op/src/main/webapp/Index.xhtml
modules/security/trunk/examples/openid-op/src/main/webapp/Login.xhtml
modules/security/trunk/examples/openid-op/src/main/webapp/META-INF/
modules/security/trunk/examples/openid-op/src/main/webapp/META-INF/MANIFEST.MF
modules/security/trunk/examples/openid-op/src/main/webapp/Menu.xhtml
modules/security/trunk/examples/openid-op/src/main/webapp/PageTemplate.xhtml
modules/security/trunk/examples/openid-op/src/main/webapp/SessionManagement.xhtml
modules/security/trunk/examples/openid-op/src/main/webapp/UserInfo.xhtml
modules/security/trunk/examples/openid-op/src/main/webapp/WEB-INF/
modules/security/trunk/examples/openid-op/src/main/webapp/WEB-INF/.faces-config.xml.jsfdia
modules/security/trunk/examples/openid-op/src/main/webapp/WEB-INF/beans.xml
modules/security/trunk/examples/openid-op/src/main/webapp/WEB-INF/context.xml
modules/security/trunk/examples/openid-op/src/main/webapp/WEB-INF/faces-config.xml
modules/security/trunk/examples/openid-op/src/main/webapp/WEB-INF/lib/
modules/security/trunk/examples/openid-op/src/main/webapp/WEB-INF/web.xml
modules/security/trunk/examples/openid-op/src/main/webapp/index.jsp
modules/security/trunk/examples/openid-op/src/main/webapp/styles.css
modules/security/trunk/examples/openid-op/src/test/
modules/security/trunk/examples/openid-op/src/test/java/
modules/security/trunk/examples/openid-op/src/test/java/org/
modules/security/trunk/examples/openid-op/src/test/java/org/jboss/
modules/security/trunk/examples/openid-op/src/test/java/org/jboss/seam/
modules/security/trunk/examples/openid-op/src/test/java/org/jboss/seam/security/
modules/security/trunk/examples/openid-op/src/test/resources/
modules/security/trunk/examples/openid-rp/src/main/java/org/jboss/seam/security/examples/id_consumer/Login.java
Removed:
modules/security/trunk/examples/openid-rp/src/main/java/org/jboss/seam/security/examples/id_consumer/RequestObserver.java
modules/security/trunk/examples/saml-idp/src/main/java/org/jboss/seam/security/examples/id_provider/Saml.java
Modified:
modules/security/trunk/examples/openid-rp/readme.txt
modules/security/trunk/examples/openid-rp/src/main/java/org/jboss/seam/security/examples/id_consumer/Identity.java
modules/security/trunk/examples/openid-rp/src/main/java/org/jboss/seam/security/examples/id_consumer/OpenIdRelyingPartySpiImpl.java
modules/security/trunk/examples/openid-rp/src/main/webapp/Login.xhtml
modules/security/trunk/examples/openid-rp/src/main/webapp/Menu.xhtml
modules/security/trunk/examples/openid-rp/src/main/webapp/UserInfo.xhtml
modules/security/trunk/examples/saml-idp/src/main/java/org/jboss/seam/security/examples/id_provider/Configuration.java
modules/security/trunk/examples/saml-idp/src/main/java/org/jboss/seam/security/examples/id_provider/Login.java
modules/security/trunk/examples/saml-idp/src/main/java/org/jboss/seam/security/examples/id_provider/SamlIdentityProviderSpiImpl.java
modules/security/trunk/examples/saml-idp/src/main/webapp/Configuration.xhtml
modules/security/trunk/examples/saml-idp/src/main/webapp/Login.xhtml
Log:
- Added OpenID Provider example.
- Change in OpenID Relying Party example: added support for logging in with a
user-supplied OpenID.
- Minor changes in Saml IDP example.
Property changes on: modules/security/trunk/examples/openid-op
___________________________________________________________________
Name: svn:ignore
+ .settings
.classpath
.project
target
Added: modules/security/trunk/examples/openid-op/pom.xml
===================================================================
--- modules/security/trunk/examples/openid-op/pom.xml (rev 0)
+++ modules/security/trunk/examples/openid-op/pom.xml 2010-09-18 11:15:45 UTC (rev 13766)
@@ -0,0 +1,107 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<project
xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0
http://maven.apache.org/maven-v4_0_0.xsd">
+ <modelVersion>4.0.0</modelVersion>
+ <groupId>org.jboss.seam.security</groupId>
+ <artifactId>openid-op</artifactId>
+ <packaging>war</packaging>
+ <name>OpenID Relying Party</name>
+
+ <parent>
+ <groupId>org.jboss.seam.security</groupId>
+ <artifactId>seam-security-parent</artifactId>
+ <version>3.0.0-SNAPSHOT</version>
+ <relativePath>../../pom.xml</relativePath>
+ </parent>
+
+ <properties>
+ <seam.faces.version>3.0.0-SNAPSHOT</seam.faces.version>
+
<seam.international.version>3.0.0-SNAPSHOT</seam.international.version>
+ <weld.extensions.version>1.0.0.Alpha2</weld.extensions.version>
+ </properties>
+
+ <build>
+ <finalName>openid-rp</finalName>
+ </build>
+
+ <dependencies>
+
+ <dependency>
+ <groupId>org.jboss.seam.security</groupId>
+ <artifactId>seam-security-external</artifactId>
+ <version>${project.version}</version>
+ <exclusions>
+ <exclusion>
+ <artifactId>validation-api</artifactId>
+ <groupId>javax.validation</groupId>
+ </exclusion>
+ </exclusions>
+ </dependency>
+
+ <dependency>
+ <groupId>org.jboss.weld</groupId>
+ <artifactId>weld-extensions</artifactId>
+ <version>${weld.extensions.version}</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.jboss.seam.servlet</groupId>
+ <artifactId>seam-servlet</artifactId>
+ <version>3.0.0-SNAPSHOT</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.jboss.seam.faces</groupId>
+ <artifactId>seam-faces-api</artifactId>
+ </dependency>
+
+ <dependency>
+ <groupId>org.jboss.seam.faces</groupId>
+ <artifactId>seam-faces</artifactId>
+ </dependency>
+
+ <dependency>
+ <groupId>org.jboss.seam.international</groupId>
+ <artifactId>seam-international-api</artifactId>
+ </dependency>
+
+ <dependency>
+ <groupId>org.jboss.seam.international</groupId>
+ <artifactId>seam-international</artifactId>
+ </dependency>
+
+ <dependency>
+ <groupId>javax.enterprise</groupId>
+ <artifactId>cdi-api</artifactId>
+ <scope>provided</scope>
+ </dependency>
+
+ <dependency>
+ <!-- This is necessary until a new JSF-API is published to central -->
+ <groupId>javax.faces</groupId>
+ <artifactId>jsf-api</artifactId>
+ <scope>provided</scope>
+ </dependency>
+
+ <!--
+ <dependency> <groupId>org.jboss.seam.faces</groupId>
+ <artifactId>seam-faces</artifactId>
+ <version>${project.version}</version> </dependency>
+ -->
+
+ <dependency>
+ <groupId>org.slf4j</groupId>
+ <artifactId>slf4j-api</artifactId>
+ <scope>provided</scope>
+ </dependency>
+
+ <dependency>
+ <!-- Required until the Servlet 3.0 API can be resolved in Central -->
+ <groupId>org.jboss.spec.javax.servlet</groupId>
+ <artifactId>jboss-servlet-api_3.0_spec</artifactId>
+ <scope>provided</scope>
+ </dependency>
+
+ </dependencies>
+
+</project>
Added: modules/security/trunk/examples/openid-op/readme.txt
===================================================================
--- modules/security/trunk/examples/openid-op/readme.txt (rev 0)
+++ modules/security/trunk/examples/openid-op/readme.txt 2010-09-18 11:15:45 UTC (rev
13766)
@@ -0,0 +1,44 @@
+OPENID-RP EXAMPLE
+
+
+What is it?
+===========
+
+This demo web application shows how to turn your application into an OpenID
+provider (OP). It makes use of the OpenID submodule of Seam Security.
+
+
+How to deploy it?
+=================
+
+The application is packaged as a war file and should run in any JEE6
+environment. It has been tested on JBoss AS 6. Before deploying the application,
+you need to map this host name to the localhost:
+
+www.openid-op.com
+
+On Unix based systems, you do this by putting the following lines in
+'/etc/hosts':
+
+127.0.0.1
www.openid-op.com
+
+
+Some background info
+====================
+
+The Identity Provider is preconfigured to run at port 8080 and to use the http
+protocol for communicating with Relying Parties (RPs). These settings are ok
+for a test setup, but please be aware that in production, you'd use http on
+port 443. In the test application these settings are done programmatically
+(by the OpenIdProviderCustomizer).
+
+
+How to use the application
+==========================
+
+Start the application and fetch this URL in your browser:
+
+http://www.openid-op.com:8080/openid-op
+
+There you can login and logout locally. If you also install the example OpenID
+relying party, you can experience delegated and single logon.
\ No newline at end of file
Added:
modules/security/trunk/examples/openid-op/src/main/java/org/jboss/seam/security/examples/openid/AttributeVO.java
===================================================================
---
modules/security/trunk/examples/openid-op/src/main/java/org/jboss/seam/security/examples/openid/AttributeVO.java
(rev 0)
+++
modules/security/trunk/examples/openid-op/src/main/java/org/jboss/seam/security/examples/openid/AttributeVO.java 2010-09-18
11:15:45 UTC (rev 13766)
@@ -0,0 +1,51 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2010, Red Hat, Inc., and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site:
http://www.fsf.org.
+ */
+package org.jboss.seam.security.examples.openid;
+
+import org.jboss.seam.security.external.api.OpenIdRequestedAttribute;
+
+public class AttributeVO
+{
+ private OpenIdRequestedAttribute requestedAttribute;
+
+ private String attributeValue;
+
+ public OpenIdRequestedAttribute getRequestedAttribute()
+ {
+ return requestedAttribute;
+ }
+
+ public void setRequestedAttribute(OpenIdRequestedAttribute requestedAttribute)
+ {
+ this.requestedAttribute = requestedAttribute;
+ }
+
+ public String getAttributeValue()
+ {
+ return attributeValue;
+ }
+
+ public void setAttributeValue(String attributeValue)
+ {
+ this.attributeValue = attributeValue;
+ }
+}
Property changes on:
modules/security/trunk/examples/openid-op/src/main/java/org/jboss/seam/security/examples/openid/AttributeVO.java
___________________________________________________________________
Name: svn
+ eol-style=native
Name: svn:keywords
+ Revision Author Date
Added:
modules/security/trunk/examples/openid-op/src/main/java/org/jboss/seam/security/examples/openid/Attributes.java
===================================================================
---
modules/security/trunk/examples/openid-op/src/main/java/org/jboss/seam/security/examples/openid/Attributes.java
(rev 0)
+++
modules/security/trunk/examples/openid-op/src/main/java/org/jboss/seam/security/examples/openid/Attributes.java 2010-09-18
11:15:45 UTC (rev 13766)
@@ -0,0 +1,78 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2010, Red Hat, Inc., and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site:
http://www.fsf.org.
+ */
+package org.jboss.seam.security.examples.openid;
+
+import java.io.Serializable;
+import java.util.Arrays;
+import java.util.HashMap;
+import java.util.LinkedList;
+import java.util.List;
+import java.util.Map;
+
+import javax.enterprise.inject.Model;
+import javax.inject.Inject;
+
+import org.jboss.seam.security.external.api.OpenIdProviderApi;
+import org.jboss.seam.security.external.api.OpenIdRequestedAttribute;
+import org.jboss.seam.security.external.dialogues.api.DialogueScoped;
+
+@Model
+@DialogueScoped
+public class Attributes implements Serializable
+{
+ private static final long serialVersionUID = -6945192710223411921L;
+
+ private List<AttributeVO> attributeVOs;
+
+ @Inject
+ private OpenIdProviderApi providerApi;
+
+ public void setRequestedAttributes(List<OpenIdRequestedAttribute>
requestedAttributes)
+ {
+ attributeVOs = new LinkedList<AttributeVO>();
+
+ for (OpenIdRequestedAttribute requestedAttribute : requestedAttributes)
+ {
+ AttributeVO attributeVO = new AttributeVO();
+ attributeVO.setRequestedAttribute(requestedAttribute);
+ attributeVOs.add(attributeVO);
+ }
+ }
+
+ public List<AttributeVO> getAttributeVOs()
+ {
+ return attributeVOs;
+ }
+
+ public void confirm()
+ {
+ Map<String, List<String>> attributeValues = new HashMap<String,
List<String>>();
+ for (AttributeVO attributeVO : attributeVOs)
+ {
+ if (attributeVO.getAttributeValue() != null)
+ {
+ attributeValues.put(attributeVO.getRequestedAttribute().getAlias(),
Arrays.asList(attributeVO.getAttributeValue()));
+ }
+ }
+ providerApi.setAttributes(attributeValues);
+ }
+}
Property changes on:
modules/security/trunk/examples/openid-op/src/main/java/org/jboss/seam/security/examples/openid/Attributes.java
___________________________________________________________________
Name: svn
+ eol-style=native
Name: svn:keywords
+ Revision Author Date
Added:
modules/security/trunk/examples/openid-op/src/main/java/org/jboss/seam/security/examples/openid/Configuration.java
===================================================================
---
modules/security/trunk/examples/openid-op/src/main/java/org/jboss/seam/security/examples/openid/Configuration.java
(rev 0)
+++
modules/security/trunk/examples/openid-op/src/main/java/org/jboss/seam/security/examples/openid/Configuration.java 2010-09-18
11:15:45 UTC (rev 13766)
@@ -0,0 +1,44 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2010, Red Hat, Inc., and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site:
http://www.fsf.org.
+ */
+package org.jboss.seam.security.examples.openid;
+
+import javax.enterprise.inject.Model;
+import javax.inject.Inject;
+
+import org.jboss.seam.security.external.api.OpenIdRelyingPartyConfigurationApi;
+
+@Model
+public class Configuration
+{
+ @Inject
+ private OpenIdRelyingPartyConfigurationApi confApi;
+
+ public String getRealm()
+ {
+ return confApi.getRealm();
+ }
+
+ public String getXrdsURL()
+ {
+ return confApi.getXrdsURL();
+ }
+}
Property changes on:
modules/security/trunk/examples/openid-op/src/main/java/org/jboss/seam/security/examples/openid/Configuration.java
___________________________________________________________________
Name: svn
+ eol-style=native
Name: svn:keywords
+ Revision Author Date
Added:
modules/security/trunk/examples/openid-op/src/main/java/org/jboss/seam/security/examples/openid/DialogueAwareViewHandler.java
===================================================================
---
modules/security/trunk/examples/openid-op/src/main/java/org/jboss/seam/security/examples/openid/DialogueAwareViewHandler.java
(rev 0)
+++
modules/security/trunk/examples/openid-op/src/main/java/org/jboss/seam/security/examples/openid/DialogueAwareViewHandler.java 2010-09-18
11:15:45 UTC (rev 13766)
@@ -0,0 +1,87 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2010, Red Hat, Inc., and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site:
http://www.fsf.org.
+ */
+package org.jboss.seam.security.examples.openid;
+
+import javax.faces.application.ViewHandler;
+import javax.faces.application.ViewHandlerWrapper;
+import javax.faces.context.FacesContext;
+import javax.servlet.ServletContext;
+
+import org.jboss.seam.security.external.DialogueFilter;
+import org.jboss.seam.security.external.dialogues.DialogueBeanProvider;
+import org.jboss.seam.security.external.dialogues.api.Dialogue;
+
+/**
+ * @author Marcel Kolsteren
+ *
+ */
+public class DialogueAwareViewHandler extends ViewHandlerWrapper
+{
+ private static final String QUERY_STRING_DELIMITER = "?";
+ private static final String PARAMETER_PAIR_DELIMITER = "&";
+ private static final String PARAMETER_ASSIGNMENT_OPERATOR = "=";
+
+ private ViewHandler delegate;
+
+ public DialogueAwareViewHandler(ViewHandler delegate)
+ {
+ this.delegate = delegate;
+ }
+
+ @Override
+ public String getActionURL(FacesContext facesContext, String viewId)
+ {
+ String actionUrl = super.getActionURL(facesContext, viewId);
+ ServletContext servletContext = (ServletContext)
facesContext.getExternalContext().getContext();
+ if (DialogueBeanProvider.dialogueManager(servletContext).isAttached())
+ {
+ Dialogue dialogue = DialogueBeanProvider.dialogue(servletContext);
+ return appendDialogueIdIfNecessary(actionUrl, facesContext,
dialogue.getDialogueId());
+ }
+ else
+ {
+ return actionUrl;
+ }
+ }
+
+ public String appendDialogueIdIfNecessary(String url, FacesContext facesContext,
String cid)
+ {
+ String paramName = DialogueFilter.DIALOGUE_ID_PARAM;
+ int queryStringIndex = url.indexOf(QUERY_STRING_DELIMITER);
+ if (queryStringIndex < 0 || url.indexOf(paramName +
PARAMETER_ASSIGNMENT_OPERATOR, queryStringIndex) < 0)
+ {
+ url = new StringBuilder(url).append(queryStringIndex < 0 ?
QUERY_STRING_DELIMITER :
PARAMETER_PAIR_DELIMITER).append(paramName).append(PARAMETER_ASSIGNMENT_OPERATOR).append(cid).toString();
+ }
+ return url;
+
+ }
+
+ /**
+ * @see {@link ViewHandlerWrapper#getWrapped()}
+ */
+ @Override
+ public ViewHandler getWrapped()
+ {
+ return delegate;
+ }
+
+}
Property changes on:
modules/security/trunk/examples/openid-op/src/main/java/org/jboss/seam/security/examples/openid/DialogueAwareViewHandler.java
___________________________________________________________________
Name: svn
+ eol-style=native
Name: svn:keywords
+ Revision Author Date
Added:
modules/security/trunk/examples/openid-op/src/main/java/org/jboss/seam/security/examples/openid/DialoguePhaseListener.java
===================================================================
---
modules/security/trunk/examples/openid-op/src/main/java/org/jboss/seam/security/examples/openid/DialoguePhaseListener.java
(rev 0)
+++
modules/security/trunk/examples/openid-op/src/main/java/org/jboss/seam/security/examples/openid/DialoguePhaseListener.java 2010-09-18
11:15:45 UTC (rev 13766)
@@ -0,0 +1,53 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2010, Red Hat, Inc., and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site:
http://www.fsf.org.
+ */
+package org.jboss.seam.security.examples.openid;
+
+import javax.enterprise.event.Observes;
+import javax.faces.event.PhaseEvent;
+import javax.inject.Inject;
+
+import org.jboss.seam.faces.event.qualifier.Before;
+import org.jboss.seam.faces.event.qualifier.RestoreView;
+import org.jboss.seam.security.external.dialogues.DialogueManager;
+import org.jboss.seam.servlet.http.HttpParam;
+
+public class DialoguePhaseListener
+{
+ private static final long serialVersionUID = -3608798865478624561L;
+
+ public final static String DIALOGUE_ID_PARAM = "dialogueId";
+
+ @Inject
+ private DialogueManager manager;
+
+ @Inject
+ @HttpParam("dialogueId")
+ private String dialogueId;
+
+ public void beforeRestoreView(@Observes @Before @RestoreView PhaseEvent phaseEvent)
+ {
+ if (dialogueId != null && !manager.isAttached())
+ {
+ manager.attachDialogue(dialogueId);
+ }
+ }
+}
Property changes on:
modules/security/trunk/examples/openid-op/src/main/java/org/jboss/seam/security/examples/openid/DialoguePhaseListener.java
___________________________________________________________________
Name: svn
+ eol-style=native
Name: svn:keywords
+ Revision Author Date
Added:
modules/security/trunk/examples/openid-op/src/main/java/org/jboss/seam/security/examples/openid/Identity.java
===================================================================
---
modules/security/trunk/examples/openid-op/src/main/java/org/jboss/seam/security/examples/openid/Identity.java
(rev 0)
+++
modules/security/trunk/examples/openid-op/src/main/java/org/jboss/seam/security/examples/openid/Identity.java 2010-09-18
11:15:45 UTC (rev 13766)
@@ -0,0 +1,92 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2010, Red Hat, Inc., and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site:
http://www.fsf.org.
+ */
+package org.jboss.seam.security.examples.openid;
+
+import java.io.Serializable;
+
+import javax.enterprise.context.SessionScoped;
+import javax.faces.application.FacesMessage;
+import javax.faces.context.FacesContext;
+import javax.inject.Inject;
+import javax.inject.Named;
+
+import org.jboss.seam.security.external.api.OpenIdProviderApi;
+
+@SessionScoped
+@Named
+public class Identity implements Serializable
+{
+ private static final long serialVersionUID = -7096110154986991513L;
+
+ private String userName;
+
+ @Inject
+ private OpenIdProviderApi providerApi;
+
+ public void localLogin(String userName)
+ {
+ this.userName = userName;
+ }
+
+ public void logout()
+ {
+ if (isLoggedIn())
+ {
+ userName = null;
+ redirectToViewId("/Index.xhtml");
+ }
+ else
+ {
+ FacesMessage facesMessage = new FacesMessage("Not logged in.");
+ FacesContext.getCurrentInstance().addMessage(null, facesMessage);
+ }
+ }
+
+ public boolean isLoggedIn()
+ {
+ return userName != null;
+ }
+
+ public String getUserName()
+ {
+ return userName;
+ }
+
+ public String getOpLocalIdentifier()
+ {
+ return providerApi.getOpLocalIdentifierForUserName(userName);
+ }
+
+ public void redirectToLoginIfNotLoggedIn()
+ {
+ if (!isLoggedIn())
+ {
+ redirectToViewId("/Login.xhtml");
+ }
+ }
+
+ private void redirectToViewId(String viewId)
+ {
+ FacesContext facesContext = FacesContext.getCurrentInstance();
+
FacesContext.getCurrentInstance().getApplication().getNavigationHandler().handleNavigation(facesContext,
null, viewId + "?faces-redirect=true");
+ }
+}
Property changes on:
modules/security/trunk/examples/openid-op/src/main/java/org/jboss/seam/security/examples/openid/Identity.java
___________________________________________________________________
Name: svn
+ eol-style=native
Name: svn:keywords
+ Revision Author Date
Added:
modules/security/trunk/examples/openid-op/src/main/java/org/jboss/seam/security/examples/openid/Login.java
===================================================================
---
modules/security/trunk/examples/openid-op/src/main/java/org/jboss/seam/security/examples/openid/Login.java
(rev 0)
+++
modules/security/trunk/examples/openid-op/src/main/java/org/jboss/seam/security/examples/openid/Login.java 2010-09-18
11:15:45 UTC (rev 13766)
@@ -0,0 +1,109 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2010, Red Hat, Inc., and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site:
http://www.fsf.org.
+ */
+package org.jboss.seam.security.examples.openid;
+
+import javax.enterprise.inject.Model;
+import javax.inject.Inject;
+
+import org.jboss.seam.security.external.api.OpenIdProviderApi;
+import org.jboss.seam.security.external.dialogues.DialogueManager;
+
+@Model
+public class Login
+{
+ @Inject
+ private OpenIdProviderApi opApi;
+
+ private String userNameReceivedFromRp;
+
+ private String realm;
+
+ private String userName;
+
+ @Inject
+ private DialogueManager dialogueManager;
+
+ @Inject
+ private Identity identity;
+
+ public String getUserName()
+ {
+ return userName;
+ }
+
+ public void setUserName(String userName)
+ {
+ this.userName = userName;
+ }
+
+ public String getUserNameReceivedFromRp()
+ {
+ return userNameReceivedFromRp;
+ }
+
+ public void setUserNameReceivedFromRp(String userNameReceivedFromRp)
+ {
+ this.userNameReceivedFromRp = userNameReceivedFromRp;
+ }
+
+ public String getRealm()
+ {
+ return realm;
+ }
+
+ public void setRealm(String realm)
+ {
+ this.realm = realm;
+ }
+
+ public boolean isDialogueActive()
+ {
+ return dialogueManager.isAttached();
+ }
+
+ public String login()
+ {
+ String userName = userNameReceivedFromRp != null ? userNameReceivedFromRp :
this.userName;
+ identity.localLogin(userName);
+ if (dialogueManager.isAttached())
+ {
+ opApi.authenticationSucceeded(userName);
+ return null;
+ }
+ else
+ {
+ return "LOCAL_LOGIN";
+ }
+ }
+
+ public void cancel()
+ {
+ if (dialogueManager.isAttached())
+ {
+ opApi.authenticationFailed();
+ }
+ else
+ {
+ throw new IllegalStateException("cancel method can only be called during an
OpenID login");
+ }
+ }
+}
Property changes on:
modules/security/trunk/examples/openid-op/src/main/java/org/jboss/seam/security/examples/openid/Login.java
___________________________________________________________________
Name: svn
+ eol-style=native
Name: svn:keywords
+ Revision Author Date
Added:
modules/security/trunk/examples/openid-op/src/main/java/org/jboss/seam/security/examples/openid/OpenIdProviderCustomizer.java
===================================================================
---
modules/security/trunk/examples/openid-op/src/main/java/org/jboss/seam/security/examples/openid/OpenIdProviderCustomizer.java
(rev 0)
+++
modules/security/trunk/examples/openid-op/src/main/java/org/jboss/seam/security/examples/openid/OpenIdProviderCustomizer.java 2010-09-18
11:15:45 UTC (rev 13766)
@@ -0,0 +1,39 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2010, Red Hat, Inc., and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site:
http://www.fsf.org.
+ */
+package org.jboss.seam.security.examples.openid;
+
+import javax.enterprise.event.Observes;
+import javax.servlet.ServletContextEvent;
+
+import org.jboss.seam.security.external.api.OpenIdProviderConfigurationApi;
+import org.jboss.seam.servlet.event.qualifier.Initialized;
+
+public class OpenIdProviderCustomizer
+{
+ public void servletInitialized(@Observes @Initialized final ServletContextEvent e,
OpenIdProviderConfigurationApi op)
+ {
+ op.setHostName("www.openid-op.com");
+ op.setPort(8080);
+ op.setProtocol("http");
+ }
+
+}
Property changes on:
modules/security/trunk/examples/openid-op/src/main/java/org/jboss/seam/security/examples/openid/OpenIdProviderCustomizer.java
___________________________________________________________________
Name: svn
+ eol-style=native
Name: svn:keywords
+ Revision Author Date
Added:
modules/security/trunk/examples/openid-op/src/main/java/org/jboss/seam/security/examples/openid/OpenIdProviderSpiImpl.java
===================================================================
---
modules/security/trunk/examples/openid-op/src/main/java/org/jboss/seam/security/examples/openid/OpenIdProviderSpiImpl.java
(rev 0)
+++
modules/security/trunk/examples/openid-op/src/main/java/org/jboss/seam/security/examples/openid/OpenIdProviderSpiImpl.java 2010-09-18
11:15:45 UTC (rev 13766)
@@ -0,0 +1,101 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2010, Red Hat, Inc., and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site:
http://www.fsf.org.
+ */
+package org.jboss.seam.security.examples.openid;
+
+import java.io.IOException;
+import java.net.URLEncoder;
+import java.util.List;
+
+import javax.inject.Inject;
+import javax.servlet.ServletContext;
+
+import org.jboss.seam.security.external.api.OpenIdProviderApi;
+import org.jboss.seam.security.external.api.OpenIdRequestedAttribute;
+import org.jboss.seam.security.external.api.ResponseHolder;
+import org.jboss.seam.security.external.dialogues.api.Dialogue;
+import org.jboss.seam.security.external.spi.OpenIdProviderSpi;
+
+public class OpenIdProviderSpiImpl implements OpenIdProviderSpi
+{
+ @Inject
+ private ResponseHolder responseHolder;
+
+ @Inject
+ private ServletContext servletContext;
+
+ @Inject
+ private Identity identity;
+
+ @Inject
+ private OpenIdProviderApi opApi;
+
+ @Inject
+ private Dialogue dialogue;
+
+ @Inject
+ private Attributes attributes;
+
+ public void authenticate(String realm, String userName, boolean immediate)
+ {
+ if (identity.isLoggedIn() && userName != null &&
!userName.equals(identity.getUserName()))
+ {
+ opApi.authenticationFailed();
+ }
+ else
+ {
+ try
+ {
+ StringBuilder url = new StringBuilder();
+ url.append(servletContext.getContextPath());
+
url.append("/Login.jsf?dialogueId=").append((dialogue.getDialogueId()));
+ url.append("&realm=").append(URLEncoder.encode(realm,
"UTF-8"));
+ if (userName != null)
+ {
+ url.append("&userName=").append(URLEncoder.encode(userName,
"UTF-8"));
+ }
+ responseHolder.getResponse().sendRedirect(url.toString());
+ }
+ catch (IOException e)
+ {
+ throw new RuntimeException(e);
+ }
+ }
+ }
+
+ public void fetchParameters(List<OpenIdRequestedAttribute> requestedAttributes)
+ {
+ attributes.setRequestedAttributes(requestedAttributes);
+ try
+ {
+ responseHolder.getResponse().sendRedirect(servletContext.getContextPath() +
"/Attributes.jsf?dialogueId=" + dialogue.getDialogueId());
+ }
+ catch (IOException e)
+ {
+ throw new RuntimeException(e);
+ }
+ }
+
+ public boolean userExists(String userName)
+ {
+ return true;
+ }
+}
Property changes on:
modules/security/trunk/examples/openid-op/src/main/java/org/jboss/seam/security/examples/openid/OpenIdProviderSpiImpl.java
___________________________________________________________________
Name: svn
+ eol-style=native
Name: svn:keywords
+ Revision Author Date
Added: modules/security/trunk/examples/openid-op/src/main/webapp/Attributes.xhtml
===================================================================
--- modules/security/trunk/examples/openid-op/src/main/webapp/Attributes.xhtml
(rev 0)
+++ modules/security/trunk/examples/openid-op/src/main/webapp/Attributes.xhtml 2010-09-18
11:15:45 UTC (rev 13766)
@@ -0,0 +1,40 @@
+<f:view
xmlns="http://www.w3.org/1999/xhtml"
+
xmlns:ui="http://java.sun.com/jsf/facelets"
+
xmlns:h="http://java.sun.com/jsf/html"
+
xmlns:c="http://java.sun.com/jsp/jstl/core"
+
xmlns:f="http://java.sun.com/jsf/core">
+ <f:metadata>
+ <f:event type="preRenderView"
+ listener="#{identity.redirectToLoginIfNotLoggedIn}" />
+ </f:metadata>
+ <ui:composition template="/PageTemplate.xhtml">
+
+ <h1>Attributes</h1>
+
+ <h:form>
+ <h:dataTable value="#{attributes.attributeVOs}"
var="attributeVO">
+ <h:column>
+ <f:facet name="header">
+ <h:outputText value="Alias" />
+ </f:facet>
+ <h:outputText value="#{attributeVO.requestedAttribute.alias}" />
+ </h:column>
+ <h:column>
+ <f:facet name="header">
+ <h:outputText value="Required" />
+ </f:facet>
+ <h:selectBooleanCheckbox
+ value="#{attributeVO.requestedAttribute.required}"
disabled="true" />
+ </h:column>
+ <h:column>
+ <f:facet name="header">
+ <h:outputText value="Value" />
+ </f:facet>
+ <h:inputText value="#{attributeVO.attributeValue}" />
+ </h:column>
+ </h:dataTable>
+ <h:commandButton value="OK" action="#{attributes.confirm}"
/>
+ </h:form>
+
+ </ui:composition>
+</f:view>
\ No newline at end of file
Added:
modules/security/trunk/examples/openid-op/src/main/webapp/AuthenticationFailed.xhtml
===================================================================
--- modules/security/trunk/examples/openid-op/src/main/webapp/AuthenticationFailed.xhtml
(rev 0)
+++
modules/security/trunk/examples/openid-op/src/main/webapp/AuthenticationFailed.xhtml 2010-09-18
11:15:45 UTC (rev 13766)
@@ -0,0 +1,10 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
+<html
xmlns="http://www.w3.org/1999/xhtml"
+
xmlns:h="http://java.sun.com/jsf/html"
+
xmlns:f="http://java.sun.com/jsf/core">
+
+<body>
+<h1>Authentication failed.</h1>
+</body>
+
+</html>
\ No newline at end of file
Added: modules/security/trunk/examples/openid-op/src/main/webapp/Configuration.xhtml
===================================================================
--- modules/security/trunk/examples/openid-op/src/main/webapp/Configuration.xhtml
(rev 0)
+++
modules/security/trunk/examples/openid-op/src/main/webapp/Configuration.xhtml 2010-09-18
11:15:45 UTC (rev 13766)
@@ -0,0 +1,13 @@
+<f:view
xmlns="http://www.w3.org/1999/xhtml"
+
xmlns:ui="http://java.sun.com/jsf/facelets"
+
xmlns:h="http://java.sun.com/jsf/html"
+
xmlns:f="http://java.sun.com/jsf/core">
+ <ui:composition template="/PageTemplate.xhtml">
+ <h1>Configuration</h1>
+ <h:panelGrid columns="2" columnClasses="propertyName,
propertyValue">
+ <h:outputText value="XRDS URL" />
+ <h:outputText value="#{configuration.xrdsURL}" />
+ </h:panelGrid>
+
+ </ui:composition>
+</f:view>
Added: modules/security/trunk/examples/openid-op/src/main/webapp/Index.xhtml
===================================================================
--- modules/security/trunk/examples/openid-op/src/main/webapp/Index.xhtml
(rev 0)
+++ modules/security/trunk/examples/openid-op/src/main/webapp/Index.xhtml 2010-09-18
11:15:45 UTC (rev 13766)
@@ -0,0 +1,7 @@
+<f:view
xmlns="http://www.w3.org/1999/xhtml"
+
xmlns:ui="http://java.sun.com/jsf/facelets"
+
xmlns:h="http://java.sun.com/jsf/html"
+
xmlns:f="http://java.sun.com/jsf/core">
+ <ui:composition template="/PageTemplate.xhtml">
+ </ui:composition>
+</f:view>
\ No newline at end of file
Added: modules/security/trunk/examples/openid-op/src/main/webapp/Login.xhtml
===================================================================
--- modules/security/trunk/examples/openid-op/src/main/webapp/Login.xhtml
(rev 0)
+++ modules/security/trunk/examples/openid-op/src/main/webapp/Login.xhtml 2010-09-18
11:15:45 UTC (rev 13766)
@@ -0,0 +1,37 @@
+<f:view
xmlns="http://www.w3.org/1999/xhtml"
+
xmlns:ui="http://java.sun.com/jsf/facelets"
+
xmlns:h="http://java.sun.com/jsf/html"
+
xmlns:c="http://java.sun.com/jsp/jstl/core"
+
xmlns:f="http://java.sun.com/jsf/core">
+ <f:metadata>
+ <f:viewParam name="realm" value="#{login.realm}" />
+ <f:viewParam name="userName"
value="#{login.userNameReceivedFromRp}" />
+ </f:metadata>
+ <ui:composition template="/PageTemplate.xhtml">
+ <h:messages />
+ <c:choose>
+ <c:when test="#{login.dialogueActive}">
+ <h1>Login at #{login.realm}</h1>
+ </c:when>
+ <c:otherwise>
+ <h1>Login</h1>
+ </c:otherwise>
+ </c:choose>
+ <h:form>
+ <h:panelGrid columns="2" columnClasses="propertyName,
propertyValue">
+ <h:outputText value="User name" />
+ <c:choose>
+ <c:when test="#{login.userNameReceivedFromRp == null}">
+ <h:inputText value="#{login.userName}" />
+ </c:when>
+ <c:otherwise>
+ <h:outputText value="#{login.userNameReceivedFromRp}" />
+ </c:otherwise>
+ </c:choose>
+ </h:panelGrid>
+ <p><h:commandButton action="#{login.login}" value="Login"
/> <h:commandButton
+ action="#{login.cancel}" value="Cancel"
+ rendered="#{login.dialogueActive}" /></p>
+ </h:form>
+ </ui:composition>
+</f:view>
\ No newline at end of file
Added: modules/security/trunk/examples/openid-op/src/main/webapp/META-INF/MANIFEST.MF
===================================================================
--- modules/security/trunk/examples/openid-op/src/main/webapp/META-INF/MANIFEST.MF
(rev 0)
+++
modules/security/trunk/examples/openid-op/src/main/webapp/META-INF/MANIFEST.MF 2010-09-18
11:15:45 UTC (rev 13766)
@@ -0,0 +1,3 @@
+Manifest-Version: 1.0
+Class-Path:
+
Added: modules/security/trunk/examples/openid-op/src/main/webapp/Menu.xhtml
===================================================================
--- modules/security/trunk/examples/openid-op/src/main/webapp/Menu.xhtml
(rev 0)
+++ modules/security/trunk/examples/openid-op/src/main/webapp/Menu.xhtml 2010-09-18
11:15:45 UTC (rev 13766)
@@ -0,0 +1,17 @@
+<ui:composition
xmlns="http://www.w3.org/1999/xhtml"
+
xmlns:ui="http://java.sun.com/jsf/facelets"
+
xmlns:h="http://java.sun.com/jsf/html"
+
xmlns:c="http://java.sun.com/jsp/jstl/core"
+
xmlns:f="http://java.sun.com/jsf/core">
+
+ <h:form>
+ <h:commandLink value="Login" action="/Login.xhtml"
+ disabled="#{identity.loggedIn}" /> |
+ <h:commandLink value="Configuration"
action="/Configuration.xhtml" /> |
+ <h:commandLink value="Session Management"
+ action="/SessionManagement.xhtml" disabled="#{!identity.loggedIn}"
/> |
+ <h:commandLink value="Logout" action="#{identity.logout}"
+ disabled="#{!identity.loggedIn}" />
+ </h:form>
+
+</ui:composition>
\ No newline at end of file
Added: modules/security/trunk/examples/openid-op/src/main/webapp/PageTemplate.xhtml
===================================================================
--- modules/security/trunk/examples/openid-op/src/main/webapp/PageTemplate.xhtml
(rev 0)
+++
modules/security/trunk/examples/openid-op/src/main/webapp/PageTemplate.xhtml 2010-09-18
11:15:45 UTC (rev 13766)
@@ -0,0 +1,26 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
+<html
xmlns="http://www.w3.org/1999/xhtml"
+
xmlns:h="http://java.sun.com/jsf/html"
+
xmlns:f="http://java.sun.com/jsf/core"
+
xmlns:ui="http://java.sun.com/jsf/facelets">
+
+<h:body>
+ <h:panelGroup layout="block" styleClass="page">
+
+ <h:head>
+ <link type="text/css" rel="stylesheet"
href="styles.css" />
+ </h:head>
+
+ <h:panelGroup layout="block" styleClass="menu">
+ <ui:include src="/Menu.xhtml" />
+ </h:panelGroup>
+
+ <h:messages />
+
+ <h:panelGroup layout="block" styleClass="content">
+ <ui:insert />
+ </h:panelGroup>
+
+ </h:panelGroup>
+</h:body>
+</html>
\ No newline at end of file
Added: modules/security/trunk/examples/openid-op/src/main/webapp/SessionManagement.xhtml
===================================================================
--- modules/security/trunk/examples/openid-op/src/main/webapp/SessionManagement.xhtml
(rev 0)
+++
modules/security/trunk/examples/openid-op/src/main/webapp/SessionManagement.xhtml 2010-09-18
11:15:45 UTC (rev 13766)
@@ -0,0 +1,24 @@
+<f:view
xmlns="http://www.w3.org/1999/xhtml"
+
xmlns:ui="http://java.sun.com/jsf/facelets"
+
xmlns:h="http://java.sun.com/jsf/html"
+
xmlns:c="http://java.sun.com/jsp/jstl/core"
+
xmlns:f="http://java.sun.com/jsf/core">
+ <f:metadata>
+ <f:event type="preRenderView"
+ listener="#{identity.redirectToLoginIfNotLoggedIn}" />
+ </f:metadata>
+ <ui:composition template="/PageTemplate.xhtml">
+
+ <h1>Session Info</h1>
+
+ <h2>Logged in user</h2>
+
+ <h:panelGrid columns="2" columnClasses="propertyName,
propertyValue">
+ <h:outputText value="User name" />
+ <h:outputText value="#{identity.userName}" />
+ <h:outputText value="User's OpenID" />
+ <h:outputText value="#{identity.opLocalIdentifier}" />
+ </h:panelGrid>
+
+ </ui:composition>
+</f:view>
\ No newline at end of file
Added: modules/security/trunk/examples/openid-op/src/main/webapp/UserInfo.xhtml
===================================================================
--- modules/security/trunk/examples/openid-op/src/main/webapp/UserInfo.xhtml
(rev 0)
+++ modules/security/trunk/examples/openid-op/src/main/webapp/UserInfo.xhtml 2010-09-18
11:15:45 UTC (rev 13766)
@@ -0,0 +1,24 @@
+<f:view
xmlns="http://www.w3.org/1999/xhtml"
+
xmlns:ui="http://java.sun.com/jsf/facelets"
+
xmlns:h="http://java.sun.com/jsf/html"
+
xmlns:c="http://java.sun.com/jsp/jstl/core"
+
xmlns:f="http://java.sun.com/jsf/core">
+ <f:metadata>
+ <f:event type="preRenderView"
+ listener="#{identity.redirectToLoginIfNotLoggedIn}" />
+ </f:metadata>
+ <ui:composition template="/PageTemplate.xhtml">
+
+ <h1>User info</h1>
+
+ <h:panelGrid columns="2" columnClasses="propertyName,
propertyValue">
+ <h:outputText value="Verified User Identifier" />
+ <h:outputText value="#{identity.openIdPrincipal.identifier}" />
+ <h:outputText value="OpenID Provider" />
+ <h:outputText value="#{identity.openIdPrincipal.openIdProvider}" />
+ <h:outputText value="Email" />
+ <h:outputText value="#{identity.openIdPrincipal.attributes.email}" />
+ </h:panelGrid>
+
+ </ui:composition>
+</f:view>
\ No newline at end of file
Added:
modules/security/trunk/examples/openid-op/src/main/webapp/WEB-INF/.faces-config.xml.jsfdia
===================================================================
---
modules/security/trunk/examples/openid-op/src/main/webapp/WEB-INF/.faces-config.xml.jsfdia
(rev 0)
+++
modules/security/trunk/examples/openid-op/src/main/webapp/WEB-INF/.faces-config.xml.jsfdia 2010-09-18
11:15:45 UTC (rev 13766)
@@ -0,0 +1,16 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<PROCESS model-entity="JSFProcess">
+ <PROCESS-ITEM NAME="rules:#Login.xhtml" PATH="/Login.xhtml"
+ SHAPE="32,17,0,0" model-entity="JSFProcessGroup">
+ <PROCESS-ITEM ID="rules:#Login.xhtml:0" NAME="item"
+ PATH="/Login.xhtml" model-entity="JSFProcessItem">
+ <PROCESS-ITEM-OUTPUT
+ ID="LOCAL_LOGIN:#{login.login}:#SessionManagement.xhtml"
+ NAME="output" PATH="/SessionManagement.xhtml"
+ TARGET="rules:#SessionManagement.xhtml"
+ TITLE="#{login.login}:LOCAL_LOGIN"
model-entity="JSFProcessItemOutput"/>
+ </PROCESS-ITEM>
+ </PROCESS-ITEM>
+ <PROCESS-ITEM NAME="rules:#SessionManagement.xhtml"
+ PATH="/SessionManagement.xhtml" SHAPE="240,33,0,0"
model-entity="JSFProcessGroup"/>
+</PROCESS>
Added: modules/security/trunk/examples/openid-op/src/main/webapp/WEB-INF/beans.xml
===================================================================
--- modules/security/trunk/examples/openid-op/src/main/webapp/WEB-INF/beans.xml
(rev 0)
+++ modules/security/trunk/examples/openid-op/src/main/webapp/WEB-INF/beans.xml 2010-09-18
11:15:45 UTC (rev 13766)
@@ -0,0 +1,7 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<beans
xmlns="http://java.sun.com/xml/ns/javaee"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+
xsi:schemaLocation="http://java.sun.com/xml/ns/javaee
http://java.sun.com/xml/ns/javaee/beans_1_0.xsd">
+ <alternatives>
+
<classes>org.jboss.seam.security.external.openid.OpenIdProviderInApplicationScopeProducer</classes>
+ </alternatives>
+</beans>
Added: modules/security/trunk/examples/openid-op/src/main/webapp/WEB-INF/context.xml
===================================================================
--- modules/security/trunk/examples/openid-op/src/main/webapp/WEB-INF/context.xml
(rev 0)
+++
modules/security/trunk/examples/openid-op/src/main/webapp/WEB-INF/context.xml 2010-09-18
11:15:45 UTC (rev 13766)
@@ -0,0 +1,5 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<Context>
+ <!-- log all incoming and outgoing messages. -->
+ <Valve className="org.apache.catalina.valves.RequestDumperValve" />
+</Context>
\ No newline at end of file
Added: modules/security/trunk/examples/openid-op/src/main/webapp/WEB-INF/faces-config.xml
===================================================================
--- modules/security/trunk/examples/openid-op/src/main/webapp/WEB-INF/faces-config.xml
(rev 0)
+++
modules/security/trunk/examples/openid-op/src/main/webapp/WEB-INF/faces-config.xml 2010-09-18
11:15:45 UTC (rev 13766)
@@ -0,0 +1,23 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<faces-config version="2.0"
xmlns="http://java.sun.com/xml/ns/javaee"
+
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="
+
http://java.sun.com/xml/ns/javaee
+
http://java.sun.com/xml/ns/javaee/web-facesconfig_2_0.xsd">
+
+ <name>openidop</name>
+
+ <application>
+
<view-handler>org.jboss.seam.security.examples.openid.DialogueAwareViewHandler</view-handler>
+ </application>
+
+ <navigation-rule>
+ <from-view-id>/Login.xhtml</from-view-id>
+ <navigation-case>
+ <from-action>#{login.login}</from-action>
+ <from-outcome>LOCAL_LOGIN</from-outcome>
+ <to-view-id>/SessionManagement.xhtml</to-view-id>
+ </navigation-case>
+ </navigation-rule>
+
+</faces-config>
Added: modules/security/trunk/examples/openid-op/src/main/webapp/WEB-INF/web.xml
===================================================================
--- modules/security/trunk/examples/openid-op/src/main/webapp/WEB-INF/web.xml
(rev 0)
+++ modules/security/trunk/examples/openid-op/src/main/webapp/WEB-INF/web.xml 2010-09-18
11:15:45 UTC (rev 13766)
@@ -0,0 +1,16 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<web-app version="3.0"
xmlns="http://java.sun.com/xml/ns/javaee"
+
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+
xsi:schemaLocation="http://java.sun.com/xml/ns/javaee
+
http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd">
+
+ <context-param>
+ <param-name>javax.faces.PROJECT_STAGE</param-name>
+ <param-value>Development</param-value>
+ </context-param>
+
+ <welcome-file-list>
+ <welcome-file>index.jsp</welcome-file>
+ </welcome-file-list>
+
+</web-app>
Added: modules/security/trunk/examples/openid-op/src/main/webapp/index.jsp
===================================================================
--- modules/security/trunk/examples/openid-op/src/main/webapp/index.jsp
(rev 0)
+++ modules/security/trunk/examples/openid-op/src/main/webapp/index.jsp 2010-09-18
11:15:45 UTC (rev 13766)
@@ -0,0 +1,8 @@
+<html>
+ <head>
+ <title>Initial Redirect Page</title>
+ </head>
+ <body>
+ <% response.sendRedirect("Index.jsf"); %>
+ </body>
+</html>
\ No newline at end of file
Added: modules/security/trunk/examples/openid-op/src/main/webapp/styles.css
===================================================================
--- modules/security/trunk/examples/openid-op/src/main/webapp/styles.css
(rev 0)
+++ modules/security/trunk/examples/openid-op/src/main/webapp/styles.css 2010-09-18
11:15:45 UTC (rev 13766)
@@ -0,0 +1,31 @@
+.page {
+ width: 800px;
+ margin-left: auto;
+ margin-right: auto;
+}
+
+.menu {
+ margin-top: 15px;
+ height: 50px;
+ background: #d5a5ac;
+ padding: 5px;
+}
+
+.content {
+ margin-top: 15px;
+ top: 100px;
+ margin-left: auto;
+ margin-right: auto;
+ background: white;
+ padding: 5px;
+}
+
+.propertyName {
+ padding: 5px;
+ background-color: #aaaaaa;
+}
+
+.propertyValue {
+ padding: 5px;
+ background-color: #dddddd;
+}
\ No newline at end of file
Modified: modules/security/trunk/examples/openid-rp/readme.txt
===================================================================
--- modules/security/trunk/examples/openid-rp/readme.txt 2010-09-18 11:03:55 UTC (rev
13765)
+++ modules/security/trunk/examples/openid-rp/readme.txt 2010-09-18 11:15:45 UTC (rev
13766)
@@ -26,11 +26,11 @@
Some background info
====================
-The Identity Provider is preconfigured to run at port 8080, to use a test key
-store which is included in the war file, and to use the http protocol for
-communicating with IDPs. These settings are ok for a test setup, but please be
-aware that in production, you'd use http on port 443. In the test application
-these settings are done programmatically (by the OpenIdRelyingPartyCustomizer).
+The Relying Party is preconfigured to run at port 8080, and to use the
+http protocol for communicating with OPs. These settings are ok for a test setup,
+but please be aware that in production, you'd use http on port 443. In the test
+application these settings are done programmatically (by the
+OpenIdRelyingPartyCustomizer).
How to use the application
Modified:
modules/security/trunk/examples/openid-rp/src/main/java/org/jboss/seam/security/examples/id_consumer/Identity.java
===================================================================
---
modules/security/trunk/examples/openid-rp/src/main/java/org/jboss/seam/security/examples/id_consumer/Identity.java 2010-09-18
11:03:55 UTC (rev 13765)
+++
modules/security/trunk/examples/openid-rp/src/main/java/org/jboss/seam/security/examples/id_consumer/Identity.java 2010-09-18
11:15:45 UTC (rev 13766)
@@ -31,9 +31,9 @@
import javax.inject.Inject;
import javax.inject.Named;
-import org.jboss.seam.security.external.api.OpenIdAttribute;
import org.jboss.seam.security.external.api.OpenIdPrincipal;
import org.jboss.seam.security.external.api.OpenIdRelyingPartyApi;
+import org.jboss.seam.security.external.api.OpenIdRequestedAttribute;
@SessionScoped
@Named
@@ -55,8 +55,8 @@
{
if (!isLoggedIn())
{
- List<OpenIdAttribute> attributes = new
LinkedList<OpenIdAttribute>();
- attributes.add(new OpenIdAttribute("email",
"http://schema.openid.net/contact/email", false));
+ List<OpenIdRequestedAttribute> attributes = new
LinkedList<OpenIdRequestedAttribute>();
+ attributes.add(new OpenIdRequestedAttribute("email",
"http://schema.openid.net/contact/email", false, null));
openIdApi.login(openId, attributes);
}
else
Added:
modules/security/trunk/examples/openid-rp/src/main/java/org/jboss/seam/security/examples/id_consumer/Login.java
===================================================================
---
modules/security/trunk/examples/openid-rp/src/main/java/org/jboss/seam/security/examples/id_consumer/Login.java
(rev 0)
+++
modules/security/trunk/examples/openid-rp/src/main/java/org/jboss/seam/security/examples/id_consumer/Login.java 2010-09-18
11:15:45 UTC (rev 13766)
@@ -0,0 +1,49 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2010, Red Hat, Inc., and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site:
http://www.fsf.org.
+ */
+package org.jboss.seam.security.examples.id_consumer;
+
+import javax.enterprise.inject.Model;
+import javax.inject.Inject;
+
+@Model
+public class Login
+{
+ private String openId;
+
+ @Inject
+ private Identity identity;
+
+ public String getOpenId()
+ {
+ return openId;
+ }
+
+ public void setOpenId(String openId)
+ {
+ this.openId = openId;
+ }
+
+ public void login()
+ {
+ identity.startLogin(openId);
+ }
+}
Property changes on:
modules/security/trunk/examples/openid-rp/src/main/java/org/jboss/seam/security/examples/id_consumer/Login.java
___________________________________________________________________
Name: svn
+ eol-style=native
Name: svn:keywords
+ Revision Author Date
Modified:
modules/security/trunk/examples/openid-rp/src/main/java/org/jboss/seam/security/examples/id_consumer/OpenIdRelyingPartySpiImpl.java
===================================================================
---
modules/security/trunk/examples/openid-rp/src/main/java/org/jboss/seam/security/examples/id_consumer/OpenIdRelyingPartySpiImpl.java 2010-09-18
11:03:55 UTC (rev 13765)
+++
modules/security/trunk/examples/openid-rp/src/main/java/org/jboss/seam/security/examples/id_consumer/OpenIdRelyingPartySpiImpl.java 2010-09-18
11:15:45 UTC (rev 13766)
@@ -54,7 +54,7 @@
}
}
- public void loginFailed()
+ public void loginFailed(String message)
{
try
{
Deleted:
modules/security/trunk/examples/openid-rp/src/main/java/org/jboss/seam/security/examples/id_consumer/RequestObserver.java
===================================================================
---
modules/security/trunk/examples/openid-rp/src/main/java/org/jboss/seam/security/examples/id_consumer/RequestObserver.java 2010-09-18
11:03:55 UTC (rev 13765)
+++
modules/security/trunk/examples/openid-rp/src/main/java/org/jboss/seam/security/examples/id_consumer/RequestObserver.java 2010-09-18
11:15:45 UTC (rev 13766)
@@ -1,47 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2010, Red Hat, Inc., and individual contributors
- * by the @authors tag. See the copyright.txt in the distribution for a
- * full listing of individual contributors.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site:
http://www.fsf.org.
- */
-package org.jboss.seam.security.examples.id_consumer;
-
-import javax.enterprise.event.Observes;
-import javax.faces.context.ExternalContext;
-import javax.faces.context.FacesContext;
-import javax.inject.Inject;
-import javax.servlet.http.HttpServletResponse;
-
-import org.jboss.seam.security.external.api.ResponseHolder;
-import org.jboss.seam.security.external.dialogues.api.AfterDialogueActivation;
-
-public class RequestObserver
-{
- @Inject
- private ResponseHolder responseHolder;
-
- public void dialogueCreated(@Observes AfterDialogueActivation event)
- {
- if (FacesContext.getCurrentInstance() != null)
- {
- ExternalContext externalContext =
FacesContext.getCurrentInstance().getExternalContext();
- responseHolder.setResponse((HttpServletResponse)
externalContext.getResponse());
- }
- }
-
-}
Modified: modules/security/trunk/examples/openid-rp/src/main/webapp/Login.xhtml
===================================================================
--- modules/security/trunk/examples/openid-rp/src/main/webapp/Login.xhtml 2010-09-18
11:03:55 UTC (rev 13765)
+++ modules/security/trunk/examples/openid-rp/src/main/webapp/Login.xhtml 2010-09-18
11:15:45 UTC (rev 13766)
@@ -7,17 +7,26 @@
<h1>Login</h1>
<h:form>
- <h:commandLink
-
action="#{identity.startLogin('https://www.google.com/accounts/o...
- value="Login with Google" />
- <br />
- <h:commandLink
- action="#{identity.startLogin('https://me.yahoo.com')}"
- value="Login with Yahoo" />
- <br />
- <h:commandLink
- action="#{identity.startLogin('https://myopenid.com')}"
- value="Login with myOpenID" />
+ Either choose a pre-configured OpenID provider:
+ <ul>
+ <li><h:commandLink
+
action="#{identity.startLogin('https://www.google.com/accounts/o...
+ value="Google" /></li>
+ <li><h:commandLink
+ action="#{identity.startLogin('https://me.yahoo.com')}"
+ value="Yahoo" /> <br />
+ </li>
+ <li><h:commandLink
+ action="#{identity.startLogin('https://myopenid.com')}"
+ value="myOpenID" /> <br />
+ </li>
+ <li><h:commandLink
+ action="#{identity.startLogin('http://www.openid-op.com:8080/openid-op/openid/OP/XrdsService')}"
+ value="Seam Sample OpenID Provider" /></li>
+ </ul>
+ or use your own OpenID:
+ <p><h:inputText value="#{login.openId}" /> <h:commandLink
+ action="#{login.login}" value="login" /></p>
</h:form>
</ui:composition>
Modified: modules/security/trunk/examples/openid-rp/src/main/webapp/Menu.xhtml
===================================================================
--- modules/security/trunk/examples/openid-rp/src/main/webapp/Menu.xhtml 2010-09-18
11:03:55 UTC (rev 13765)
+++ modules/security/trunk/examples/openid-rp/src/main/webapp/Menu.xhtml 2010-09-18
11:15:45 UTC (rev 13766)
@@ -7,7 +7,7 @@
<h:form>
<h:commandLink value="Login" action="/Login.xhtml"
disabled="#{identity.loggedIn}" /> |
- <h:outputText value="User Info" action="/UserInfo.xhtml"
+ <h:commandLink value="User Info" action="/UserInfo.xhtml"
disabled="#{!identity.loggedIn}" /> |
<h:commandLink value="Configuration"
action="/Configuration.xhtml" /> |
<h:commandLink value="Logout" action="#{identity.logout}"
Modified: modules/security/trunk/examples/openid-rp/src/main/webapp/UserInfo.xhtml
===================================================================
--- modules/security/trunk/examples/openid-rp/src/main/webapp/UserInfo.xhtml 2010-09-18
11:03:55 UTC (rev 13765)
+++ modules/security/trunk/examples/openid-rp/src/main/webapp/UserInfo.xhtml 2010-09-18
11:15:45 UTC (rev 13766)
@@ -17,7 +17,7 @@
<h:outputText value="OpenID Provider" />
<h:outputText value="#{identity.openIdPrincipal.openIdProvider}" />
<h:outputText value="Email" />
- <h:outputText value="#{identity.openIdPrincipal.attributes.email}" />
+ <h:outputText
value="#{identity.openIdPrincipal.attributeValues['email']}" />
</h:panelGrid>
</ui:composition>
Modified:
modules/security/trunk/examples/saml-idp/src/main/java/org/jboss/seam/security/examples/id_provider/Configuration.java
===================================================================
---
modules/security/trunk/examples/saml-idp/src/main/java/org/jboss/seam/security/examples/id_provider/Configuration.java 2010-09-18
11:03:55 UTC (rev 13765)
+++
modules/security/trunk/examples/saml-idp/src/main/java/org/jboss/seam/security/examples/id_provider/Configuration.java 2010-09-18
11:15:45 UTC (rev 13766)
@@ -27,6 +27,8 @@
import java.net.MalformedURLException;
import java.net.URL;
import java.net.URLConnection;
+import java.util.LinkedList;
+import java.util.List;
import javax.enterprise.inject.Model;
import javax.faces.application.FacesMessage;
@@ -84,4 +86,14 @@
{
return samlEntityConfig.getMetaDataURL();
}
+
+ public List<String> getSpEntityIds()
+ {
+ List<String> entityIds = new LinkedList<String>();
+ for (SamlExternalEntity entity : samlEntityConfig.getExternalSamlEntities())
+ {
+ entityIds.add(entity.getEntityId());
+ }
+ return entityIds;
+ }
}
Modified:
modules/security/trunk/examples/saml-idp/src/main/java/org/jboss/seam/security/examples/id_provider/Login.java
===================================================================
---
modules/security/trunk/examples/saml-idp/src/main/java/org/jboss/seam/security/examples/id_provider/Login.java 2010-09-18
11:03:55 UTC (rev 13765)
+++
modules/security/trunk/examples/saml-idp/src/main/java/org/jboss/seam/security/examples/id_provider/Login.java 2010-09-18
11:15:45 UTC (rev 13766)
@@ -35,7 +35,7 @@
private String userName;
- private String samlDialogueId;
+ private String dialogueId;
@Inject
private DialogueManager dialogueManager;
@@ -53,22 +53,22 @@
this.userName = userName;
}
- public String getSamlDialogueId()
+ public String getDialogueId()
{
- return samlDialogueId;
+ return dialogueId;
}
- public void setSamlDialogueId(String samlDialogueId)
+ public void setDialogueId(String dialogueId)
{
- this.samlDialogueId = samlDialogueId;
+ this.dialogueId = dialogueId;
}
public String login()
{
identity.localLogin(userName);
- if (samlDialogueId != null)
+ if (dialogueId != null)
{
- dialogueManager.attachDialogue(samlDialogueId);
+ dialogueManager.attachDialogue(dialogueId);
samlIdentityProviderApi.authenticationSucceeded();
dialogueManager.detachDialogue();
return "SAML_LOGIN";
@@ -81,9 +81,9 @@
public void cancel()
{
- if (samlDialogueId != null)
+ if (dialogueId != null)
{
- dialogueManager.attachDialogue(samlDialogueId);
+ dialogueManager.attachDialogue(dialogueId);
samlIdentityProviderApi.authenticationFailed();
dialogueManager.detachDialogue();
}
Deleted:
modules/security/trunk/examples/saml-idp/src/main/java/org/jboss/seam/security/examples/id_provider/Saml.java
===================================================================
---
modules/security/trunk/examples/saml-idp/src/main/java/org/jboss/seam/security/examples/id_provider/Saml.java 2010-09-18
11:03:55 UTC (rev 13765)
+++
modules/security/trunk/examples/saml-idp/src/main/java/org/jboss/seam/security/examples/id_provider/Saml.java 2010-09-18
11:15:45 UTC (rev 13766)
@@ -1,58 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2010, Red Hat, Inc., and individual contributors
- * by the @authors tag. See the copyright.txt in the distribution for a
- * full listing of individual contributors.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site:
http://www.fsf.org.
- */
-package org.jboss.seam.security.examples.id_provider;
-
-import java.util.LinkedList;
-import java.util.List;
-
-import javax.enterprise.inject.Model;
-import javax.inject.Inject;
-
-import org.jboss.seam.security.external.api.SamlIdentityProviderApi;
-import org.jboss.seam.security.external.api.SamlIdentityProviderConfigurationApi;
-import org.jboss.seam.security.external.saml.SamlExternalEntity;
-import org.jboss.seam.security.external.saml.idp.SamlIdpSession;
-
-@Model
-public class Saml
-{
- @Inject
- private SamlIdentityProviderApi samlIdp;
-
- @Inject
- private SamlIdentityProviderConfigurationApi samlIdpConfig;
-
- public List<String> getSpEntityIds()
- {
- List<String> entityIds = new LinkedList<String>();
- for (SamlExternalEntity entity : samlIdpConfig.getExternalSamlEntities())
- {
- entityIds.add(entity.getEntityId());
- }
- return entityIds;
- }
-
- public SamlIdpSession getSession()
- {
- return samlIdp.getSession();
- }
-}
Modified:
modules/security/trunk/examples/saml-idp/src/main/java/org/jboss/seam/security/examples/id_provider/SamlIdentityProviderSpiImpl.java
===================================================================
---
modules/security/trunk/examples/saml-idp/src/main/java/org/jboss/seam/security/examples/id_provider/SamlIdentityProviderSpiImpl.java 2010-09-18
11:03:55 UTC (rev 13765)
+++
modules/security/trunk/examples/saml-idp/src/main/java/org/jboss/seam/security/examples/id_provider/SamlIdentityProviderSpiImpl.java 2010-09-18
11:15:45 UTC (rev 13766)
@@ -63,7 +63,7 @@
{
try
{
- responseHolder.getResponse().sendRedirect(servletContext.getContextPath() +
"/Login.jsf?samlDialogueId=" + dialogue.getDialogueId());
+ responseHolder.getResponse().sendRedirect(servletContext.getContextPath() +
"/Login.jsf?dialogueId=" + dialogue.getDialogueId());
}
catch (IOException e)
{
Modified: modules/security/trunk/examples/saml-idp/src/main/webapp/Configuration.xhtml
===================================================================
---
modules/security/trunk/examples/saml-idp/src/main/webapp/Configuration.xhtml 2010-09-18
11:03:55 UTC (rev 13765)
+++
modules/security/trunk/examples/saml-idp/src/main/webapp/Configuration.xhtml 2010-09-18
11:15:45 UTC (rev 13766)
@@ -6,7 +6,7 @@
<h1>Configuration</h1>
<h:outputText value="Meta Data URL for this SAML entity:
#{configuration.metaDataUrl}" />
<h2>Trusted SAML Service Providers</h2>
- <p><h:dataTable value="#{saml.spEntityIds}"
var="spEntityId" columnClasses="dataTableColumn">
+ <p><h:dataTable value="#{configuration.spEntityIds}"
var="spEntityId" columnClasses="dataTableColumn">
<h:column>
<h:outputText value="#{spEntityId}" />
</h:column>
Modified: modules/security/trunk/examples/saml-idp/src/main/webapp/Login.xhtml
===================================================================
--- modules/security/trunk/examples/saml-idp/src/main/webapp/Login.xhtml 2010-09-18
11:03:55 UTC (rev 13765)
+++ modules/security/trunk/examples/saml-idp/src/main/webapp/Login.xhtml 2010-09-18
11:15:45 UTC (rev 13766)
@@ -3,7 +3,7 @@
xmlns:h="http://java.sun.com/jsf/html"
xmlns:f="http://java.sun.com/jsf/core">
<f:metadata>
- <f:viewParam name="samlDialogueId"
value="#{login.samlDialogueId}" />
+ <f:viewParam name="dialogueId" value="#{login.dialogueId}"
/>
</f:metadata>
<ui:composition template="/PageTemplate.xhtml">
<h:messages />
@@ -13,7 +13,7 @@
<h:inputText value="#{login.userName}" />
<h:commandButton action="#{login.login}" value="Login" />
<h:commandButton action="#{login.cancel}" value="Cancel"
- rendered="#{login.samlDialogueId != null}" />
+ rendered="#{login.dialogueId != null}" />
</h:form>
</ui:composition>
</f:view>
\ No newline at end of file