guanxi-src-notify Mailing List for Guanxi
Brought to you by:
alistairskye,
seanskye
You can subscribe to this list here.
2008 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
(208) |
Aug
(79) |
Sep
(121) |
Oct
(138) |
Nov
(104) |
Dec
(46) |
---|---|---|---|---|---|---|---|---|---|---|---|---|
2009 |
Jan
(15) |
Feb
(82) |
Mar
|
Apr
(1) |
May
(26) |
Jun
(7) |
Jul
|
Aug
(1) |
Sep
|
Oct
(3) |
Nov
(87) |
Dec
(58) |
2010 |
Jan
(164) |
Feb
(135) |
Mar
(26) |
Apr
|
May
|
Jun
(9) |
Jul
(2) |
Aug
|
Sep
|
Oct
|
Nov
(51) |
Dec
|
2011 |
Jan
(30) |
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
From: Alistair Y. <ali...@us...> - 2011-01-26 11:33:47
|
Update of /cvsroot/guanxi/Engine/src/main/java/org/guanxi/sp/engine/service/saml2 In directory sfp-cvsdas-2.v30.ch3.sourceforge.com:/tmp/cvs-serv7220/Engine/src/main/java/org/guanxi/sp/engine/service/saml2 Modified Files: WebBrowserSSOAuthConsumerService.java Log Message: Now puts NameID#NameQualifier and NameID#SPNameQualifier into the Bag of attributes Index: WebBrowserSSOAuthConsumerService.java =================================================================== RCS file: /cvsroot/guanxi/Engine/src/main/java/org/guanxi/sp/engine/service/saml2/WebBrowserSSOAuthConsumerService.java,v retrieving revision 1.13 retrieving revision 1.14 diff -C2 -d -r1.13 -r1.14 *** WebBrowserSSOAuthConsumerService.java 25 Jan 2011 09:23:29 -0000 1.13 --- WebBrowserSSOAuthConsumerService.java 26 Jan 2011 11:33:39 -0000 1.14 *************** *** 302,305 **** --- 302,307 ---- bag.addAttribute(attribute.getName(), nameIDDoc.getNameID().getStringValue()); bag.addAttribute(attributeOID, nameIDDoc.getNameID().getStringValue()); + bag.addAttribute("namequalifier", nameIDDoc.getNameID().getNameQualifier()); + bag.addAttribute("spnamequalifier", nameIDDoc.getNameID().getSPNameQualifier()); } } |
From: Alistair Y. <ali...@us...> - 2011-01-26 09:41:55
|
Update of /cvsroot/guanxi/Engine/src/main/webapp/WEB-INF/guanxi_sp_engine/jsp/saml2 In directory sfp-cvsdas-2.v30.ch3.sourceforge.com:/tmp/cvs-serv9399/Engine/src/main/webapp/WEB-INF/guanxi_sp_engine/jsp/saml2 Modified Files: eds.jsp Log Message: Now outputs JSON Index: eds.jsp =================================================================== RCS file: /cvsroot/guanxi/Engine/src/main/webapp/WEB-INF/guanxi_sp_engine/jsp/saml2/eds.jsp,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** eds.jsp 25 Jan 2011 14:49:56 -0000 1.1 --- eds.jsp 26 Jan 2011 09:41:47 -0000 1.2 *************** *** 1,6 **** ! <%@ page contentType="text/html;charset=UTF-8" language="java" %> ! <html> ! <body> ! <%= request.getAttribute("testvar") %> ! </body> ! </html> \ No newline at end of file --- 1 ---- ! <%= request.getAttribute("jsonFeed") %> \ No newline at end of file |
From: Alistair Y. <ali...@us...> - 2011-01-26 09:39:28
|
Update of /cvsroot/guanxi/Engine/src/main/webapp/WEB-INF/guanxi_sp_engine/config/spring/application In directory sfp-cvsdas-2.v30.ch3.sourceforge.com:/tmp/cvs-serv8599/Engine/src/main/webapp/WEB-INF/guanxi_sp_engine/config/spring/application Modified Files: bootstrap.xml Log Message: Added saml2DiscoveryFeedManager Index: bootstrap.xml =================================================================== RCS file: /cvsroot/guanxi/Engine/src/main/webapp/WEB-INF/guanxi_sp_engine/config/spring/application/bootstrap.xml,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** bootstrap.xml 18 Dec 2008 19:09:27 -0000 1.5 --- bootstrap.xml 26 Jan 2011 09:39:17 -0000 1.6 *************** *** 14,17 **** --- 14,24 ---- </property> <property name="entityFarm"><ref bean="spEntityFarm"/></property> + <property name="saml2DiscoveryFeedManager"><ref bean="saml2DiscoveryFeedManager"/></property> + </bean> + + <bean id="saml2DiscoveryFeedManager" + class="org.guanxi.sp.engine.service.saml2.DiscoveryFeedManager" + init-method="init" + destroy-method="destroy"> </bean> |
From: Alistair Y. <ali...@us...> - 2011-01-26 09:37:44
|
Update of /cvsroot/guanxi/Engine/src/main/java/org/guanxi/sp/engine In directory sfp-cvsdas-2.v30.ch3.sourceforge.com:/tmp/cvs-serv8330/Engine/src/main/java/org/guanxi/sp/engine Modified Files: Bootstrap.java Log Message: Added DiscoveryFeedManager support Index: Bootstrap.java =================================================================== RCS file: /cvsroot/guanxi/Engine/src/main/java/org/guanxi/sp/engine/Bootstrap.java,v retrieving revision 1.13 retrieving revision 1.14 diff -C2 -d -r1.13 -r1.14 *** Bootstrap.java 8 Nov 2010 10:50:33 -0000 1.13 --- Bootstrap.java 26 Jan 2011 09:37:36 -0000 1.14 *************** *** 17,20 **** --- 17,21 ---- package org.guanxi.sp.engine; + import org.guanxi.sp.engine.service.saml2.DiscoveryFeedManager; import org.springframework.web.context.ServletContextAware; import org.springframework.context.ApplicationListener; *************** *** 63,66 **** --- 64,69 ---- /** Our job scheduler */ private Scheduler scheduler = null; + /** The SAML2 Discovery Service feed manager to use */ + private DiscoveryFeedManager saml2DiscoveryFeedManager = null; /** *************** *** 114,117 **** --- 117,123 ---- servletContext.setAttribute(Guanxi.CONTEXT_ATTR_ENGINE_ENTITY_FARM, entityFarm); + // Inject the Discovery Service feed manager + servletContext.setAttribute(Guanxi.CONTEXT_ATTR_ENGINE_DISCOVERY_FEED_MANAGER, saml2DiscoveryFeedManager); + loadGuardMetadata(config.getGuardsMetadataDirectory()); loadIdPMetadata(config.getIdPMetadataDirectory()); *************** *** 402,404 **** --- 408,411 ---- public EntityFarm getEntityFarm() { return entityFarm; } public void setEntityFarm(EntityFarm entityFarm) { this.entityFarm = entityFarm; } + public void setSaml2DiscoveryFeedManager(DiscoveryFeedManager saml2DiscoveryFeedManager) { this.saml2DiscoveryFeedManager = saml2DiscoveryFeedManager; } } |
From: Alistair Y. <ali...@us...> - 2011-01-26 09:36:23
|
Update of /cvsroot/guanxi/Engine/src/main/java/org/guanxi/sp/engine/service/saml2 In directory sfp-cvsdas-2.v30.ch3.sourceforge.com:/tmp/cvs-serv8040/Engine/src/main/java/org/guanxi/sp/engine/service/saml2 Modified Files: EmbeddedDiscoveryService.java Log Message: Now uses DiscoveryFeedManager to output the EDS JSON Index: EmbeddedDiscoveryService.java =================================================================== RCS file: /cvsroot/guanxi/Engine/src/main/java/org/guanxi/sp/engine/service/saml2/EmbeddedDiscoveryService.java,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** EmbeddedDiscoveryService.java 25 Jan 2011 14:36:52 -0000 1.1 --- EmbeddedDiscoveryService.java 26 Jan 2011 09:36:15 -0000 1.2 *************** *** 18,21 **** --- 18,22 ---- import org.apache.log4j.Logger; + import org.guanxi.common.definitions.Guanxi; import org.springframework.web.context.ServletContextAware; import org.springframework.web.servlet.ModelAndView; *************** *** 43,49 **** public ModelAndView handleRequest(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { ModelAndView mAndV = new ModelAndView(); mAndV.setViewName("/saml2/eds"); ! mAndV.getModel().put("testvar", "testvar-value"); return mAndV; } --- 44,51 ---- public ModelAndView handleRequest(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { + DiscoveryFeedManager feedManager = (DiscoveryFeedManager)getServletContext().getAttribute(Guanxi.CONTEXT_ATTR_ENGINE_DISCOVERY_FEED_MANAGER); ModelAndView mAndV = new ModelAndView(); mAndV.setViewName("/saml2/eds"); ! mAndV.getModel().put("jsonFeed", feedManager.toJSON()); return mAndV; } |
From: Alistair Y. <ali...@us...> - 2011-01-26 09:35:12
|
Update of /cvsroot/guanxi/Engine/src/main/java/org/guanxi/sp/engine/service/saml2 In directory sfp-cvsdas-2.v30.ch3.sourceforge.com:/tmp/cvs-serv7433/Engine/src/main/java/org/guanxi/sp/engine/service/saml2 Added Files: DiscoveryFeedManager.java Log Message: Manages the entities to be displayed by the Embedded Discovery Service (EDS) --- NEW FILE: DiscoveryFeedManager.java --- //: "The contents of this file are subject to the Mozilla Public License //: Version 1.1 (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.mozilla.org/MPL/ //: //: Software distributed under the License is distributed on an "AS IS" //: basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the //: License for the specific language governing rights and limitations //: under the License. //: //: The Original Code is Guanxi (http://www.guanxi.uhi.ac.uk). //: //: The Initial Developer of the Original Code is Alistair Young ali...@co... //: All Rights Reserved. //: package org.guanxi.sp.engine.service.saml2; import java.util.Enumeration; import java.util.Hashtable; /** * Manages the entities to be displayed by the Embedded Discovery Service (EDS) * * @author alistair */ public class DiscoveryFeedManager { private Hashtable<String, DiscoveryEntity> entities = null; public void init() { entities = new Hashtable<String, DiscoveryEntity>(); } public void destroy() {} /** * Adds an entity to the EDS * * @param entityID the entity's entityID from its metadata */ public void addEntity(String entityID) { if (!entities.containsKey(entityID)) { entities.put(entityID, new DiscoveryEntity(entityID)); } } /** * Deletes an entity from the EDS * * @param entityID the entity's entityID from its metadata */ public void deleteEntity(String entityID) { if (entities.containsKey(entityID)) { entities.remove(entityID); } } /** * Adds a display name to the entity * * @param entityID the entity's entityID from its metadata * @param displayName the display name for the EDS * @param language the two letter language code for this display name */ public void addDisplayName(String entityID, String displayName, String language) { if (entities.containsKey(entityID)) { ((DiscoveryEntity)(entities.get(entityID))).addDisplayName(displayName, language); } } /** * Returns a JSON representation for the EDS to display * * @see {@linktourl }https://spaces.internet2.edu/download/attachments/11075654/json_schema.json?version=1&modificationDate=1289903420875} * @return JSON representing all registered entities */ public String toJSON() { String json = "["; String entityID = null; DiscoveryEntity entity = null; Enumeration<String> entityIDs = entities.keys(); while (entityIDs.hasMoreElements()) { entityID = (String)entityIDs.nextElement(); entity = entities.get(entityID); json += "{"; json += "\"entityID\": \"" + entityID + "\","; String displayName, displayNameLang = null; Enumeration<String> displayNames = entity.getDisplayNames().keys(); json += "\"DisplayNames\": ["; while (displayNames.hasMoreElements()) { json += "{"; displayName = (String)displayNames.nextElement(); displayNameLang = entity.getDisplayNames().get(displayName); json += "\"value\": \"" + displayName + "\","; json += "\"lang\": \"" + displayNameLang + "\""; json += "}"; if (displayNames.hasMoreElements()) json += ","; } json += "]"; json += "}"; if (entityIDs.hasMoreElements()) json += ","; } json += "]"; return json; } } |
From: Alistair Y. <ali...@us...> - 2011-01-26 09:29:36
|
Update of /cvsroot/guanxi/Engine/src/main/java/org/guanxi/sp/engine/service/saml2 In directory sfp-cvsdas-2.v30.ch3.sourceforge.com:/tmp/cvs-serv6087/Engine/src/main/java/org/guanxi/sp/engine/service/saml2 Added Files: DiscoveryEntity.java Log Message: Encapsulates information about an entity for the Embedded Discovery Service to display --- NEW FILE: DiscoveryEntity.java --- //: "The contents of this file are subject to the Mozilla Public License //: Version 1.1 (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.mozilla.org/MPL/ //: //: Software distributed under the License is distributed on an "AS IS" //: basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the //: License for the specific language governing rights and limitations //: under the License. //: //: The Original Code is Guanxi (http://www.guanxi.uhi.ac.uk). //: //: The Initial Developer of the Original Code is Alistair Young ali...@co... //: All Rights Reserved. //: package org.guanxi.sp.engine.service.saml2; import java.util.Hashtable; /** * Encapsulates information about an entity for the Embedded Discovery Service to display * * @author alistair */ public class DiscoveryEntity { private String entityID = null; private Hashtable<String, String> displayNames; public DiscoveryEntity(String entityID) { this.entityID = entityID; displayNames = new Hashtable<String, String>(); } public void addDisplayName(String displayName, String language) { displayNames.put(displayName, language); } public Hashtable<String, String> getDisplayNames() { return displayNames; } } |
From: Alistair Y. <ali...@us...> - 2011-01-26 09:27:44
|
Update of /cvsroot/guanxi/Engine/src/main/java/org/guanxi/sp/engine/job In directory sfp-cvsdas-2.v30.ch3.sourceforge.com:/tmp/cvs-serv5806/Engine/src/main/java/org/guanxi/sp/engine/job Modified Files: SAML2MetadataParser.java Log Message: Updated javadoc Index: SAML2MetadataParser.java =================================================================== RCS file: /cvsroot/guanxi/Engine/src/main/java/org/guanxi/sp/engine/job/SAML2MetadataParser.java,v retrieving revision 1.14 retrieving revision 1.15 diff -C2 -d -r1.14 -r1.15 *** SAML2MetadataParser.java 26 Jan 2011 09:26:19 -0000 1.14 --- SAML2MetadataParser.java 26 Jan 2011 09:27:35 -0000 1.15 *************** *** 116,119 **** --- 116,125 ---- } + /** + * Adds an IdP to the list of entities the Embedded Discovery Service will display + * + * @param entityDescriptor the IdP's metadata + * @param manager the DiscoveryFeedManager to use + */ private void addEntityToDiscoveryFeed(EntityDescriptorType entityDescriptor, DiscoveryFeedManager manager) { if (entityDescriptor.getOrganization() != null) { |
From: Alistair Y. <ali...@us...> - 2011-01-26 09:26:27
|
Update of /cvsroot/guanxi/Engine/src/main/java/org/guanxi/sp/engine/job In directory sfp-cvsdas-2.v30.ch3.sourceforge.com:/tmp/cvs-serv5507/Engine/src/main/java/org/guanxi/sp/engine/job Modified Files: SAML2MetadataParser.java Log Message: Added Discovery Feed support Index: SAML2MetadataParser.java =================================================================== RCS file: /cvsroot/guanxi/Engine/src/main/java/org/guanxi/sp/engine/job/SAML2MetadataParser.java,v retrieving revision 1.13 retrieving revision 1.14 diff -C2 -d -r1.13 -r1.14 *** SAML2MetadataParser.java 25 Nov 2010 10:22:00 -0000 1.13 --- SAML2MetadataParser.java 26 Jan 2011 09:26:19 -0000 1.14 *************** *** 18,21 **** --- 18,23 ---- import org.guanxi.common.trust.TrustUtils; + import org.guanxi.sp.engine.service.saml2.DiscoveryFeedManager; + import org.guanxi.xal.saml_2_0.metadata.LocalizedNameType; import org.quartz.Job; import org.quartz.JobExecutionContext; *************** *** 72,75 **** --- 74,79 ---- EntityManager manager = loadEntityManager(Guanxi.CONTEXT_ATTR_ENGINE_ENTITY_FARM); + DiscoveryFeedManager discoveryFeedManager = (DiscoveryFeedManager)config.getServletContext().getAttribute(Guanxi.CONTEXT_ATTR_ENGINE_DISCOVERY_FEED_MANAGER); + try { // Store the new entity IDs for cleaning out old ones later *************** *** 92,95 **** --- 96,102 ---- newEntityIDs.add(entityDescriptor.getEntityID()); + + // SAML2 Discovery Service feed + addEntityToDiscoveryFeed(entityDescriptor, discoveryFeedManager); } } *************** *** 100,103 **** --- 107,111 ---- if (!newEntityIDs.contains(oldEntityID)) { manager.removeMetadata(oldEntityID); + deleteEntityFromDiscoveryFeed(oldEntityID, discoveryFeedManager); } } *************** *** 107,109 **** --- 115,132 ---- } } + + private void addEntityToDiscoveryFeed(EntityDescriptorType entityDescriptor, DiscoveryFeedManager manager) { + if (entityDescriptor.getOrganization() != null) { + manager.addEntity(entityDescriptor.getEntityID()); + + LocalizedNameType[] orgs = entityDescriptor.getOrganization().getOrganizationDisplayNameArray(); + for (LocalizedNameType org : orgs) { + manager.addDisplayName(entityDescriptor.getEntityID(), org.getStringValue(), org.getLang()); + } + } + } + + private void deleteEntityFromDiscoveryFeed(String entityID, DiscoveryFeedManager manager) { + manager.deleteEntity(entityID); + } } |
From: Alistair Y. <ali...@us...> - 2011-01-26 09:24:00
|
Update of /cvsroot/guanxi/Common/src/org/guanxi/common/definitions In directory sfp-cvsdas-2.v30.ch3.sourceforge.com:/tmp/cvs-serv4641/Common/src/org/guanxi/common/definitions Modified Files: Guanxi.java Log Message: Added Discovery Feed context definition Index: Guanxi.java =================================================================== RCS file: /cvsroot/guanxi/Common/src/org/guanxi/common/definitions/Guanxi.java,v retrieving revision 1.33 retrieving revision 1.34 diff -C2 -d -r1.33 -r1.34 *** Guanxi.java 25 Jan 2010 14:10:52 -0000 1.33 --- Guanxi.java 26 Jan 2011 09:23:52 -0000 1.34 *************** *** 121,124 **** --- 121,126 ---- /** The servlet context attribute that holds the EntityFarm implementation for the Engine */ public static final String CONTEXT_ATTR_ENGINE_ENTITY_FARM = "CONTEXT_ATTR_ENGINE_ENTITY_FARM"; + /** The servlet context attribute that holds the DiscoveryFeedManager for the Engine */ + public static final String CONTEXT_ATTR_ENGINE_DISCOVERY_FEED_MANAGER = "CONTEXT_ATTR_ENGINE_DISCOVERY_FEED_MANAGER"; /** The name of the request parameter that the Engine and Guard use to add and retrieve the |
From: Alistair Y. <ali...@us...> - 2011-01-25 14:53:55
|
Update of /cvsroot/guanxi/Engine/src/main/webapp/WEB-INF/guanxi_sp_engine/config/spring/profiles/saml2 In directory sfp-cvsdas-2.v30.ch3.sourceforge.com:/tmp/cvs-serv18719/Engine/src/main/webapp/WEB-INF/guanxi_sp_engine/config/spring/profiles/saml2 Removed Files: discovery.jsp Log Message: Deleted discovery.jsp --- discovery.jsp DELETED --- |
From: Alistair Y. <ali...@us...> - 2011-01-25 14:52:01
|
Update of /cvsroot/guanxi/Engine/src/main/webapp/WEB-INF/guanxi_sp_engine/jsp/saml2 In directory sfp-cvsdas-2.v30.ch3.sourceforge.com:/tmp/cvs-serv18310/Engine/src/main/webapp/WEB-INF/guanxi_sp_engine/jsp/saml2 Added Files: discovery.jsp Log Message: Redirects to SAML2 Discovery Service or displays an error --- NEW FILE: discovery.jsp --- <html> <head> <% if (request.getAttribute("edsError") == null) { %> <meta http-equiv="REFRESH" content="0;url=<%= request.getAttribute("edsURL") %>"> <% } %> </head> <% if (request.getAttribute("edsError") != null) { %> <body> <p><%= request.getAttribute("edsError") %></p> </body> <% } %> </html> |
From: Alistair Y. <ali...@us...> - 2011-01-25 14:50:07
|
Update of /cvsroot/guanxi/Engine/src/main/webapp/WEB-INF/guanxi_sp_engine/jsp/saml2 In directory sfp-cvsdas-2.v30.ch3.sourceforge.com:/tmp/cvs-serv17470/Engine/src/main/webapp/WEB-INF/guanxi_sp_engine/jsp/saml2 Added Files: eds.jsp Log Message: JSON feed for Embedded Discovery Service --- NEW FILE: eds.jsp --- <%@ page contentType="text/html;charset=UTF-8" language="java" %> <html> <body> <%= request.getAttribute("testvar") %> </body> </html> |
From: Alistair Y. <ali...@us...> - 2011-01-25 14:48:33
|
Update of /cvsroot/guanxi/Engine/src/main/webapp/WEB-INF/guanxi_sp_engine/config/spring/services/saml2 In directory sfp-cvsdas-2.v30.ch3.sourceforge.com:/tmp/cvs-serv17104/Engine/src/main/webapp/WEB-INF/guanxi_sp_engine/config/spring/services/saml2 Added Files: eds.xml Log Message: Embedded Discovery Service definition --- NEW FILE: eds.xml --- <?xml version="1.0" encoding="UTF-8"?> <beans xmlns="http://www.springframework.org/schema/beans" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.0.xsd"> <bean id="saml2EDS" class="org.guanxi.sp.engine.service.saml2.EmbeddedDiscoveryService" init-method="init" destroy-method="destroy"> </bean> </beans> |
From: Alistair Y. <ali...@us...> - 2011-01-25 14:46:22
|
Update of /cvsroot/guanxi/Engine/src/main/webapp/WEB-INF/guanxi_sp_engine/config/spring/services/generic In directory sfp-cvsdas-2.v30.ch3.sourceforge.com:/tmp/cvs-serv16667/Engine/src/main/webapp/WEB-INF/guanxi_sp_engine/config/spring/services/generic Modified Files: generic-profile-service.xml Log Message: Added SAML Discovery Service support Index: generic-profile-service.xml =================================================================== RCS file: /cvsroot/guanxi/Engine/src/main/webapp/WEB-INF/guanxi_sp_engine/config/spring/services/generic/generic-profile-service.xml,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** generic-profile-service.xml 9 Jun 2010 10:14:47 -0000 1.2 --- generic-profile-service.xml 25 Jan 2011 14:46:14 -0000 1.3 *************** *** 17,20 **** --- 17,22 ---- <property name="shibbolethProfileService" ref="shibbolethProfileService" /> <property name="saml2ProfileService" ref="saml2ProfileService" /> + <property name="saml2DiscoveryProfileService" ref="saml2DiscoveryProfileService" /> + <property name="useDiscoveryService"><value>true</value></property> <!-- The Guard can send an entityID when contacting the GPS *************** *** 56,58 **** --- 58,69 ---- </bean> + + <bean id="saml2DiscoveryProfileService" + class="org.guanxi.sp.engine.service.saml2.DiscoveryProfileService" + init-method="init"> + + <property name="viewName"><value>/saml2/discovery</value></property> + <property name="edsBaseURL"><value>https://localhost/samlengine/guanxi_sp/eds</value></property> + + </bean> </beans> \ No newline at end of file |
From: Alistair Y. <ali...@us...> - 2011-01-25 14:44:30
|
Update of /cvsroot/guanxi/Engine/src/main/webapp/WEB-INF/guanxi_sp_engine/config/spring/profiles/saml2 In directory sfp-cvsdas-2.v30.ch3.sourceforge.com:/tmp/cvs-serv15902/Engine/src/main/webapp/WEB-INF/guanxi_sp_engine/config/spring/profiles/saml2 Added Files: eds.xml Log Message: Embedded Discovery Service definition --- NEW FILE: eds.xml --- <?xml version="1.0" encoding="UTF-8"?> <beans xmlns="http://www.springframework.org/schema/beans" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.0.xsd"> <!-- Embedded Discovery Service --> <bean class="org.springframework.web.servlet.handler.SimpleUrlHandlerMapping"> <property name="alwaysUseFullPath"><value>true</value></property> <property name="urlMap"> <map> <entry key="/s2/eds"><ref bean="saml2EDS"/></entry> </map> </property> </bean> </beans> |
From: Alistair Y. <ali...@us...> - 2011-01-25 14:42:34
|
Update of /cvsroot/guanxi/Engine/src/main/webapp/WEB-INF/guanxi_sp_engine/config/spring/profiles/saml2 In directory sfp-cvsdas-2.v30.ch3.sourceforge.com:/tmp/cvs-serv15524/Engine/src/main/webapp/WEB-INF/guanxi_sp_engine/config/spring/profiles/saml2 Added Files: discovery.jsp Log Message: Redirects to the Embedded Discovery Service or displays an error --- NEW FILE: discovery.jsp --- <html> <head> <% if (request.getAttribute("edsError") == null) { %> <meta http-equiv="REFRESH" content="0;url=<%= request.getAttribute("edsURL") %>"> <% } %> </head> <% if (request.getAttribute("edsError") != null) { %> <body> <p><%= request.getAttribute("edsError") %></p> </body> <% } %> </html> |
From: Alistair Y. <ali...@us...> - 2011-01-25 14:41:14
|
Update of /cvsroot/guanxi/Engine/src/main/resources In directory sfp-cvsdas-2.v30.ch3.sourceforge.com:/tmp/cvs-serv15259/Engine/src/main/resources Modified Files: log4j.properties Log Message: Added SP EmbeddedDiscoveryService, DiscoveryProfileService logging configuration Index: log4j.properties =================================================================== RCS file: /cvsroot/guanxi/Engine/src/main/resources/log4j.properties,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** log4j.properties 4 Nov 2010 14:36:08 -0000 1.6 --- log4j.properties 25 Jan 2011 14:41:04 -0000 1.7 *************** *** 201,202 **** --- 201,236 ---- log4j.appender.spEntityConnectionFile.layout=org.apache.log4j.PatternLayout log4j.appender.spEntityConnectionFile.layout.ConversionPattern=%d{dd MMMM yyyy HH:mm:ss} - %m%n + + # ########################################################################################### + # SP EmbeddedDiscoveryService logging configuration + # ########################################################################################### + log4j.logger.org.guanxi.sp.engine.service.saml2.EmbeddedDiscoveryService=all, spEmbeddedDiscoveryServiceConsole, spEmbeddedDiscoveryServiceFile + log4j.additivity.org.guanxi.sp.engine.service.saml2.EmbeddedDiscoveryService=false + + log4j.appender.spEmbeddedDiscoveryServiceConsole=org.apache.log4j.ConsoleAppender + log4j.appender.spEmbeddedDiscoveryServiceConsole.layout=org.apache.log4j.PatternLayout + log4j.appender.spEmbeddedDiscoveryServiceConsole.layout.ConversionPattern=%d %p [%c] - %m%n + + log4j.appender.spEmbeddedDiscoveryServiceFile=org.apache.log4j.RollingFileAppender + log4j.appender.spEmbeddedDiscoveryServiceFile.File=${guanxi-sp-engine.root}/WEB-INF/guanxi_sp_engine/logs/eds.log + log4j.appender.spEmbeddedDiscoveryServiceFile.MaxFileSize=5MB + log4j.appender.spEmbeddedDiscoveryServiceFile.MaxBackupIndex=5 + log4j.appender.spEmbeddedDiscoveryServiceFile.layout=org.apache.log4j.PatternLayout + log4j.appender.spEmbeddedDiscoveryServiceFile.layout.ConversionPattern=%d{dd MMMM yyyy HH:mm:ss} - %m%n + + # ########################################################################################### + # SP DiscoveryProfileService logging configuration + # ########################################################################################### + log4j.logger.org.guanxi.sp.engine.service.saml2.DiscoveryProfileService=all, spDiscoveryProfileServiceConsole, spDiscoveryProfileServiceFile + log4j.additivity.org.guanxi.sp.engine.service.saml2.DiscoveryProfileService=false + + log4j.appender.spDiscoveryProfileServiceConsole=org.apache.log4j.ConsoleAppender + log4j.appender.spDiscoveryProfileServiceConsole.layout=org.apache.log4j.PatternLayout + log4j.appender.spDiscoveryProfileServiceConsole.layout.ConversionPattern=%d %p [%c] - %m%n + + log4j.appender.spDiscoveryProfileServiceFile=org.apache.log4j.RollingFileAppender + log4j.appender.spDiscoveryProfileServiceFile.File=${guanxi-sp-engine.root}/WEB-INF/guanxi_sp_engine/logs/ds.log + log4j.appender.spDiscoveryProfileServiceFile.MaxFileSize=5MB + log4j.appender.spDiscoveryProfileServiceFile.MaxBackupIndex=5 + log4j.appender.spDiscoveryProfileServiceFile.layout=org.apache.log4j.PatternLayout + log4j.appender.spDiscoveryProfileServiceFile.layout.ConversionPattern=%d{dd MMMM yyyy HH:mm:ss} - %m%n |
From: Alistair Y. <ali...@us...> - 2011-01-25 14:39:15
|
Update of /cvsroot/guanxi/Engine/src/main/java/org/guanxi/sp/engine/service/shibboleth In directory sfp-cvsdas-2.v30.ch3.sourceforge.com:/tmp/cvs-serv14540/Engine/src/main/java/org/guanxi/sp/engine/service/shibboleth Modified Files: ShibbolethProfileService.java Log Message: Updated doProfile for updated ProfileService signature Index: ShibbolethProfileService.java =================================================================== RCS file: /cvsroot/guanxi/Engine/src/main/java/org/guanxi/sp/engine/service/shibboleth/ShibbolethProfileService.java,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** ShibbolethProfileService.java 9 Jun 2010 09:17:49 -0000 1.3 --- ShibbolethProfileService.java 25 Jan 2011 14:39:07 -0000 1.4 *************** *** 28,31 **** --- 28,32 ---- import org.springframework.web.servlet.ModelAndView; + import javax.servlet.http.HttpServletRequest; import java.io.UnsupportedEncodingException; import java.net.URLEncoder; *************** *** 52,57 **** public void init() {} ! /** @see org.guanxi.sp.engine.service.generic.ProfileService#doProfile(String, String, org.guanxi.xal.saml2.metadata.GuardRoleDescriptorExtensions, String, org.guanxi.common.entity.EntityFarm) */ ! public ModelAndView doProfile(String guardID, String guardSessionID, GuardRoleDescriptorExtensions guardNativeMetadata, String entityID, EntityFarm farm) throws GuanxiException { ModelAndView mAndV = new ModelAndView(); --- 53,59 ---- public void init() {} ! /** @see org.guanxi.sp.engine.service.generic.ProfileService#doProfile(javax.servlet.http.HttpServletRequest, String, String, org.guanxi.xal.saml2.metadata.GuardRoleDescriptorExtensions, String, org.guanxi.common.entity.EntityFarm) */ ! public ModelAndView doProfile(HttpServletRequest request, String guardID, String guardSessionID, ! GuardRoleDescriptorExtensions guardNativeMetadata, String entityID, EntityFarm farm) throws GuanxiException { ModelAndView mAndV = new ModelAndView(); |
From: Alistair Y. <ali...@us...> - 2011-01-25 14:38:13
|
Update of /cvsroot/guanxi/Engine/src/main/java/org/guanxi/sp/engine/service/saml2 In directory sfp-cvsdas-2.v30.ch3.sourceforge.com:/tmp/cvs-serv14355/Engine/src/main/java/org/guanxi/sp/engine/service/saml2 Modified Files: SAML2ProfileService.java Log Message: Updated doProfile for updated ProfileService signature Index: SAML2ProfileService.java =================================================================== RCS file: /cvsroot/guanxi/Engine/src/main/java/org/guanxi/sp/engine/service/saml2/SAML2ProfileService.java,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** SAML2ProfileService.java 24 Feb 2010 13:05:30 -0000 1.1 --- SAML2ProfileService.java 25 Jan 2011 14:38:04 -0000 1.2 *************** *** 35,38 **** --- 35,39 ---- import org.springframework.web.servlet.ModelAndView; + import javax.servlet.http.HttpServletRequest; import java.io.UnsupportedEncodingException; import java.net.URLEncoder; *************** *** 58,63 **** public void init() {} ! /** @see org.guanxi.sp.engine.service.generic.ProfileService#doProfile(String, String, org.guanxi.xal.saml2.metadata.GuardRoleDescriptorExtensions, String, org.guanxi.common.entity.EntityFarm) */ ! public ModelAndView doProfile(String guardID, String guardSessionID, GuardRoleDescriptorExtensions guardNativeMetadata, String entityID, EntityFarm farm) throws GuanxiException { ModelAndView mAndV = new ModelAndView(); --- 59,65 ---- public void init() {} ! /** @see org.guanxi.sp.engine.service.generic.ProfileService#doProfile(javax.servlet.http.HttpServletRequest, String, String, org.guanxi.xal.saml2.metadata.GuardRoleDescriptorExtensions, String, org.guanxi.common.entity.EntityFarm) */ ! public ModelAndView doProfile(HttpServletRequest request, String guardID, String guardSessionID, ! GuardRoleDescriptorExtensions guardNativeMetadata, String entityID, EntityFarm farm) throws GuanxiException { ModelAndView mAndV = new ModelAndView(); |
From: Alistair Y. <ali...@us...> - 2011-01-25 14:37:00
|
Update of /cvsroot/guanxi/Engine/src/main/java/org/guanxi/sp/engine/service/saml2 In directory sfp-cvsdas-2.v30.ch3.sourceforge.com:/tmp/cvs-serv14135/Engine/src/main/java/org/guanxi/sp/engine/service/saml2 Added Files: EmbeddedDiscoveryService.java Log Message: SAML2 Embedded Discovery Service JSON feed generator --- NEW FILE: EmbeddedDiscoveryService.java --- //: "The contents of this file are subject to the Mozilla Public License //: Version 1.1 (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.mozilla.org/MPL/ //: //: Software distributed under the License is distributed on an "AS IS" //: basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the //: License for the specific language governing rights and limitations //: under the License. //: //: The Original Code is Guanxi (http://www.guanxi.uhi.ac.uk). //: //: The Initial Developer of the Original Code is Alistair Young ali...@co... //: All Rights Reserved. //: package org.guanxi.sp.engine.service.saml2; import org.apache.log4j.Logger; import org.springframework.web.context.ServletContextAware; import org.springframework.web.servlet.ModelAndView; import org.springframework.web.servlet.mvc.multiaction.MultiActionController; import javax.servlet.ServletException; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import java.io.IOException; public class EmbeddedDiscoveryService extends MultiActionController implements ServletContextAware { /** Our logger */ private static final Logger logger = Logger.getLogger(EmbeddedDiscoveryService.class.getName()); public void init() {} public void destroy() {} /** * This is the handler for the initial /s2/eds page * * @param request ServletRequest * @param response ServletResponse * @throws java.io.IOException if an error occurs */ public ModelAndView handleRequest(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { ModelAndView mAndV = new ModelAndView(); mAndV.setViewName("/saml2/eds"); mAndV.getModel().put("testvar", "testvar-value"); return mAndV; } } |
From: Alistair Y. <ali...@us...> - 2011-01-25 14:35:45
|
Update of /cvsroot/guanxi/Engine/src/main/java/org/guanxi/sp/engine/service/saml2 In directory sfp-cvsdas-2.v30.ch3.sourceforge.com:/tmp/cvs-serv13885/Engine/src/main/java/org/guanxi/sp/engine/service/saml2 Added Files: DiscoveryProfileService.java Log Message: SAML2 Discovery Service implementation --- NEW FILE: DiscoveryProfileService.java --- //: "The contents of this file are subject to the Mozilla Public License //: Version 1.1 (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.mozilla.org/MPL/ //: //: Software distributed under the License is distributed on an "AS IS" //: basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the //: License for the specific language governing rights and limitations //: under the License. //: //: The Original Code is Guanxi (http://www.guanxi.uhi.ac.uk). //: //: The Initial Developer of the Original Code is Alistair Young ali...@co... //: All Rights Reserved. //: package org.guanxi.sp.engine.service.saml2; import org.apache.log4j.Logger; import org.guanxi.common.GuanxiException; import org.guanxi.common.definitions.Guanxi; import org.guanxi.common.entity.EntityFarm; import org.guanxi.sp.engine.service.generic.ProfileService; import org.guanxi.xal.saml2.metadata.GuardRoleDescriptorExtensions; import org.springframework.web.servlet.ModelAndView; import javax.servlet.http.HttpServletRequest; import java.io.UnsupportedEncodingException; import java.net.URLEncoder; public class DiscoveryProfileService implements ProfileService { /** Our logger */ private static final Logger logger = Logger.getLogger(DiscoveryProfileService.class.getName()); /** The name of the view to use to redirect to the EDS */ private String viewName = null; /** Where the EDS is */ private String edsBaseURL = null; /** @see org.guanxi.sp.engine.service.generic.ProfileService#init() */ public void init() {} /** @see org.guanxi.sp.engine.service.generic.ProfileService#doProfile(javax.servlet.http.HttpServletRequest, String, String, org.guanxi.xal.saml2.metadata.GuardRoleDescriptorExtensions, String, org.guanxi.common.entity.EntityFarm) */ public ModelAndView doProfile(HttpServletRequest request, String guardID, String guardSessionID, GuardRoleDescriptorExtensions guardNativeMetadata, String entityID, EntityFarm farm) throws GuanxiException { ModelAndView mAndV = new ModelAndView(); mAndV.setViewName(viewName); try { String edsURL = edsBaseURL + "?entityID=" + URLEncoder.encode(guardID, "UTF-8"); edsURL += "&return=" + URLEncoder.encode(request.getRequestURL() + "?" + Guanxi.WAYF_PARAM_GUARD_ID + "=" + guardID + "&" + Guanxi.WAYF_PARAM_SESSION_ID + "=" + guardSessionID, "UTF-8"); edsURL += "&returnIDParam=" + URLEncoder.encode("edsEntityID", "UTF-8"); mAndV.getModel().put("edsURL", edsURL); } catch(UnsupportedEncodingException use) { logger.error("Could not encode EDS URL", use); mAndV.getModel().put("edsError", use.getMessage()); } return mAndV; } // Setters public void setViewName(String viewName) { this.viewName = viewName; } public void setEdsBaseURL(String edsBaseURL) { this.edsBaseURL = edsBaseURL; } } |
From: Alistair Y. <ali...@us...> - 2011-01-25 14:33:52
|
Update of /cvsroot/guanxi/Engine/src/main/java/org/guanxi/sp/engine/service/generic In directory sfp-cvsdas-2.v30.ch3.sourceforge.com:/tmp/cvs-serv13089/Engine/src/main/java/org/guanxi/sp/engine/service/generic Modified Files: ProfileService.java Log Message: Updated doProfile to take HttpServletRequest to support SAML2 Discovery Service Index: ProfileService.java =================================================================== RCS file: /cvsroot/guanxi/Engine/src/main/java/org/guanxi/sp/engine/service/generic/ProfileService.java,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** ProfileService.java 24 Feb 2010 13:03:53 -0000 1.1 --- ProfileService.java 25 Jan 2011 14:33:44 -0000 1.2 *************** *** 22,25 **** --- 22,27 ---- import org.springframework.web.servlet.ModelAndView; + import javax.servlet.http.HttpServletRequest; + /** * Profile service defintion *************** *** 36,39 **** --- 38,42 ---- * Performs the work of constructing a route to an entity using a particular profile * + * @param request the original request * @param guardID the ID of the Guard which wants to talk to the entity * @param guardSessionID the sessionid of the Guard which wants to talk to the entity *************** *** 44,48 **** * @throws GuanxiException if an error occurs */ ! public ModelAndView doProfile(String guardID, String guardSessionID, GuardRoleDescriptorExtensions guardNativeMetadata, String entityID, EntityFarm farm) throws GuanxiException; } --- 47,52 ---- * @throws GuanxiException if an error occurs */ ! public ModelAndView doProfile(HttpServletRequest request, String guardID, String guardSessionID, ! GuardRoleDescriptorExtensions guardNativeMetadata, String entityID, EntityFarm farm) throws GuanxiException; } |
From: Alistair Y. <ali...@us...> - 2011-01-25 14:32:15
|
Update of /cvsroot/guanxi/Engine/src/main/java/org/guanxi/sp/engine/service/generic In directory sfp-cvsdas-2.v30.ch3.sourceforge.com:/tmp/cvs-serv12757/Engine/src/main/java/org/guanxi/sp/engine/service/generic Modified Files: GenericProfileService.java Log Message: Added support for SAML2 Discovery Service Index: GenericProfileService.java =================================================================== RCS file: /cvsroot/guanxi/Engine/src/main/java/org/guanxi/sp/engine/service/generic/GenericProfileService.java,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** GenericProfileService.java 9 Jun 2010 10:15:09 -0000 1.2 --- GenericProfileService.java 25 Jan 2011 14:32:06 -0000 1.3 *************** *** 57,62 **** --- 57,66 ---- /** The SAML2 profile service to use */ private ProfileService saml2ProfileService = null; + /** The SAML2 Discovery profile service to use */ + private ProfileService saml2DiscoveryProfileService = null; /** The list of Guard to entityID mappings */ private HashMap<String, String> entityIDs = null; + /** Whether to use the SAML2 Discovery Service */ + private boolean useDiscoveryService; public void init() {} *************** *** 65,74 **** String guardID = request.getParameter(Guanxi.WAYF_PARAM_GUARD_ID); String guardSessionID = request.getParameter(Guanxi.WAYF_PARAM_SESSION_ID); ! // Optional entityID ! String entityID = request.getParameter("entityID"); // If the Guard hasn't specified an entityID, see if it has one registered for it ! if (entityID == null) { if (entityIDs != null) { String entityIDForGuard = null; --- 69,78 ---- String guardID = request.getParameter(Guanxi.WAYF_PARAM_GUARD_ID); String guardSessionID = request.getParameter(Guanxi.WAYF_PARAM_SESSION_ID); ! // Optional entityID ! String idpEntityID = request.getParameter("entityID"); // If the Guard hasn't specified an entityID, see if it has one registered for it ! if (idpEntityID == null) { if (entityIDs != null) { String entityIDForGuard = null; *************** *** 85,94 **** } ! entityID = (entityIDForGuard != null) ? entityIDForGuard : defaultEntityID; ! logger.info("Guard '" + guardID + "' obtained entityID : " + entityID); } } else { ! logger.info("Guard '" + guardID + "' specified entityID : " + entityID); } --- 89,103 ---- } ! idpEntityID = (entityIDForGuard != null) ? entityIDForGuard : defaultEntityID; ! logger.info("Guard '" + guardID + "' obtained entityID : " + idpEntityID); } } else { ! logger.info("Guard '" + guardID + "' specified entityID : " + idpEntityID); ! } ! ! // If no IdP entityID, see if it's coming from the discovery service ! if ((idpEntityID == null) && (useDiscoveryService)) { ! idpEntityID = request.getParameter("edsEntityID"); } *************** *** 114,118 **** EntityFarm farm = (EntityFarm)getServletContext().getAttribute(Guanxi.CONTEXT_ATTR_ENGINE_ENTITY_FARM); try { ! return getProfileService(farm, entityID).doProfile(guardID, guardSessionID, guardNativeMetadata, entityID, farm); } catch(GuanxiException ge) { --- 123,127 ---- EntityFarm farm = (EntityFarm)getServletContext().getAttribute(Guanxi.CONTEXT_ATTR_ENGINE_ENTITY_FARM); try { ! return getProfileService(request, farm, idpEntityID).doProfile(request, guardID, guardSessionID, guardNativeMetadata, idpEntityID, farm); } catch(GuanxiException ge) { *************** *** 129,167 **** * Selects a profile to use * * @param farm entity farm ! * @param entityID entityID of the IdP or null if there isn't one * @return ProfileService instance which defaults to Shibboleth * @throws GuanxiException if an error occurs */ ! private ProfileService getProfileService(EntityFarm farm, String entityID) throws GuanxiException { ! if (entityID == null) { ! // No entityID so assume Shibboleth ! return shibbolethProfileService; ! } ! else { ! // Load the metadata for the IdP ! EntityManager manager = farm.getEntityManagerForID(entityID); ! if (manager == null) { ! throw new GuanxiException("Could not find manager for IdP '" + entityID); } ! Metadata entityMetadata = manager.getMetadata(entityID); ! if (entityMetadata == null) { ! throw new GuanxiException("Could not find metadata for IdP " + entityID); } ! EntityDescriptorType saml2Metadata = (EntityDescriptorType)entityMetadata.getPrivateData(); ! // Look for SAML2 endpoints ! EndpointType[] ssos = saml2Metadata.getIDPSSODescriptorArray(0).getSingleSignOnServiceArray(); ! for (EndpointType sso : ssos) { ! String binding = sso.getBinding(); ! if ((binding.equals(SAML.SAML2_BINDING_HTTP_POST)) || ! (binding.equals(SAML.SAML2_BINDING_HTTP_REDIRECT))) { ! return saml2ProfileService; ! } ! } ! // If we get here, SAML2 isn't supported so use Shibboleth ! return shibbolethProfileService; } } --- 138,190 ---- * Selects a profile to use * + * @param request the request * @param farm entity farm ! * @param idpEntityID entityID of the IdP or null if there isn't one * @return ProfileService instance which defaults to Shibboleth * @throws GuanxiException if an error occurs */ ! private ProfileService getProfileService(HttpServletRequest request, EntityFarm farm, String idpEntityID) throws GuanxiException { ! if (idpEntityID == null) { ! // Check to see if the Discovery Service has anything for us ! if (useDiscoveryService) { ! if (request.getParameter("edsEntityID") != null) { ! idpEntityID = request.getParameter("edsEntityID"); ! } ! else if (request.getParameter("edsEntityID") == null) { ! // Use the Embedded Discovery Service to get an IdP entityID ! return saml2DiscoveryProfileService; ! } } ! else { ! // No entityID so assume Shibboleth ! return shibbolethProfileService; } ! } ! // By now we have an IdP entityID ! // Load the metadata for the IdP ! EntityManager manager = farm.getEntityManagerForID(idpEntityID); ! if (manager == null) { ! throw new GuanxiException("Could not find manager for IdP '" + idpEntityID); ! } ! Metadata entityMetadata = manager.getMetadata(idpEntityID); ! if (entityMetadata == null) { ! throw new GuanxiException("Could not find metadata for IdP " + idpEntityID); ! } ! EntityDescriptorType saml2Metadata = (EntityDescriptorType)entityMetadata.getPrivateData(); ! ! // Look for SAML2 endpoints ! EndpointType[] ssos = saml2Metadata.getIDPSSODescriptorArray(0).getSingleSignOnServiceArray(); ! for (EndpointType sso : ssos) { ! String binding = sso.getBinding(); ! if ((binding.equals(SAML.SAML2_BINDING_HTTP_POST)) || ! (binding.equals(SAML.SAML2_BINDING_HTTP_REDIRECT))) { ! return saml2ProfileService; ! } } + + // If we get here, SAML2 isn't supported so use Shibboleth + return shibbolethProfileService; } *************** *** 172,175 **** --- 195,200 ---- public void setShibbolethProfileService(ProfileService shibbolethProfileService) { this.shibbolethProfileService = shibbolethProfileService; } public void setSaml2ProfileService(ProfileService saml2ProfileService) { this.saml2ProfileService = saml2ProfileService; } + public void setSaml2DiscoveryProfileService(ProfileService saml2DiscoveryProfileService) { this.saml2DiscoveryProfileService = saml2DiscoveryProfileService; } public void setEntityIDs(HashMap<String, String> entityIDs) { this.entityIDs = entityIDs; } + public void setUseDiscoveryService(boolean useDiscoveryService) { this.useDiscoveryService = useDiscoveryService; } } |
From: Alistair Y. <ali...@us...> - 2011-01-25 09:23:37
|
Update of /cvsroot/guanxi/Engine/src/main/java/org/guanxi/sp/engine/service/saml2 In directory sfp-cvsdas-2.v30.ch3.sourceforge.com:/tmp/cvs-serv7077/Engine/src/main/java/org/guanxi/sp/engine/service/saml2 Modified Files: WebBrowserSSOAuthConsumerService.java Log Message: Now handles basic and x500/ldap attribute profiles Index: WebBrowserSSOAuthConsumerService.java =================================================================== RCS file: /cvsroot/guanxi/Engine/src/main/java/org/guanxi/sp/engine/service/saml2/WebBrowserSSOAuthConsumerService.java,v retrieving revision 1.12 retrieving revision 1.13 diff -C2 -d -r1.12 -r1.13 *** WebBrowserSSOAuthConsumerService.java 24 Jan 2011 14:25:36 -0000 1.12 --- WebBrowserSSOAuthConsumerService.java 25 Jan 2011 09:23:29 -0000 1.13 *************** *** 260,306 **** String attributeOID = null; for (AttributeType attribute : attributes) { ! // Remove the prefix from the attribute name ! attributeOID = attribute.getName().replaceAll(EduPersonOID.ATTRIBUTE_NAME_PREFIX, ""); ! ! XmlObject[] obj = attribute.getAttributeValueArray(); ! for (int cc=0; cc < obj.length; cc++) { ! // Is it a scoped attribute? ! if (obj[cc].getDomNode().getAttributes().getNamedItem(EduPerson.EDUPERSON_SCOPE_ATTRIBUTE) != null) { ! String attrValue = obj[cc].getDomNode().getFirstChild().getNodeValue(); ! attrValue += EduPerson.EDUPERSON_SCOPED_DELIMITER; ! attrValue += obj[cc].getDomNode().getAttributes().getNamedItem(EduPerson.EDUPERSON_SCOPE_ATTRIBUTE).getNodeValue(); ! bag.addAttribute(attribute.getFriendlyName(), attrValue); ! bag.addAttribute(attributeOID, attrValue); } ! // What about eduPersonTargetedID? ! else if (attributeOID.equals(EduPersonOID.OID_EDUPERSON_TARGETED_ID)) { ! NodeList attrValueNodes = obj[cc].getDomNode().getChildNodes(); ! Node attrValueNode = null; ! for (int c=0; c < attrValueNodes.getLength(); c++) { ! attrValueNode = attrValueNodes.item(c); ! if (attrValueNode.getLocalName() != null) { ! if (attrValueNode.getLocalName().equals("NameID")) ! break; } } ! if (attrValueNode != null) { ! NameIDDocument nameIDDoc = NameIDDocument.Factory.parse(attrValueNode); ! bag.addAttribute(attribute.getFriendlyName(), nameIDDoc.getNameID().getStringValue()); ! bag.addAttribute(attributeOID, nameIDDoc.getNameID().getStringValue()); ! } ! } ! else { ! if (obj[cc].getDomNode().getFirstChild() != null) { ! if (obj[cc].getDomNode().getFirstChild().getNodeValue() != null) { ! bag.addAttribute(attribute.getName(), obj[cc].getDomNode().getFirstChild().getNodeValue()); ! bag.addAttribute(attributeOID, obj[cc].getDomNode().getFirstChild().getNodeValue()); } ! else { ! bag.addAttribute(attribute.getName(), ""); ! bag.addAttribute(attributeOID, ""); } } ! } ! } // for (int cc=0; cc < obj.length; cc++) } // for (AttributeType attribute : attributes) } // for (EncryptedElementType assertion : assertions) --- 260,320 ---- String attributeOID = null; for (AttributeType attribute : attributes) { ! if (attribute.getNameFormat().equals(SAML.SAML2_ATTRIBUTE_PROFILE_BASIC)) { ! XmlObject[] attributeValues = attribute.getAttributeValueArray(); ! for (int cc=0; cc < attributeValues.length; cc++) { ! String attrValue = attributeValues[cc].getDomNode().getFirstChild().getNodeValue(); ! bag.addAttribute(attribute.getName(), attrValue); } ! } ! else if (attribute.getNameFormat().equals(SAML.SAML2_ATTRIBUTE_PROFILE_X500_LDAP)) { ! // Remove the prefix from the attribute name ! attributeOID = attribute.getName().replaceAll(EduPersonOID.ATTRIBUTE_NAME_PREFIX, ""); ! ! XmlObject[] attributeValues = attribute.getAttributeValueArray(); ! for (int cc=0; cc < attributeValues.length; cc++) { ! // Is it a scoped attribute? ! if (attributeValues[cc].getDomNode().getAttributes().getNamedItem(EduPerson.EDUPERSON_SCOPE_ATTRIBUTE) != null) { ! String attrValue = attributeValues[cc].getDomNode().getFirstChild().getNodeValue(); ! attrValue += EduPerson.EDUPERSON_SCOPED_DELIMITER; ! attrValue += attributeValues[cc].getDomNode().getAttributes().getNamedItem(EduPerson.EDUPERSON_SCOPE_ATTRIBUTE).getNodeValue(); ! if (attributeHasFriendlyName(attribute)) { ! bag.addAttribute(attribute.getFriendlyName(), attrValue); } + bag.addAttribute(attribute.getName(), attrValue); + bag.addAttribute(attributeOID, attrValue); } ! // What about eduPersonTargetedID? ! else if (attributeOID.equals(EduPersonOID.OID_EDUPERSON_TARGETED_ID)) { ! NodeList attrValueNodes = attributeValues[cc].getDomNode().getChildNodes(); ! Node attrValueNode = null; ! for (int c=0; c < attrValueNodes.getLength(); c++) { ! attrValueNode = attrValueNodes.item(c); ! if (attrValueNode.getLocalName() != null) { ! if (attrValueNode.getLocalName().equals("NameID")) ! break; ! } } ! if (attrValueNode != null) { ! NameIDDocument nameIDDoc = NameIDDocument.Factory.parse(attrValueNode); ! if (attributeHasFriendlyName(attribute)) { ! bag.addAttribute(attribute.getFriendlyName(), nameIDDoc.getNameID().getStringValue()); ! } ! bag.addAttribute(attribute.getName(), nameIDDoc.getNameID().getStringValue()); ! bag.addAttribute(attributeOID, nameIDDoc.getNameID().getStringValue()); } } ! else { ! if (attributeValues[cc].getDomNode().getFirstChild() != null) { ! if (attributeValues[cc].getDomNode().getFirstChild().getNodeValue() != null) { ! if (attributeHasFriendlyName(attribute)) { ! bag.addAttribute(attribute.getFriendlyName(), attributeValues[cc].getDomNode().getFirstChild().getNodeValue()); ! } ! bag.addAttribute(attribute.getName(), attributeValues[cc].getDomNode().getFirstChild().getNodeValue()); ! bag.addAttribute(attributeOID, attributeValues[cc].getDomNode().getFirstChild().getNodeValue()); ! } ! } ! } ! } // for (int cc=0; cc < obj.length; cc++) ! } // else if (attribute.getNameFormat().equals(SAML.SAML2_ATTRIBUTE_PROFILE_X500_LDAP)) { } // for (AttributeType attribute : attributes) } // for (EncryptedElementType assertion : assertions) *************** *** 314,317 **** --- 328,342 ---- /** + * Determines whether an Attribute has a FriendlyName + * + * @param attribute the Attribute + * @return true if it has a FriendlyName, otherwise false + */ + private boolean attributeHasFriendlyName(AttributeType attribute) { + return ((attribute.getFriendlyName() != null) && + (attribute.getFriendlyName().length() > 0)); + } + + /** * Extracts the Assertions from a decrypted SAML2 Response * |