[java-plugin-shibd] branch main updated: Checkpoint WIP to revamp design without socket remoting.
Scott Cantor
cantor.2 at osu.edu
Tue May 14 15:25:00 UTC 2024
This is an automated email from the git hooks/post-receive script.
scantor pushed a commit to branch main
in repository java-plugin-shibd.
View the commit online:
http://git.shibboleth.net/view/?p=java-plugin-shibd.git;a=commit;h=0489530030953e806342411065a6376e66825585
The following commit(s) were added to refs/heads/main by this push:
new 0489530 Checkpoint WIP to revamp design without socket remoting.
0489530 is described below
commit 0489530030953e806342411065a6376e66825585
Author: Scott Cantor <cantor.2 at osu.edu>
AuthorDate: Tue May 14 11:24:57 2024 -0400
Checkpoint WIP to revamp design without socket remoting.
---
pom.xml | 31 ++--
sp-bom/pom.xml | 7 +-
sp-conf-impl/pom.xml | 18 +--
.../{idp/plugin/sp => sp/conf}/ServerModule.java | 2 +-
.../{idp/plugin/sp => sp/conf}/ServerPlugin.java | 2 +-
.../{idp/plugin/sp => sp/conf}/Version.java | 2 +-
.../{idp/plugin/sp => sp/conf}/package-info.java | 2 +-
.../META-INF/net.shibboleth.idp/postconfig.xml | 97 ++----------
.../shibboleth/idp/flows/sp/ping/ping-beans.xml | 33 +++++
.../net/shibboleth/idp/flows/sp/ping/ping-flow.xml | 30 ++++
.../services/net.shibboleth.idp.module.IdPModule | 2 +-
.../services/net.shibboleth.idp.plugin.IdPPlugin | 2 +-
.../net/shibboleth/idp/plugin/sp/module.properties | 20 ---
.../conf/applications-system.xml} | 3 +
.../net/shibboleth/sp/conf/module.properties | 20 +++
.../{idp/plugin/sp => sp/conf}/plugin.properties | 3 +-
.../plugin => }/sp/conf/relying-party-system.xml | 0
.../plugin => }/sp/module/conf/applications.xml | 0
.../plugin => }/sp/module/conf/credentials.xml | 0
.../{idp/plugin => }/sp/module/conf/sp.properties | 0
.../net/shibboleth/sp/remoting/impl/ping.msg | 3 +
.../net/shibboleth/sp/remoting/impl/test.error.msg | 2 +-
sp-dist/pom.xml | 4 +-
sp-saml-api/.checkstyle | 2 +-
sp-saml-api/pom.xml | 2 +-
sp-saml-impl/.checkstyle | 2 +-
sp-saml-impl/pom.xml | 2 +-
sp-server-api/.checkstyle | 2 +-
sp-server-api/pom.xml | 2 +-
.../src/main/java/net/shibboleth/sp/Agent.java | 53 +++++++
.../java/net/shibboleth/sp/AgentCriterion.java | 50 +++++++
.../main/java/net/shibboleth/sp/Application.java | 34 +----
.../net/shibboleth/sp/ApplicationCriterion.java | 50 +++++++
.../net/shibboleth/sp/ApplicationResolver.java | 15 +-
.../shibboleth/sp/remoting/AbstractEndpoint.java | 54 -------
.../sp/remoting/ApplicationEndpoint.java | 60 --------
.../sp/remoting/ApplicationEndpointManager.java | 44 ------
.../java/net/shibboleth/sp/remoting/Endpoint.java | 57 -------
.../shibboleth/sp/remoting/EndpointManager.java | 48 ------
.../sp/remoting/RemoteProcessingException.java | 63 --------
.../net/shibboleth/sp/remoting/package-info.java | 19 ---
sp-server-impl/.checkstyle | 2 +-
sp-server-impl/pom.xml | 15 +-
.../java/net/shibboleth/sp/impl/BasicAgent.java | 98 +++++++++++++
.../net/shibboleth/sp/impl/BasicApplication.java | 121 ++++-----------
.../sp/impl/DefaultApplicationResolver.java | 104 +++++++++++++
.../java/net/shibboleth/sp/impl/package-info.java | 5 +-
.../impl/DoPing.java} | 28 ++--
.../shibboleth/sp/remoting/endpoint/impl/Echo.java | 47 ------
.../shibboleth/sp/remoting/endpoint/impl/Ping.java | 47 ------
.../sp/remoting/endpoint/impl/XMLParser.java | 105 -------------
.../sp/remoting/endpoint/impl/package-info.java | 19 ---
.../impl/BasicApplicationEndpointManager.java | 72 ---------
.../sp/remoting/impl/BasicEndpointManager.java | 71 ---------
.../sp/remoting/impl/ErrorTransformer.java | 64 --------
.../sp/remoting/impl/ReloadingEndpointManager.java | 65 --------
.../sp/remoting/impl/RequestProcessor.java | 163 ---------------------
.../shibboleth/sp/remoting/impl/package-info.java | 19 ---
.../tcp/impl/TCPConnectionInterceptorFactory.java | 104 -------------
.../sp/remoting/tcp/impl/package-info.java | 19 ---
.../sp/spring/impl/ByteArrayToDDFConverter.java | 41 ------
.../shibboleth/sp/spring/impl/package-info.java | 18 ---
sp-session-api/.checkstyle | 2 +-
sp-session-api/pom.xml | 2 +-
{sp-server-api => sp-session-impl}/.checkstyle | 2 +-
sp-session-impl/pom.xml | 2 +-
sp-testing/.checkstyle | 2 +-
sp-testing/pom.xml | 2 +-
68 files changed, 573 insertions(+), 1508 deletions(-)
diff --git a/pom.xml b/pom.xml
index a0e6c9c..102ade4 100644
--- a/pom.xml
+++ b/pom.xml
@@ -6,35 +6,34 @@
<parent>
<groupId>net.shibboleth</groupId>
<artifactId>parent</artifactId>
- <version>17.1.0-SNAPSHOT</version>
+ <version>17.1.3-SNAPSHOT</version>
</parent>
<groupId>net.shibboleth.sp</groupId>
- <artifactId>sp-server-parent</artifactId>
+ <artifactId>sp-parent</artifactId>
<version>0.0.1-SNAPSHOT</version>
- <name>Shibboleth SP :: Processing Hub</name>
+ <name>Shibboleth SP :: Processing Hub Plugin</name>
<packaging>pom</packaging>
<properties>
- <shibboleth.projectName>java-sp-server</shibboleth.projectName>
+ <shibboleth.projectName>java-plugin-shibd</shibboleth.projectName>
<shib-shared.groupId>net.shibboleth</shib-shared.groupId>
- <shib-shared.version>9.1.0-SNAPSHOT</shib-shared.version>
+ <shib-shared.version>9.1.3-SNAPSHOT</shib-shared.version>
<opensaml.groupId>org.opensaml</opensaml.groupId>
- <opensaml.version>5.1.0-SNAPSHOT</opensaml.version>
+ <opensaml.version>5.1.3-SNAPSHOT</opensaml.version>
<shib-metadata.groupId>net.shibboleth</shib-metadata.groupId>
- <shib-metadata.version>5.1.0-SNAPSHOT</shib-metadata.version>
+ <shib-metadata.version>5.1.3-SNAPSHOT</shib-metadata.version>
<shib-attribute.groupId>net.shibboleth</shib-attribute.groupId>
- <shib-attribute.version>5.1.0-SNAPSHOT</shib-attribute.version>
+ <shib-attribute.version>5.1.3-SNAPSHOT</shib-attribute.version>
<shib-profile.groupId>net.shibboleth</shib-profile.groupId>
- <shib-profile.version>5.1.0-SNAPSHOT</shib-profile.version>
+ <shib-profile.version>5.1.3-SNAPSHOT</shib-profile.version>
<idp.groupId>net.shibboleth.idp</idp.groupId>
- <idp.version>5.1.0-SNAPSHOT</idp.version>
- <spring-int.version>6.0.1</spring-int.version>
+ <idp.version>5.1.3-SNAPSHOT</idp.version>
<checkstyle.configLocation>${project.basedir}/resources/checkstyle/checkstyle.xml</checkstyle.configLocation>
</properties>
<description>
- Processing service/engine/hub for the Shibboleth Service Provider.
+ Processing service/hub for Shibboleth Service Provider agents, implemented as an IdP plugin.
</description>
<modules>
@@ -128,14 +127,6 @@
<type>pom</type>
<scope>import</scope>
</dependency>
-
- <dependency>
- <groupId>org.springframework.integration</groupId>
- <artifactId>spring-integration-bom</artifactId>
- <version>${spring-int.version}</version>
- <scope>import</scope>
- <type>pom</type>
- </dependency>
</dependencies>
</dependencyManagement>
diff --git a/sp-bom/pom.xml b/sp-bom/pom.xml
index 4a76d6a..153b841 100644
--- a/sp-bom/pom.xml
+++ b/sp-bom/pom.xml
@@ -6,7 +6,7 @@
<parent>
<groupId>net.shibboleth.sp</groupId>
- <artifactId>sp-server-parent</artifactId>
+ <artifactId>sp-parent</artifactId>
<version>0.0.1-SNAPSHOT</version>
</parent>
@@ -49,11 +49,6 @@
<version>${project.version}</version>
</dependency>
- <dependency>
- <groupId>${project.groupId}</groupId>
- <artifactId>sp-conf</artifactId>
- <version>${project.version}</version>
- </dependency>
<dependency>
<groupId>${project.groupId}</groupId>
<artifactId>sp-conf-impl</artifactId>
diff --git a/sp-conf-impl/pom.xml b/sp-conf-impl/pom.xml
index 3af13c4..05a27ad 100644
--- a/sp-conf-impl/pom.xml
+++ b/sp-conf-impl/pom.xml
@@ -5,7 +5,7 @@
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>net.shibboleth.sp</groupId>
- <artifactId>sp-server-parent</artifactId>
+ <artifactId>sp-parent</artifactId>
<version>0.0.1-SNAPSHOT</version>
</parent>
@@ -16,7 +16,7 @@
<properties>
<checkstyle.configLocation>${project.basedir}/../resources/checkstyle/checkstyle.xml</checkstyle.configLocation>
- <automatic.module.name>net.shibboleth.sp.conf.impl</automatic.module.name>
+ <automatic.module.name>net.shibboleth.sp.conf</automatic.module.name>
</properties>
<dependencies>
@@ -125,12 +125,6 @@
<scope>provided</scope>
</dependency>
- <dependency>
- <groupId>org.springframework.integration</groupId>
- <artifactId>spring-integration-ip</artifactId>
- <scope>runtime</scope>
- </dependency>
-
<dependency>
<groupId>ch.qos.logback</groupId>
<artifactId>logback-core</artifactId>
@@ -168,14 +162,6 @@
</archive>
</configuration>
</plugin>
- <plugin>
- <groupId>org.codehaus.mojo</groupId>
- <artifactId>exec-maven-plugin</artifactId>
- <configuration>
- <mainClass>net.shibboleth.sp.impl.Main</mainClass>
- <skip>false</skip>
- </configuration>
- </plugin>
</plugins>
</build>
diff --git a/sp-conf-impl/src/main/java/net/shibboleth/idp/plugin/sp/ServerModule.java b/sp-conf-impl/src/main/java/net/shibboleth/sp/conf/ServerModule.java
similarity index 96%
rename from sp-conf-impl/src/main/java/net/shibboleth/idp/plugin/sp/ServerModule.java
rename to sp-conf-impl/src/main/java/net/shibboleth/sp/conf/ServerModule.java
index 673943b..55e60d8 100644
--- a/sp-conf-impl/src/main/java/net/shibboleth/idp/plugin/sp/ServerModule.java
+++ b/sp-conf-impl/src/main/java/net/shibboleth/sp/conf/ServerModule.java
@@ -12,7 +12,7 @@
* limitations under the License.
*/
-package net.shibboleth.idp.plugin.sp;
+package net.shibboleth.sp.conf;
import java.io.IOException;
diff --git a/sp-conf-impl/src/main/java/net/shibboleth/idp/plugin/sp/ServerPlugin.java b/sp-conf-impl/src/main/java/net/shibboleth/sp/conf/ServerPlugin.java
similarity index 97%
rename from sp-conf-impl/src/main/java/net/shibboleth/idp/plugin/sp/ServerPlugin.java
rename to sp-conf-impl/src/main/java/net/shibboleth/sp/conf/ServerPlugin.java
index c7651fc..b36c7dc 100644
--- a/sp-conf-impl/src/main/java/net/shibboleth/idp/plugin/sp/ServerPlugin.java
+++ b/sp-conf-impl/src/main/java/net/shibboleth/sp/conf/ServerPlugin.java
@@ -12,7 +12,7 @@
* limitations under the License.
*/
-package net.shibboleth.idp.plugin.sp;
+package net.shibboleth.sp.conf;
import java.io.IOException;
diff --git a/sp-conf-impl/src/main/java/net/shibboleth/idp/plugin/sp/Version.java b/sp-conf-impl/src/main/java/net/shibboleth/sp/conf/Version.java
similarity index 96%
rename from sp-conf-impl/src/main/java/net/shibboleth/idp/plugin/sp/Version.java
rename to sp-conf-impl/src/main/java/net/shibboleth/sp/conf/Version.java
index a042ecf..1fa27f6 100644
--- a/sp-conf-impl/src/main/java/net/shibboleth/idp/plugin/sp/Version.java
+++ b/sp-conf-impl/src/main/java/net/shibboleth/sp/conf/Version.java
@@ -12,7 +12,7 @@
* limitations under the License.
*/
-package net.shibboleth.idp.plugin.sp;
+package net.shibboleth.sp.conf;
import javax.annotation.Nullable;
diff --git a/sp-conf-impl/src/main/java/net/shibboleth/idp/plugin/sp/package-info.java b/sp-conf-impl/src/main/java/net/shibboleth/sp/conf/package-info.java
similarity index 94%
copy from sp-conf-impl/src/main/java/net/shibboleth/idp/plugin/sp/package-info.java
copy to sp-conf-impl/src/main/java/net/shibboleth/sp/conf/package-info.java
index 5119786..1992bba 100644
--- a/sp-conf-impl/src/main/java/net/shibboleth/idp/plugin/sp/package-info.java
+++ b/sp-conf-impl/src/main/java/net/shibboleth/sp/conf/package-info.java
@@ -15,4 +15,4 @@
/**
* Module/plugin implementations for SP.
*/
-package net.shibboleth.idp.plugin.sp;
\ No newline at end of file
+package net.shibboleth.sp.conf;
\ No newline at end of file
diff --git a/sp-conf-impl/src/main/resources/META-INF/net.shibboleth.idp/postconfig.xml b/sp-conf-impl/src/main/resources/META-INF/net.shibboleth.idp/postconfig.xml
index c7fce6d..15e1cc0 100644
--- a/sp-conf-impl/src/main/resources/META-INF/net.shibboleth.idp/postconfig.xml
+++ b/sp-conf-impl/src/main/resources/META-INF/net.shibboleth.idp/postconfig.xml
@@ -13,101 +13,26 @@
default-init-method="initialize" default-destroy-method="destroy">
- <!-- Spring Integration machinery. -->
- <!-- Bean name must be set to this. -->
- <bean id="integrationConversionService" class="org.springframework.context.support.ConversionServiceFactoryBean">
- <property name="converters">
- <set>
- <bean class="net.shibboleth.sp.spring.impl.ByteArrayToDDFConverter" />
- <bean class="net.shibboleth.sp.spring.impl.DDFToByteArrayConverter" />
- </set>
- </property>
- </bean>
-
- <bean id="ByteArrayLengthHeaderSerializer"
- class="org.springframework.integration.ip.tcp.serializer.ByteArrayLengthHeaderSerializer" />
-
- <bean id="ByteArrayCrLfSerializer"
- class="org.springframework.integration.ip.tcp.serializer.ByteArrayCrLfSerializer" />
-
- <!--
- This worked fuctionally but didn't manage to allow blocked message exceptions to be raised against
- the error channel.
-
- <bean id="shibboleth.TCPInterceptorFactory"
- class="org.springframework.integration.ip.tcp.connection.TcpConnectionInterceptorFactoryChain">
- <property name="interceptors">
- <array>
- <bean class="net.shibboleth.sp.remoting.tcp.impl.TCPConnectionInterceptorFactory">
- <constructor-arg>
- <bean parent="shibboleth.CommaDelimStringArray"
- c:_0="#{'%{sp.service.allowedRanges:127.0.0.1/32,::0/128}'.trim()}" />
- </constructor-arg>
- </bean>
- </array>
- </property>
- </bean>
-
- interceptor-factory-chain="shibboleth.TCPInterceptorFactory"
- -->
-
- <int-ip:tcp-connection-factory id="shibboleth.IntegrationConnectionFactory"
- type="server"
- lookup-host="false"
- local-address="%{sp.service.address:127.0.0.1}"
- port="%{sp.service.port:1600}"
- serializer="#{%{sp.service.prefixLength:false} ? 'ByteArrayLengthHeaderSerializer' : 'ByteArrayCrLfSerializer'}"
- deserializer="#{%{sp.service.prefixLength:false} ? 'ByteArrayLengthHeaderSerializer' : 'ByteArrayCrLfSerializer'}" />
-
- <int-ip:tcp-inbound-gateway id="shibboleth.IntegrationGateway"
- connection-factory="shibboleth.IntegrationConnectionFactory"
- request-channel="shibboleth.InputServerChannel"
- reply-channel="shibboleth.OutputServerChannel"
- error-channel="shibboleth.ErrorChannel" />
-
- <int:transformer id="shibboleth.ErrorHandler"
- input-channel="shibboleth.ErrorChannel">
- <bean class="%{sp.service.integration.errorTransformerClass:net.shibboleth.sp.remoting.impl.ErrorTransformer}" />
- </int:transformer>
-
- <int:channel id="shibboleth.InputServerChannel" datatype="net.shibboleth.sp.ddf.DDF" />
-
- <int:channel id="shibboleth.OutputServerChannel" datatype="byte[]" />
-
- <int:service-activator id="shibboleth.ServiceActivator"
- input-channel="shibboleth.InputServerChannel"
- output-channel="shibboleth.OutputServerChannel"
- ref="shibboleth.RequestProcessor"
- method="execute" />
-
- <bean id="shibboleth.RequestProcessor" class="net.shibboleth.sp.remoting.impl.RequestProcessor"
- p:endpointManager-ref="shibboleth.ServiceProvider"
- p:allowedRanges="#{'%{sp.service.allowedRanges:127.0.0.1/32,::0/128}'.trim()}" />
-
- <!-- Services -->
-
- <!-- The SP "guts", the remoted endpoints. -->
+ <!-- Application reseolver service. -->
- <bean id="shibboleth.ServiceProvider" parent="shibboleth.ReloadableService"
- c:claz="net.shibboleth.sp.remoting.EndpointManager"
- p:serviceConfigurations-ref="ExtendedServiceProviderResources"
- p:failFast="%{idp.service.sp.failFast:%{idp.service.failFast:false}}"
- p:reloadCheckDelay="%{idp.service.sp.checkInterval:PT0S}" />
+ <bean id="shibboleth.sp.ApplicationResolver" parent="shibboleth.ReloadableService"
+ c:claz="TBD"
+ p:serviceConfigurations-ref="ExtendedApplicationResolverResources"
+ p:failFast="%{sp.service.applications.failFast:%{idp.service.failFast:false}}"
+ p:reloadCheckDelay="%{sp.service.applications.checkInterval:PT0S}" />
- <util:list id="shibboleth.DefaultServiceProviderResources">
+ <util:list id="shibboleth.DefaultApplicationResolverResources">
<value>conditional:%{idp.home}/conf/sp/applications.xml</value>
- <value>conditional:%{idp.home}/conf/sp/credentials.xml</value>
</util:list>
<!-- Auto-append system config files to resource set. -->
- <bean id ="ExtendedServiceProviderResources" class="net.shibboleth.shared.spring.factory.CombiningListFactoryBean"
- p:firstList="#{getObject('%{idp.service.sp.resources:shibboleth.ServiceProviderResources}'.trim()) ?:
- getObject('shibboleth.DefaultServiceProviderResources')}">
+ <bean id ="ExtendedApplicationResolverResources" class="net.shibboleth.shared.spring.factory.CombiningListFactoryBean"
+ p:firstList="#{getObject('%{sp.service.applications.resources:shibboleth.ApplicationResolverResources}'.trim()) ?:
+ getObject('shibboleth.DefaultApplicationResolverResources')}">
<property name="secondList">
<util:list >
- <value>classpath:/net/shibboleth/idp/plugin/sp/conf/endpoints-system.xml</value>
- <value>classpath:/net/shibboleth/idp/plugin/sp/conf/relying-party-system.xml</value>
+ <value>classpath:/net/shibboleth/sp/conf/applications-system.xml</value>
</util:list>
</property>
</bean>
diff --git a/sp-conf-impl/src/main/resources/META-INF/net/shibboleth/idp/flows/sp/ping/ping-beans.xml b/sp-conf-impl/src/main/resources/META-INF/net/shibboleth/idp/flows/sp/ping/ping-beans.xml
new file mode 100644
index 0000000..c8d5026
--- /dev/null
+++ b/sp-conf-impl/src/main/resources/META-INF/net/shibboleth/idp/flows/sp/ping/ping-beans.xml
@@ -0,0 +1,33 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<beans
+ xmlns="http://www.springframework.org/schema/beans"
+ xmlns:c="http://www.springframework.org/schema/c"
+ xmlns:context="http://www.springframework.org/schema/context"
+ xmlns:p="http://www.springframework.org/schema/p"
+ xmlns:util="http://www.springframework.org/schema/util"
+ 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.xsd
+ http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context.xsd
+ http://www.springframework.org/schema/util http://www.springframework.org/schema/util/spring-util.xsd"
+ default-init-method="initialize"
+ default-destroy-method="destroy">
+
+ <!-- Profile ID for flow. -->
+ <bean id="shibboleth.ProfileId" class="java.lang.String" c:_0="http://shibboleth.net/ns/profiles/sp/echo" />
+
+ <!-- Profile counter name. -->
+<!-- <bean id="shibboleth.metrics.ProfileCounter" class="java.lang.String" c:_0="net.shibboleth.sp.profiles.echo" />-->
+
+ <bean id="InitializeProfileRequestContext"
+ class="net.shibboleth.idp.profile.impl.InitializeProfileRequestContext" scope="prototype"
+ p:profileId-ref="shibboleth.ProfileId" />
+
+ <!-- Work beans. -->
+
+ <bean id="DoPing" class="net.shibboleth.sp.profile.impl.DoPing" scope="prototype"
+ p:httpServletResponseSupplier-ref="shibboleth.HttpServletResponseSupplier" />
+
+ <bean id="RecordResponseComplete" class="net.shibboleth.idp.profile.impl.RecordResponseComplete" scope="prototype" />
+
+
+</beans>
diff --git a/sp-conf-impl/src/main/resources/META-INF/net/shibboleth/idp/flows/sp/ping/ping-flow.xml b/sp-conf-impl/src/main/resources/META-INF/net/shibboleth/idp/flows/sp/ping/ping-flow.xml
new file mode 100644
index 0000000..3950542
--- /dev/null
+++ b/sp-conf-impl/src/main/resources/META-INF/net/shibboleth/idp/flows/sp/ping/ping-flow.xml
@@ -0,0 +1,30 @@
+<flow xmlns="http://www.springframework.org/schema/webflow"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://www.springframework.org/schema/webflow http://www.springframework.org/schema/webflow/spring-webflow.xsd">
+
+ <!-- Start action. -->
+
+ <action-state id="InitializeProfileRequestContext">
+ <evaluate expression="InitializeProfileRequestContext" />
+ <evaluate expression="'proceed'" />
+
+ <transition on="proceed" to="DoProfileWork" />
+ </action-state>
+
+ <!-- Resume actual flow processing. -->
+
+ <action-state id="DoProfileWork">
+ <evaluate expression="DoPing" />
+ <evaluate expression="RecordResponseComplete" />
+ <evaluate expression="'proceed'" />
+
+ <transition on="proceed" to="end" />
+ </action-state>
+
+ <!-- Terminus -->
+
+ <end-state id="end" />
+
+ <bean-import resource="ping-beans.xml" />
+
+</flow>
diff --git a/sp-conf-impl/src/main/resources/META-INF/services/net.shibboleth.idp.module.IdPModule b/sp-conf-impl/src/main/resources/META-INF/services/net.shibboleth.idp.module.IdPModule
index f443c18..8cdabed 100644
--- a/sp-conf-impl/src/main/resources/META-INF/services/net.shibboleth.idp.module.IdPModule
+++ b/sp-conf-impl/src/main/resources/META-INF/services/net.shibboleth.idp.module.IdPModule
@@ -1 +1 @@
-net.shibboleth.idp.plugin.sp.ServerModule
+net.shibboleth.sp.conf.ServerModule
diff --git a/sp-conf-impl/src/main/resources/META-INF/services/net.shibboleth.idp.plugin.IdPPlugin b/sp-conf-impl/src/main/resources/META-INF/services/net.shibboleth.idp.plugin.IdPPlugin
index f42e206..5c8aab1 100644
--- a/sp-conf-impl/src/main/resources/META-INF/services/net.shibboleth.idp.plugin.IdPPlugin
+++ b/sp-conf-impl/src/main/resources/META-INF/services/net.shibboleth.idp.plugin.IdPPlugin
@@ -1 +1 @@
-net.shibboleth.idp.plugin.sp.ServerPlugin
+net.shibboleth.sp.conf.ServerPlugin
diff --git a/sp-conf-impl/src/main/resources/net/shibboleth/idp/plugin/sp/module.properties b/sp-conf-impl/src/main/resources/net/shibboleth/idp/plugin/sp/module.properties
deleted file mode 100644
index d0b5001..0000000
--- a/sp-conf-impl/src/main/resources/net/shibboleth/idp/plugin/sp/module.properties
+++ /dev/null
@@ -1,20 +0,0 @@
-# Properties defining this module.
-
-# Class to Module ID mappings
-net.shibboleth.idp.plugin.sp.ServerModule = idp.sp.Server
-
-# Module Owner
-idp.sp.Server.plugin = net.shibboleth.idp.plugin.sp.server
-
-idp.sp.Server.name = SP Server Hub
-idp.sp.Server.desc = Shared hub for SP agent processing.
-idp.sp.Server.url = /SP
-
-idp.sp.Server.1.src = /net/shibboleth/idp/plugin/sp/module/conf/applications.xml
-idp.sp.Server.1.dest = conf/sp/applicatons.xml
-
-idp.sp.Server.2.src = /net/shibboleth/idp/plugin/sp/module/conf/credentials.xml
-idp.sp.Server.2.dest = conf/sp/credentials.xml
-
-idp.sp.Server.3.src = /net/shibboleth/idp/plugin/sp/module/conf/sp.properties
-idp.sp.Server.3.dest = conf/sp/sp.properties
diff --git a/sp-conf-impl/src/main/resources/net/shibboleth/idp/plugin/sp/conf/endpoints-system.xml b/sp-conf-impl/src/main/resources/net/shibboleth/sp/conf/applications-system.xml
similarity index 95%
rename from sp-conf-impl/src/main/resources/net/shibboleth/idp/plugin/sp/conf/endpoints-system.xml
rename to sp-conf-impl/src/main/resources/net/shibboleth/sp/conf/applications-system.xml
index 93c74ee..cb9dcc7 100644
--- a/sp-conf-impl/src/main/resources/net/shibboleth/idp/plugin/sp/conf/endpoints-system.xml
+++ b/sp-conf-impl/src/main/resources/net/shibboleth/sp/conf/applications-system.xml
@@ -33,6 +33,9 @@
<bean class="net.shibboleth.sp.remoting.endpoint.impl.XMLParser"
p:parserPool-ref="shibboleth.DefaultParserPool" />
+<!-- <bean class="net.shibboleth.sp.remoting.endpoint.impl.WebFlow"-->
+<!-- p:flowExecutor-ref="flowExecutor" />-->
+
<bean id="shibboleth.Application" class="net.shibboleth.sp.impl.BasicApplication" abstract="true"
p:endpointManager-ref="shibboleth.ApplicationEndpointManager"
p:metadataResolver-ref="shibboleth.MetadataResolverService"
diff --git a/sp-conf-impl/src/main/resources/net/shibboleth/sp/conf/module.properties b/sp-conf-impl/src/main/resources/net/shibboleth/sp/conf/module.properties
new file mode 100644
index 0000000..6c9940e
--- /dev/null
+++ b/sp-conf-impl/src/main/resources/net/shibboleth/sp/conf/module.properties
@@ -0,0 +1,20 @@
+# Properties defining this module.
+
+# Class to Module ID mappings
+net.shibboleth.sp.conf.ServerModule = sp.Core
+
+# Module Owner
+sp.Core.plugin = net.shibboleth.plugin.shibd
+
+sp.Core.name = SP Server Hub
+sp.Core.desc = Shared hub for SP agent processing.
+sp.Core.url = /SP
+
+sp.Core.1.src = /net/shibboleth/sp/module/conf/applications.xml
+sp.Core.1.dest = conf/sp/applicatons.xml
+
+sp.Core.2.src = /net/shibboleth/sp/module/conf/credentials.xml
+sp.Core.2.dest = conf/sp/credentials.xml
+
+sp.Core.3.src = /net/shibboleth/sp/module/conf/sp.properties
+sp.Core.3.dest = conf/sp/sp.properties
diff --git a/sp-conf-impl/src/main/resources/net/shibboleth/idp/plugin/sp/plugin.properties b/sp-conf-impl/src/main/resources/net/shibboleth/sp/conf/plugin.properties
similarity index 75%
rename from sp-conf-impl/src/main/resources/net/shibboleth/idp/plugin/sp/plugin.properties
rename to sp-conf-impl/src/main/resources/net/shibboleth/sp/conf/plugin.properties
index 38d35d6..22923d9 100644
--- a/sp-conf-impl/src/main/resources/net/shibboleth/idp/plugin/sp/plugin.properties
+++ b/sp-conf-impl/src/main/resources/net/shibboleth/sp/conf/plugin.properties
@@ -1,6 +1,7 @@
# Properties defining this plugin
-plugin.id = net.shibboleth.idp.plugin.sp.server
+plugin.id = net.shibboleth.plugin.shibd
+
# Only used when package manifest is not available
plugin.version = 1.0.0
diff --git a/sp-conf-impl/src/main/resources/net/shibboleth/idp/plugin/sp/conf/relying-party-system.xml b/sp-conf-impl/src/main/resources/net/shibboleth/sp/conf/relying-party-system.xml
similarity index 100%
rename from sp-conf-impl/src/main/resources/net/shibboleth/idp/plugin/sp/conf/relying-party-system.xml
rename to sp-conf-impl/src/main/resources/net/shibboleth/sp/conf/relying-party-system.xml
diff --git a/sp-conf-impl/src/main/resources/net/shibboleth/idp/plugin/sp/module/conf/applications.xml b/sp-conf-impl/src/main/resources/net/shibboleth/sp/module/conf/applications.xml
similarity index 100%
rename from sp-conf-impl/src/main/resources/net/shibboleth/idp/plugin/sp/module/conf/applications.xml
rename to sp-conf-impl/src/main/resources/net/shibboleth/sp/module/conf/applications.xml
diff --git a/sp-conf-impl/src/main/resources/net/shibboleth/idp/plugin/sp/module/conf/credentials.xml b/sp-conf-impl/src/main/resources/net/shibboleth/sp/module/conf/credentials.xml
similarity index 100%
rename from sp-conf-impl/src/main/resources/net/shibboleth/idp/plugin/sp/module/conf/credentials.xml
rename to sp-conf-impl/src/main/resources/net/shibboleth/sp/module/conf/credentials.xml
diff --git a/sp-conf-impl/src/main/resources/net/shibboleth/idp/plugin/sp/module/conf/sp.properties b/sp-conf-impl/src/main/resources/net/shibboleth/sp/module/conf/sp.properties
similarity index 100%
rename from sp-conf-impl/src/main/resources/net/shibboleth/idp/plugin/sp/module/conf/sp.properties
rename to sp-conf-impl/src/main/resources/net/shibboleth/sp/module/conf/sp.properties
diff --git a/sp-conf-impl/src/test/resources/net/shibboleth/sp/remoting/impl/ping.msg b/sp-conf-impl/src/test/resources/net/shibboleth/sp/remoting/impl/ping.msg
new file mode 100644
index 0000000..a8f3dc4
--- /dev/null
+++ b/sp-conf-impl/src/test/resources/net/shibboleth/sp/remoting/impl/ping.msg
@@ -0,0 +1,3 @@
+net.shibboleth.sp.WebFlow 4 1
+flow_id 1 sp/ping
+
diff --git a/sp-conf-impl/src/test/resources/net/shibboleth/sp/remoting/impl/test.error.msg b/sp-conf-impl/src/test/resources/net/shibboleth/sp/remoting/impl/test.error.msg
index 836766c..5092f2d 100644
--- a/sp-conf-impl/src/test/resources/net/shibboleth/sp/remoting/impl/test.error.msg
+++ b/sp-conf-impl/src/test/resources/net/shibboleth/sp/remoting/impl/test.error.msg
@@ -1,2 +1,2 @@
foobar 42 abc123
-
+
diff --git a/sp-dist/pom.xml b/sp-dist/pom.xml
index 7bbe154..65e08b6 100644
--- a/sp-dist/pom.xml
+++ b/sp-dist/pom.xml
@@ -6,11 +6,11 @@
<parent>
<groupId>net.shibboleth.sp</groupId>
- <artifactId>sp-server-parent</artifactId>
+ <artifactId>sp-parent</artifactId>
<version>0.0.1-SNAPSHOT</version>
</parent>
- <name>Shibboleth IdP :: Plugins :: SP Server Distribution</name>
+ <name>Shibboleth SP :: SP Server Plugin Distribution</name>
<description>SP Server plugin packaging.</description>
<artifactId>sp-dist</artifactId>
<packaging>pom</packaging>
diff --git a/sp-saml-api/.checkstyle b/sp-saml-api/.checkstyle
index ef6cff6..1feabed 100644
--- a/sp-saml-api/.checkstyle
+++ b/sp-saml-api/.checkstyle
@@ -1,7 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<fileset-config file-format-version="1.2.0" simple-config="true" sync-formatter="false">
- <local-check-config name="Shibboleth Checkstyle" location="/java-sp-server/resources/checkstyle/checkstyle.xml" type="project" description="">
+ <local-check-config name="Shibboleth Checkstyle" location="/java-plugin-shibd/resources/checkstyle/checkstyle.xml" type="project" description="">
<additional-data name="protect-config-file" value="false"/>
</local-check-config>
<fileset name="all" enabled="true" check-config-name="Shibboleth Checkstyle" local="true">
diff --git a/sp-saml-api/pom.xml b/sp-saml-api/pom.xml
index ba37ade..d19df34 100644
--- a/sp-saml-api/pom.xml
+++ b/sp-saml-api/pom.xml
@@ -5,7 +5,7 @@
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>net.shibboleth.sp</groupId>
- <artifactId>sp-server-parent</artifactId>
+ <artifactId>sp-parent</artifactId>
<version>0.0.1-SNAPSHOT</version>
</parent>
diff --git a/sp-saml-impl/.checkstyle b/sp-saml-impl/.checkstyle
index 5bae456..1feabed 100644
--- a/sp-saml-impl/.checkstyle
+++ b/sp-saml-impl/.checkstyle
@@ -1,7 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<fileset-config file-format-version="1.2.0" simple-config="true" sync-formatter="false">
- <local-check-config name="Shibboleth Checkstyle" location="/java-sp-server/resources/checkstyle.xml" type="project" description="">
+ <local-check-config name="Shibboleth Checkstyle" location="/java-plugin-shibd/resources/checkstyle/checkstyle.xml" type="project" description="">
<additional-data name="protect-config-file" value="false"/>
</local-check-config>
<fileset name="all" enabled="true" check-config-name="Shibboleth Checkstyle" local="true">
diff --git a/sp-saml-impl/pom.xml b/sp-saml-impl/pom.xml
index 57978d9..9a3a5a4 100644
--- a/sp-saml-impl/pom.xml
+++ b/sp-saml-impl/pom.xml
@@ -5,7 +5,7 @@
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>net.shibboleth.sp</groupId>
- <artifactId>sp-server-parent</artifactId>
+ <artifactId>sp-parent</artifactId>
<version>0.0.1-SNAPSHOT</version>
</parent>
diff --git a/sp-server-api/.checkstyle b/sp-server-api/.checkstyle
index ef6cff6..1feabed 100644
--- a/sp-server-api/.checkstyle
+++ b/sp-server-api/.checkstyle
@@ -1,7 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<fileset-config file-format-version="1.2.0" simple-config="true" sync-formatter="false">
- <local-check-config name="Shibboleth Checkstyle" location="/java-sp-server/resources/checkstyle/checkstyle.xml" type="project" description="">
+ <local-check-config name="Shibboleth Checkstyle" location="/java-plugin-shibd/resources/checkstyle/checkstyle.xml" type="project" description="">
<additional-data name="protect-config-file" value="false"/>
</local-check-config>
<fileset name="all" enabled="true" check-config-name="Shibboleth Checkstyle" local="true">
diff --git a/sp-server-api/pom.xml b/sp-server-api/pom.xml
index 4031fb0..bdcf4ff 100644
--- a/sp-server-api/pom.xml
+++ b/sp-server-api/pom.xml
@@ -5,7 +5,7 @@
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>net.shibboleth.sp</groupId>
- <artifactId>sp-server-parent</artifactId>
+ <artifactId>sp-parent</artifactId>
<version>0.0.1-SNAPSHOT</version>
</parent>
diff --git a/sp-server-api/src/main/java/net/shibboleth/sp/Agent.java b/sp-server-api/src/main/java/net/shibboleth/sp/Agent.java
new file mode 100644
index 0000000..d900459
--- /dev/null
+++ b/sp-server-api/src/main/java/net/shibboleth/sp/Agent.java
@@ -0,0 +1,53 @@
+/*
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * https://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+
+package net.shibboleth.sp;
+
+import java.util.Collection;
+
+import javax.annotation.Nonnull;
+import javax.annotation.Nullable;
+import javax.annotation.concurrent.ThreadSafe;
+
+import net.shibboleth.shared.annotation.constraint.NotEmpty;
+import net.shibboleth.shared.component.IdentifiedComponent;
+
+/**
+ * Represents a deployment of an SP "agent", the stub that operates in a web server or application
+ * and leverages the shibd plugin to secure access to resources.
+ *
+ * <p>Agents primarily house the security mechanisms used to protect access to shibd and act as
+ * containers for one or more {@link Application} definitions.</p>
+ */
+ at ThreadSafe
+public interface Agent extends IdentifiedComponent {
+
+ /**
+ * Get the {@link Application} instances associated with this agent.
+ *
+ * @param id application id
+ *
+ * @return the corresponding application or null
+ */
+ @Nullable Application getApplication(@Nonnull @NotEmpty final String id);
+
+ /**
+ * Get all {@link Application} instances associated with this agent.
+ *
+ * @return collection of applications
+ */
+ @Nonnull Collection<Application> getApplications();
+
+}
\ No newline at end of file
diff --git a/sp-server-api/src/main/java/net/shibboleth/sp/AgentCriterion.java b/sp-server-api/src/main/java/net/shibboleth/sp/AgentCriterion.java
new file mode 100644
index 0000000..554fec8
--- /dev/null
+++ b/sp-server-api/src/main/java/net/shibboleth/sp/AgentCriterion.java
@@ -0,0 +1,50 @@
+/*
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package net.shibboleth.sp;
+
+import javax.annotation.Nonnull;
+
+import net.shibboleth.shared.annotation.constraint.NotEmpty;
+import net.shibboleth.shared.logic.Constraint;
+import net.shibboleth.shared.primitive.StringSupport;
+import net.shibboleth.shared.resolver.Criterion;
+
+/**
+ * Resolver {@link Criterion} identifying an agent.
+ */
+public class AgentCriterion implements Criterion {
+
+ /** Application ID. */
+ @Nonnull @NotEmpty final String agentId;
+
+ /**
+ * Constructor.
+ *
+ * @param id application ID
+ */
+ public AgentCriterion(@Nonnull @NotEmpty final String id) {
+ agentId = Constraint.isNotNull(StringSupport.trimOrNull(id), "Agent ID cannot be null or empty");
+ }
+
+ /**
+ * Get the application ID specified.
+ *
+ * @return application ID
+ */
+ @Nonnull @NotEmpty public String getId() {
+ return agentId;
+ }
+
+}
\ No newline at end of file
diff --git a/sp-server-api/src/main/java/net/shibboleth/sp/Application.java b/sp-server-api/src/main/java/net/shibboleth/sp/Application.java
index ca6c072..86e43cb 100644
--- a/sp-server-api/src/main/java/net/shibboleth/sp/Application.java
+++ b/sp-server-api/src/main/java/net/shibboleth/sp/Application.java
@@ -18,47 +18,29 @@ package net.shibboleth.sp;
import javax.annotation.Nonnull;
import javax.annotation.concurrent.ThreadSafe;
-import org.opensaml.profile.context.ProfileRequestContext;
+import org.opensaml.profile.criterion.ProfileRequestContextCriterion;
import org.opensaml.saml.metadata.resolver.MetadataResolver;
import net.shibboleth.idp.attribute.filter.AttributeFilter;
import net.shibboleth.idp.attribute.resolver.AttributeResolver;
import net.shibboleth.idp.attribute.transcoding.AttributeTranscoderRegistry;
-import net.shibboleth.profile.relyingparty.RelyingPartyConfiguration;
-import net.shibboleth.shared.annotation.constraint.NotEmpty;
-import net.shibboleth.shared.component.IdentifiedComponent;
+import net.shibboleth.profile.relyingparty.RelyingPartyConfigurationResolver;
import net.shibboleth.shared.service.ServiceException;
import net.shibboleth.shared.service.ServiceableComponent;
-import net.shibboleth.sp.remoting.Endpoint;
/**
* A collection of resources protected by the SP and treated as a unit for the purposes of
* the configuration.
*
- * <p>Most protocol-specific settings and services are associated with an instance of this
- * interface either through instantiation or method inputs.</p>
+ * <p>Most settings and services are associated with an instance of this interface either through
+ * instantiation or method inputs. Components and services that are not "SP-aware" are instead injected
+ * into and made accessible from this interface.</p>
*
- * <p>Applications are an endpoint for messages from agents and are expected to handle a
- * large range of messages by dispatching them internally to other components.</p>
- *
- * <p>Components and services that are not "SP-aware" are instead injected into
- * and made accessible from this interface.</p>
+ * <p>As a resolver, this interface MUST implement support for {@link ProfileRequestContextCriterion}.
+ * It MAY support other types.</p>
*/
@ThreadSafe
-public interface Application extends IdentifiedComponent, Endpoint {
-
- /** Name of common member to signal receiving component. */
- @Nonnull @NotEmpty static String COMPONENT = "this";
-
- /**
- * Get the {@link RelyingPartyConfiguration} applicable to the request.
- *
- * @param profileRequestContext current profile request context
- *
- * @return the applicable configuration
- */
- @Nonnull RelyingPartyConfiguration getRelyingPartyConfiguration(
- @Nonnull final ProfileRequestContext profileRequestContext);
+public interface Application extends RelyingPartyConfigurationResolver {
/**
* Get {@link MetadataResolver} for this {@link Application}.
diff --git a/sp-server-api/src/main/java/net/shibboleth/sp/ApplicationCriterion.java b/sp-server-api/src/main/java/net/shibboleth/sp/ApplicationCriterion.java
new file mode 100644
index 0000000..f9fda54
--- /dev/null
+++ b/sp-server-api/src/main/java/net/shibboleth/sp/ApplicationCriterion.java
@@ -0,0 +1,50 @@
+/*
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package net.shibboleth.sp;
+
+import javax.annotation.Nonnull;
+
+import net.shibboleth.shared.annotation.constraint.NotEmpty;
+import net.shibboleth.shared.logic.Constraint;
+import net.shibboleth.shared.primitive.StringSupport;
+import net.shibboleth.shared.resolver.Criterion;
+
+/**
+ * Resolver {@link Criterion} identifying an application.
+ */
+public class ApplicationCriterion implements Criterion {
+
+ /** Application ID. */
+ @Nonnull @NotEmpty final String applicationId;
+
+ /**
+ * Constructor.
+ *
+ * @param id application ID
+ */
+ public ApplicationCriterion(@Nonnull @NotEmpty final String id) {
+ applicationId = Constraint.isNotNull(StringSupport.trimOrNull(id), "Application ID cannot be null or empty");
+ }
+
+ /**
+ * Get the application ID specified.
+ *
+ * @return application ID
+ */
+ @Nonnull @NotEmpty public String getId() {
+ return applicationId;
+ }
+
+}
\ No newline at end of file
diff --git a/sp-conf-impl/src/main/java/net/shibboleth/idp/plugin/sp/package-info.java b/sp-server-api/src/main/java/net/shibboleth/sp/ApplicationResolver.java
similarity index 54%
rename from sp-conf-impl/src/main/java/net/shibboleth/idp/plugin/sp/package-info.java
rename to sp-server-api/src/main/java/net/shibboleth/sp/ApplicationResolver.java
index 5119786..17e8c0a 100644
--- a/sp-conf-impl/src/main/java/net/shibboleth/idp/plugin/sp/package-info.java
+++ b/sp-server-api/src/main/java/net/shibboleth/sp/ApplicationResolver.java
@@ -12,7 +12,18 @@
* limitations under the License.
*/
+package net.shibboleth.sp;
+
+import net.shibboleth.shared.resolver.CriteriaSet;
+import net.shibboleth.shared.resolver.Resolver;
+
/**
- * Module/plugin implementations for SP.
+ * Interface to a resolution service that identifies the target {@link Application}
+ * for a request based on extensible criteria.
+ *
+ * <p>The {@link AgentCriterion} {@link ApplicationCriterion} criterion types MUST be supported; other
+ * types are optional.</p>
*/
-package net.shibboleth.idp.plugin.sp;
\ No newline at end of file
+public interface ApplicationResolver extends Resolver<Application,CriteriaSet> {
+
+}
\ No newline at end of file
diff --git a/sp-server-api/src/main/java/net/shibboleth/sp/remoting/AbstractEndpoint.java b/sp-server-api/src/main/java/net/shibboleth/sp/remoting/AbstractEndpoint.java
deleted file mode 100644
index 6e87582..0000000
--- a/sp-server-api/src/main/java/net/shibboleth/sp/remoting/AbstractEndpoint.java
+++ /dev/null
@@ -1,54 +0,0 @@
-/*
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * https://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-
-package net.shibboleth.sp.remoting;
-
-import javax.annotation.Nonnull;
-
-import net.shibboleth.shared.component.AbstractIdentifiableInitializableComponent;
-import net.shibboleth.shared.logic.Constraint;
-import net.shibboleth.sp.ddf.DDF;
-
-/**
- * Simple {@link Endpoint} implementation.
- */
-public abstract class AbstractEndpoint extends AbstractIdentifiableInitializableComponent implements Endpoint {
-
- /** {@inheritDoc} */
- @Nonnull public DDF receive(@Nonnull final DDF input) throws RemoteProcessingException {
- checkComponentActive();
- Constraint.isTrue(getAddress().equals(input.name()), "Address was invalid");
-
- return doReceive(input);
- }
-
- /**
- * Subclasses should override this method.
- *
- * <p>Implementations of this method should catch any checked exceptions and wrap them
- * in the {@link RemoteProcessingException} type.</p>
- *
- * <p>Unchecked exceptions MAY be surfaced safely and will be caught by the standard error
- * handling, so they should be processed internally if that is not the desired behavior.</p>
- *
- * @param input input message
- *
- * @return output message
- *
- * @throws RemoteProcessingException if an exception occurs
- */
- @Nonnull abstract public DDF doReceive(@Nonnull final DDF input) throws RemoteProcessingException;
-
-}
\ No newline at end of file
diff --git a/sp-server-api/src/main/java/net/shibboleth/sp/remoting/ApplicationEndpoint.java b/sp-server-api/src/main/java/net/shibboleth/sp/remoting/ApplicationEndpoint.java
deleted file mode 100644
index fe141ed..0000000
--- a/sp-server-api/src/main/java/net/shibboleth/sp/remoting/ApplicationEndpoint.java
+++ /dev/null
@@ -1,60 +0,0 @@
-/*
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * https://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-
-package net.shibboleth.sp.remoting;
-
-import javax.annotation.Nonnull;
-
-import net.shibboleth.shared.annotation.constraint.NotEmpty;
-import net.shibboleth.sp.Application;
-import net.shibboleth.sp.ddf.DDF;
-
-/**
- * Objects implement this interface to receive messages from SP agents scoped by specific
- * {@link Application} instances.
- */
-public interface ApplicationEndpoint {
-
- /**
- * Gets the messaging address of this component to allow it to receive messages intended for it
- * to process.
- *
- * <p>Addresses must be unique but also "knowable" from the configuration so that SP agents understand
- * how to issue requests to the service.</p>
- *
- * @return a unique address to allow messages to be routed to this component
- */
- @Nonnull @NotEmpty String getAddress();
-
- /**
- * Receive a message to process and return the result.
- *
- * <p>Implementations of this method should catch any checked exceptions and wrap them
- * in the {@link RemoteProcessingException} type.</p>
- *
- * <p>Unchecked exceptions MAY be surfaced safely and will be caught by the standard error
- * handling, so they should be processed internally if that is not the desired behavior.</p>
- *
- * @param application the {@link Application} instance processing the request
- * @param input input message
- *
- * @return output message
- *
- * @throws RemoteProcessingException if an exception occurs
- */
- @Nonnull DDF receive(@Nonnull final Application application, @Nonnull final DDF input)
- throws RemoteProcessingException;
-
-}
\ No newline at end of file
diff --git a/sp-server-api/src/main/java/net/shibboleth/sp/remoting/ApplicationEndpointManager.java b/sp-server-api/src/main/java/net/shibboleth/sp/remoting/ApplicationEndpointManager.java
deleted file mode 100644
index 0de53a3..0000000
--- a/sp-server-api/src/main/java/net/shibboleth/sp/remoting/ApplicationEndpointManager.java
+++ /dev/null
@@ -1,44 +0,0 @@
-/*
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * https://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package net.shibboleth.sp.remoting;
-
-import javax.annotation.Nonnull;
-import javax.annotation.Nullable;
-import javax.annotation.concurrent.ThreadSafe;
-
-import net.shibboleth.shared.annotation.constraint.NotEmpty;
-import net.shibboleth.shared.component.DestructableComponent;
-import net.shibboleth.shared.component.IdentifiedComponent;
-import net.shibboleth.shared.component.InitializableComponent;
-import net.shibboleth.shared.component.UnmodifiableComponent;
-
-
-/**
- * Handles message dispatch to {@link ApplicationEndpoint} objects that implement
- * application-specific business logic.
- */
- at ThreadSafe
-public interface ApplicationEndpointManager extends InitializableComponent, DestructableComponent, IdentifiedComponent,
- UnmodifiableComponent {
-
- /**
- * Gets the {@link ApplicationEndpoint} registered for a particular address.
- *
- * @param address the message address
- *
- * @return the registered {@link ApplicationEndpoint} or null
- */
- @Nullable ApplicationEndpoint getApplicationEndpoint(@Nonnull @NotEmpty final String address);
-}
\ No newline at end of file
diff --git a/sp-server-api/src/main/java/net/shibboleth/sp/remoting/Endpoint.java b/sp-server-api/src/main/java/net/shibboleth/sp/remoting/Endpoint.java
deleted file mode 100644
index 02ef52e..0000000
--- a/sp-server-api/src/main/java/net/shibboleth/sp/remoting/Endpoint.java
+++ /dev/null
@@ -1,57 +0,0 @@
-/*
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * https://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-
-package net.shibboleth.sp.remoting;
-
-import javax.annotation.Nonnull;
-
-import net.shibboleth.shared.annotation.constraint.NotEmpty;
-import net.shibboleth.sp.ddf.DDF;
-
-/**
- * Objects implement this interface to receive messages from SP agents and to support
- * registration and deregistration with the integration service.
- */
-public interface Endpoint {
-
- /**
- * Gets the messaging address of this component to allow it to receive messages intended for it
- * to process.
- *
- * <p>Addresses must be unique but also "knowable" from the configuration so that SP agents understand
- * how to issue requests to the service.</p>
- *
- * @return a unique address to allow messages to be routed to this component
- */
- @Nonnull @NotEmpty String getAddress();
-
- /**
- * Receive a message to process and return the result.
- *
- * <p>Implementations of this method should catch any checked exceptions and wrap them
- * in the {@link RemoteProcessingException} type.</p>
- *
- * <p>Unchecked exceptions MAY be surfaced safely and will be caught by the standard error
- * handling, so they should be processed internally if that is not the desired behavior.</p>
- *
- * @param input input message
- *
- * @return output message
- *
- * @throws RemoteProcessingException if an exception occurs
- */
- @Nonnull DDF receive(@Nonnull final DDF input) throws RemoteProcessingException;
-
-}
\ No newline at end of file
diff --git a/sp-server-api/src/main/java/net/shibboleth/sp/remoting/EndpointManager.java b/sp-server-api/src/main/java/net/shibboleth/sp/remoting/EndpointManager.java
deleted file mode 100644
index f3e88bd..0000000
--- a/sp-server-api/src/main/java/net/shibboleth/sp/remoting/EndpointManager.java
+++ /dev/null
@@ -1,48 +0,0 @@
-/*
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * https://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package net.shibboleth.sp.remoting;
-
-import javax.annotation.Nonnull;
-import javax.annotation.Nullable;
-import javax.annotation.concurrent.ThreadSafe;
-
-import net.shibboleth.shared.annotation.constraint.NotEmpty;
-import net.shibboleth.shared.component.DestructableComponent;
-import net.shibboleth.shared.component.IdentifiedComponent;
-import net.shibboleth.shared.component.InitializableComponent;
-import net.shibboleth.shared.component.UnmodifiableComponent;
-
-
-/**
- * Handles message dispatch to {@link Endpoint} objects that implement actual business logic.
- *
- * <p>There may be a way to utilize Spring Integration message routing for this, but I was
- * unable to see an obvious way to use the simple TCP gateway design to dispatch to
- * channels dynamically.</p>
- */
- at ThreadSafe
-public interface EndpointManager extends InitializableComponent, DestructableComponent, IdentifiedComponent,
- UnmodifiableComponent {
-
- /**
- * Gets the {@link Endpoint} registered for a particular address.
- *
- * @param address the message address
- *
- * @return the registered {@link Endpoint} or null
- */
- @Nullable Endpoint getEndpoint(@Nonnull @NotEmpty final String address);
-
-}
\ No newline at end of file
diff --git a/sp-server-api/src/main/java/net/shibboleth/sp/remoting/RemoteProcessingException.java b/sp-server-api/src/main/java/net/shibboleth/sp/remoting/RemoteProcessingException.java
deleted file mode 100644
index 42e8237..0000000
--- a/sp-server-api/src/main/java/net/shibboleth/sp/remoting/RemoteProcessingException.java
+++ /dev/null
@@ -1,63 +0,0 @@
-/*
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * https://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-
-package net.shibboleth.sp.remoting;
-
-import javax.annotation.Nullable;
-
-/**
- * Signals an exception occurring during message processing and (usually)
- * wraps the underlying cause.
- */
-public class RemoteProcessingException extends Exception {
-
- /** Serialization UUID. */
- private static final long serialVersionUID = 5978264649497263919L;
-
- /** Constructor. */
- public RemoteProcessingException() {
-
- }
-
- /**
- * Constructor.
- *
- * @param message exception message
- */
- public RemoteProcessingException(@Nullable final String message) {
- super(message);
- }
-
- /**
- * Constructor.
- *
- * @param wrappedException exception to be wrapped by this one
- */
- public RemoteProcessingException(@Nullable final Exception wrappedException) {
- super(wrappedException);
- }
-
- /**
- * Constructor.
- *
- * @param message exception message
- * @param wrappedException exception to be wrapped by this one
- */
- public RemoteProcessingException(@Nullable final String message,
- @Nullable final Exception wrappedException) {
- super(message, wrappedException);
- }
-
-}
\ No newline at end of file
diff --git a/sp-server-api/src/main/java/net/shibboleth/sp/remoting/package-info.java b/sp-server-api/src/main/java/net/shibboleth/sp/remoting/package-info.java
deleted file mode 100644
index 507570a..0000000
--- a/sp-server-api/src/main/java/net/shibboleth/sp/remoting/package-info.java
+++ /dev/null
@@ -1,19 +0,0 @@
-/*
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * https://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-/**
- * Remoting APIs for objects implementing aspects of the SP service.
- */
-
-package net.shibboleth.sp.remoting;
\ No newline at end of file
diff --git a/sp-server-impl/.checkstyle b/sp-server-impl/.checkstyle
index ef6cff6..1feabed 100644
--- a/sp-server-impl/.checkstyle
+++ b/sp-server-impl/.checkstyle
@@ -1,7 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<fileset-config file-format-version="1.2.0" simple-config="true" sync-formatter="false">
- <local-check-config name="Shibboleth Checkstyle" location="/java-sp-server/resources/checkstyle/checkstyle.xml" type="project" description="">
+ <local-check-config name="Shibboleth Checkstyle" location="/java-plugin-shibd/resources/checkstyle/checkstyle.xml" type="project" description="">
<additional-data name="protect-config-file" value="false"/>
</local-check-config>
<fileset name="all" enabled="true" check-config-name="Shibboleth Checkstyle" local="true">
diff --git a/sp-server-impl/pom.xml b/sp-server-impl/pom.xml
index b537277..39257db 100644
--- a/sp-server-impl/pom.xml
+++ b/sp-server-impl/pom.xml
@@ -5,7 +5,7 @@
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>net.shibboleth.sp</groupId>
- <artifactId>sp-server-parent</artifactId>
+ <artifactId>sp-parent</artifactId>
<version>0.0.1-SNAPSHOT</version>
</parent>
@@ -29,16 +29,23 @@
</dependency>
<dependency>
- <groupId>org.springframework.integration</groupId>
- <artifactId>spring-integration-ip</artifactId>
+ <groupId>${idp.groupId}</groupId>
+ <artifactId>idp-profile-api</artifactId>
+ <version>${idp.version}</version>
+ <scope>compile</scope>
</dependency>
-
+
<!-- Provided dependencies -->
<dependency>
<groupId>${shib-profile.groupId}</groupId>
<artifactId>shib-profile-api</artifactId>
<scope>provided</scope>
</dependency>
+ <dependency>
+ <groupId>${shib-profile.groupId}</groupId>
+ <artifactId>shib-profile-impl</artifactId>
+ <scope>provided</scope>
+ </dependency>
<dependency>
<groupId>${shib-attribute.groupId}</groupId>
<artifactId>shib-attribute-resolver-api</artifactId>
diff --git a/sp-server-impl/src/main/java/net/shibboleth/sp/impl/BasicAgent.java b/sp-server-impl/src/main/java/net/shibboleth/sp/impl/BasicAgent.java
new file mode 100644
index 0000000..b0e49a5
--- /dev/null
+++ b/sp-server-impl/src/main/java/net/shibboleth/sp/impl/BasicAgent.java
@@ -0,0 +1,98 @@
+/*
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * https://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+
+package net.shibboleth.sp.impl;
+
+import java.util.Collection;
+import java.util.Map;
+import java.util.Objects;
+import java.util.Set;
+import java.util.stream.Collectors;
+
+import javax.annotation.Nonnull;
+import javax.annotation.Nullable;
+
+import com.google.common.base.Functions;
+import com.google.common.base.MoreObjects;
+
+import net.shibboleth.profile.relyingparty.impl.DefaultRelyingPartyConfigurationResolver;
+import net.shibboleth.shared.collection.CollectionSupport;
+import net.shibboleth.sp.Agent;
+import net.shibboleth.sp.Application;
+
+/**
+ * Basic implementation of an {@link Agent}.
+ */
+public class BasicAgent extends DefaultRelyingPartyConfigurationResolver implements Agent {
+
+ @Nonnull private Map<String,Application> applicationMap;
+
+ /** Constructor. */
+ public BasicAgent() {
+ applicationMap = CollectionSupport.emptyMap();
+ }
+
+ /**
+ * Sets the {@link Application} instances associated with this agent.
+ *
+ * @param applications applications associated with this agent
+ */
+ public void setApplications(@Nullable final Set<Application> applications) {
+ checkSetterPreconditions();
+
+ if (applications != null) {
+ applicationMap = applications.stream().collect(
+ CollectionSupport.nonnullCollector(
+ Collectors.toUnmodifiableMap(Application::getId, Functions.identity()))).get();
+ } else {
+ applicationMap = CollectionSupport.emptyMap();
+ }
+ }
+
+ /** {@inheritDoc} */
+ @Nullable public Application getApplication(@Nonnull String id) {
+ checkComponentActive();
+
+ return null;
+ }
+
+ /** {@inheritDoc} */
+ @SuppressWarnings("null")
+ @Nonnull public Collection<Application> getApplications() {
+ checkComponentActive();
+
+ return applicationMap.values();
+ }
+
+ /** {@inheritDoc} */
+ @Override
+ public int hashCode() {
+ return getId().hashCode();
+ }
+
+ /** {@inheritDoc} */
+ @Override
+ public boolean equals(final Object obj) {
+ return obj instanceof Agent agent && Objects.equals(getId(), agent.getId());
+ }
+
+ /** {@inheritDoc} */
+ @Override
+ public String toString() {
+ return MoreObjects.toStringHelper(this)
+ .add("id", getId()).toString();
+ }
+
+}
\ No newline at end of file
diff --git a/sp-server-impl/src/main/java/net/shibboleth/sp/impl/BasicApplication.java b/sp-server-impl/src/main/java/net/shibboleth/sp/impl/BasicApplication.java
index 29364df..8e8b76d 100644
--- a/sp-server-impl/src/main/java/net/shibboleth/sp/impl/BasicApplication.java
+++ b/sp-server-impl/src/main/java/net/shibboleth/sp/impl/BasicApplication.java
@@ -15,51 +15,31 @@
package net.shibboleth.sp.impl;
-import java.util.Collection;
-import java.util.List;
+import java.util.Objects;
import javax.annotation.Nonnull;
-import javax.annotation.Nullable;
-import org.opensaml.profile.context.ProfileRequestContext;
import org.opensaml.saml.metadata.resolver.MetadataResolver;
-import org.slf4j.Logger;
+
+import com.google.common.base.MoreObjects;
import net.shibboleth.idp.attribute.filter.AttributeFilter;
import net.shibboleth.idp.attribute.resolver.AttributeResolver;
import net.shibboleth.idp.attribute.transcoding.AttributeTranscoderRegistry;
-import net.shibboleth.profile.relyingparty.BasicRelyingPartyConfiguration;
-import net.shibboleth.profile.relyingparty.RelyingPartyConfiguration;
+import net.shibboleth.profile.relyingparty.impl.DefaultRelyingPartyConfigurationResolver;
import net.shibboleth.shared.annotation.constraint.NonnullAfterInit;
-import net.shibboleth.shared.annotation.constraint.NotEmpty;
-import net.shibboleth.shared.collection.CollectionSupport;
import net.shibboleth.shared.component.ComponentInitializationException;
import net.shibboleth.shared.logic.Constraint;
-import net.shibboleth.shared.primitive.LoggerFactory;
import net.shibboleth.shared.service.ReloadableService;
import net.shibboleth.shared.service.ServiceException;
import net.shibboleth.shared.service.ServiceableComponent;
import net.shibboleth.sp.Application;
-import net.shibboleth.sp.remoting.ApplicationEndpoint;
-import net.shibboleth.sp.remoting.ApplicationEndpointManager;
-import net.shibboleth.sp.remoting.Endpoint;
-import net.shibboleth.sp.remoting.RemoteProcessingException;
-import net.shibboleth.sp.ddf.DDF;
/**
* Basic implementation of an {@link Application}.
*/
-public class BasicApplication extends BasicRelyingPartyConfiguration implements Application, Endpoint {
-
- /** Class logger. */
- @Nonnull private final Logger log = LoggerFactory.getLogger(BasicApplication.class);
+public class BasicApplication extends DefaultRelyingPartyConfigurationResolver implements Application {
- /** Installed relying party configuration "overrides". */
- @Nonnull private Collection<RelyingPartyConfiguration> relyingPartyConfigurations;
-
- /** Component endpoints. */
- @NonnullAfterInit private ApplicationEndpointManager endpointManager;
-
/** Metadata source. */
@NonnullAfterInit private ReloadableService<MetadataResolver> metadataResolver;
@@ -71,61 +51,20 @@ public class BasicApplication extends BasicRelyingPartyConfiguration implements
/** Attribute filter. */
@NonnullAfterInit private ReloadableService<AttributeFilter> attributeFilter;
-
- /** Constructor. */
- public BasicApplication() {
- relyingPartyConfigurations = CollectionSupport.emptyList();
- }
-
- /**
- * Sets the {@link ApplicationEndpointManager} to use.
- *
- * @param manager application endpoint manager
- */
- public void setEndpointManager(@Nonnull final ApplicationEndpointManager manager) {
- checkSetterPreconditions();
- endpointManager = Constraint.isNotNull(manager, "ApplicationEndpointManager cannot be null");
- }
-
/** {@inheritDoc} */
@Override
protected void doInitialize() throws ComponentInitializationException {
super.doInitialize();
- if (endpointManager == null) {
- throw new ComponentInitializationException("ApplicationEndpointManager cannot be null");
- }
- }
-
- /** {@inheritDoc} */
- @Nonnull @NotEmpty public String getAddress() {
- return getId();
- }
-
- /** {@inheritDoc} */
- @Nonnull public RelyingPartyConfiguration getRelyingPartyConfiguration(
- @Nonnull ProfileRequestContext profileRequestContext) {
-
- for (final RelyingPartyConfiguration rpc : relyingPartyConfigurations) {
- if (rpc.test(profileRequestContext)) {
- return rpc;
- }
- }
-
- return this;
- }
-
- /**
- * Sets the {@link RelyingPartyConfiguration}s to include.
- *
- * @param configs relying party configuration overrides
- */
- public void setRelyingPartyConfigurations(@Nullable final List<RelyingPartyConfiguration> configs) {
- if (configs != null) {
- relyingPartyConfigurations = CollectionSupport.copyToList(configs);
- } else {
- relyingPartyConfigurations = CollectionSupport.emptyList();
+ if (metadataResolver == null) {
+ throw new ComponentInitializationException("MetadataResolver cannot be null");
+ } else if (transcodingRegistry == null) {
+ throw new ComponentInitializationException("AttributeTranscoderRegistry cannot be null");
+ } else if (attributeResolver == null) {
+ throw new ComponentInitializationException("AttributeResolver cannot be null");
+ } else if (attributeFilter == null) {
+ throw new ComponentInitializationException("AttributeFilter cannot be null");
}
}
@@ -195,24 +134,22 @@ public class BasicApplication extends BasicRelyingPartyConfiguration implements
}
/** {@inheritDoc} */
- @Nonnull public DDF receive(@Nonnull final DDF input) throws RemoteProcessingException {
- checkComponentActive();
- Constraint.isTrue(getAddress().equals(input.name()), "Address was invalid");
-
- final String component = input.getmember(COMPONENT).string();
- if (component == null || component.isEmpty()) {
- log.warn("{}: Received message without component address", getId());
- throw new RemoteProcessingException("No component identified in message");
- }
-
- final ApplicationEndpoint endpoint = endpointManager.getApplicationEndpoint(component);
-
- if (endpoint == null) {
- log.warn("{}: No registered component {}", getId(), component);
- throw new RemoteProcessingException("No registered component " + component);
- }
-
- return endpoint.receive(this, input);
+ @Override
+ public int hashCode() {
+ return getId().hashCode();
+ }
+
+ /** {@inheritDoc} */
+ @Override
+ public boolean equals(final Object obj) {
+ return obj instanceof Application app && Objects.equals(getId(), app.getId());
}
+ /** {@inheritDoc} */
+ @Override
+ public String toString() {
+ return MoreObjects.toStringHelper(this)
+ .add("id", getId()).toString();
+ }
+
}
\ No newline at end of file
diff --git a/sp-server-impl/src/main/java/net/shibboleth/sp/impl/DefaultApplicationResolver.java b/sp-server-impl/src/main/java/net/shibboleth/sp/impl/DefaultApplicationResolver.java
new file mode 100644
index 0000000..2210d10
--- /dev/null
+++ b/sp-server-impl/src/main/java/net/shibboleth/sp/impl/DefaultApplicationResolver.java
@@ -0,0 +1,104 @@
+/*
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package net.shibboleth.sp.impl;
+
+import java.util.Collection;
+import java.util.Map;
+import java.util.function.Function;
+import java.util.stream.Collectors;
+
+import javax.annotation.Nonnull;
+import javax.annotation.Nullable;
+
+import org.springframework.beans.factory.annotation.Autowired;
+
+import net.shibboleth.shared.annotation.constraint.NonnullAfterInit;
+import net.shibboleth.shared.collection.CollectionSupport;
+import net.shibboleth.shared.component.ComponentInitializationException;
+import net.shibboleth.shared.component.InitializableComponent;
+import net.shibboleth.shared.resolver.CriteriaSet;
+import net.shibboleth.shared.resolver.ResolverException;
+import net.shibboleth.shared.spring.config.IdentifiedComponentManager;
+import net.shibboleth.sp.Agent;
+import net.shibboleth.sp.AgentCriterion;
+import net.shibboleth.sp.Application;
+import net.shibboleth.sp.ApplicationCriterion;
+import net.shibboleth.sp.ApplicationResolver;
+
+/**
+ * Default implementation of {@link ApplicationResolver}.
+ */
+public class DefaultApplicationResolver extends IdentifiedComponentManager<Agent> implements ApplicationResolver, InitializableComponent {
+
+ /** Tracks init state. */
+ private boolean initialized;
+
+ /** Agent set. */
+ @NonnullAfterInit private Map<String,Agent> agentMap;
+
+ /**
+ * Constructor.
+ *
+ * @param agents agents to autowire into resolver
+ */
+ @Autowired
+ public DefaultApplicationResolver(@Nullable final Collection<Agent> agents) {
+ super(agents);
+ }
+
+ /** {@inheritDoc} */
+ public void initialize() throws ComponentInitializationException {
+
+ if (!initialized) {
+ initialized = true;
+
+ agentMap = getComponents().stream().collect(
+ CollectionSupport.nonnullCollector(
+ Collectors.toUnmodifiableMap(Agent::getId, Function.identity()))).get();
+ }
+ }
+
+ /** {@inheritDoc} */
+ public boolean isInitialized() {
+ return initialized;
+ }
+
+ /** {@inheritDoc} */
+ @Nullable public Application resolveSingle(@Nullable final CriteriaSet criteria) throws ResolverException {
+
+ if (criteria != null) {
+ final AgentCriterion c_agent = criteria.get(AgentCriterion.class);
+ if (c_agent != null) {
+ final Agent agent = agentMap.get(c_agent.getId());
+ if (agent != null) {
+ final ApplicationCriterion c_app = criteria.get(ApplicationCriterion.class);
+ if (c_app != null) {
+ return agent.getApplication(c_app.getId());
+ }
+ }
+ }
+ }
+
+ return null;
+ }
+
+ /** {@inheritDoc} */
+ @Nonnull public Iterable<Application> resolve(@Nullable final CriteriaSet criteria) throws ResolverException {
+
+ final Application app = resolveSingle(criteria);
+ return app != null ? CollectionSupport.singletonList(app) : CollectionSupport.emptyList();
+ }
+
+}
\ No newline at end of file
diff --git a/sp-server-impl/src/main/java/net/shibboleth/sp/impl/package-info.java b/sp-server-impl/src/main/java/net/shibboleth/sp/impl/package-info.java
index 6377c18..16f793d 100644
--- a/sp-server-impl/src/main/java/net/shibboleth/sp/impl/package-info.java
+++ b/sp-server-impl/src/main/java/net/shibboleth/sp/impl/package-info.java
@@ -16,4 +16,7 @@
* General implementation classes.
*/
-package net.shibboleth.sp.impl;
\ No newline at end of file
+ at NonnullElements
+package net.shibboleth.sp.impl;
+
+import net.shibboleth.shared.annotation.constraint.NonnullElements;
diff --git a/sp-server-impl/src/main/java/net/shibboleth/sp/spring/impl/DDFToByteArrayConverter.java b/sp-server-impl/src/main/java/net/shibboleth/sp/profile/impl/DoPing.java
similarity index 52%
rename from sp-server-impl/src/main/java/net/shibboleth/sp/spring/impl/DDFToByteArrayConverter.java
rename to sp-server-impl/src/main/java/net/shibboleth/sp/profile/impl/DoPing.java
index 92cc4c7..f29fa01 100644
--- a/sp-server-impl/src/main/java/net/shibboleth/sp/spring/impl/DDFToByteArrayConverter.java
+++ b/sp-server-impl/src/main/java/net/shibboleth/sp/profile/impl/DoPing.java
@@ -12,31 +12,33 @@
* limitations under the License.
*/
-package net.shibboleth.sp.spring.impl;
+package net.shibboleth.sp.profile.impl;
-import java.io.ByteArrayOutputStream;
import java.io.IOException;
+import java.time.Instant;
import javax.annotation.Nonnull;
-import javax.annotation.Nullable;
-import org.springframework.core.convert.converter.Converter;
+import org.opensaml.profile.action.EventIds;
+import org.opensaml.profile.context.ProfileRequestContext;
-import net.shibboleth.sp.ddf.DDF;
+import net.shibboleth.idp.profile.AbstractProfileAction;
+import net.shibboleth.idp.profile.ActionSupport;
/**
- * Spring converter from {@link DDF} to byte array.
+ * Simple action for testing.
*/
-public class DDFToByteArrayConverter implements Converter<DDF, byte[]> {
+public class DoPing extends AbstractProfileAction {
/** {@inheritDoc} */
- @Nullable public byte[] convert(@Nonnull final DDF source) {
- try (final ByteArrayOutputStream baos = new ByteArrayOutputStream()) {
- source.serialize(baos);
- return baos.toByteArray();
+ @Override
+ protected void doExecute(@Nonnull ProfileRequestContext profileRequestContext) {
+
+ try {
+ ensureHttpServletResponse().getWriter().println(Instant.now().getEpochSecond());
} catch (final IOException e) {
- return null;
+ ActionSupport.buildEvent(profileRequestContext, EventIds.IO_ERROR);
}
}
-
+
}
\ No newline at end of file
diff --git a/sp-server-impl/src/main/java/net/shibboleth/sp/remoting/endpoint/impl/Echo.java b/sp-server-impl/src/main/java/net/shibboleth/sp/remoting/endpoint/impl/Echo.java
deleted file mode 100644
index 306951d..0000000
--- a/sp-server-impl/src/main/java/net/shibboleth/sp/remoting/endpoint/impl/Echo.java
+++ /dev/null
@@ -1,47 +0,0 @@
-/*
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * https://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-
-package net.shibboleth.sp.remoting.endpoint.impl;
-
-import net.shibboleth.sp.remoting.RemoteProcessingException;
-
-import javax.annotation.Nonnull;
-
-import net.shibboleth.shared.annotation.constraint.NotEmpty;
-import net.shibboleth.sp.remoting.AbstractEndpoint;
-import net.shibboleth.sp.ddf.DDF;
-
-/**
- * Echo service endpoint.
- *
- * <p>This bean just echoes the input as the output for validation/testing.</p>
- */
-public class Echo extends AbstractEndpoint {
-
- /** Address. */
- @Nonnull @NotEmpty public static final String ADDRESS = "net.shibboleth.sp.Echo";
-
- /** {@inheritDoc} */
- @Nonnull @NotEmpty public String getAddress() {
- return ADDRESS;
- }
-
- /** {@inheritDoc} */
- @Override
- @Nonnull public DDF doReceive(@Nonnull final DDF input) throws RemoteProcessingException {
- return input;
- }
-
-}
\ No newline at end of file
diff --git a/sp-server-impl/src/main/java/net/shibboleth/sp/remoting/endpoint/impl/Ping.java b/sp-server-impl/src/main/java/net/shibboleth/sp/remoting/endpoint/impl/Ping.java
deleted file mode 100644
index efc3ed9..0000000
--- a/sp-server-impl/src/main/java/net/shibboleth/sp/remoting/endpoint/impl/Ping.java
+++ /dev/null
@@ -1,47 +0,0 @@
-/*
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * https://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-
-package net.shibboleth.sp.remoting.endpoint.impl;
-
-import net.shibboleth.sp.remoting.RemoteProcessingException;
-
-import javax.annotation.Nonnull;
-
-import net.shibboleth.shared.annotation.constraint.NotEmpty;
-import net.shibboleth.sp.remoting.AbstractEndpoint;
-import net.shibboleth.sp.ddf.DDF;
-
-/**
- * Ping service endpoint.
- *
- * <p>This bean just returns the server time.</p>
- */
-public class Ping extends AbstractEndpoint {
-
- /** Address. */
- @Nonnull @NotEmpty public static final String ADDRESS = "net.shibboleth.sp.Ping";
-
- /** {@inheritDoc} */
- @Nonnull @NotEmpty public String getAddress() {
- return ADDRESS;
- }
-
- /** {@inheritDoc} */
- @Override
- @Nonnull public DDF doReceive(@Nonnull final DDF input) throws RemoteProcessingException {
- return new DDF("pong").longinteger(System.currentTimeMillis() / 1000);
- }
-
-}
\ No newline at end of file
diff --git a/sp-server-impl/src/main/java/net/shibboleth/sp/remoting/endpoint/impl/XMLParser.java b/sp-server-impl/src/main/java/net/shibboleth/sp/remoting/endpoint/impl/XMLParser.java
deleted file mode 100644
index 90798f3..0000000
--- a/sp-server-impl/src/main/java/net/shibboleth/sp/remoting/endpoint/impl/XMLParser.java
+++ /dev/null
@@ -1,105 +0,0 @@
-/*
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * https://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-
-package net.shibboleth.sp.remoting.endpoint.impl;
-
-import net.shibboleth.sp.remoting.RemoteProcessingException;
-
-import java.io.ByteArrayInputStream;
-import java.io.IOException;
-import java.io.InputStream;
-
-import javax.annotation.Nonnull;
-
-import org.slf4j.Logger;
-
-import org.w3c.dom.Document;
-
-import net.shibboleth.shared.annotation.constraint.NonnullAfterInit;
-import net.shibboleth.shared.annotation.constraint.NotEmpty;
-import net.shibboleth.shared.component.ComponentInitializationException;
-import net.shibboleth.shared.logic.Constraint;
-import net.shibboleth.shared.primitive.LoggerFactory;
-import net.shibboleth.shared.xml.ParserPool;
-import net.shibboleth.shared.xml.XMLParserException;
-import net.shibboleth.sp.remoting.AbstractEndpoint;
-import net.shibboleth.sp.ddf.DDF;
-import net.shibboleth.sp.ddf.DDFSupport;
-
-/**
- * Parses XML into a DDF for agent consumption.
- *
- * <p>The input must be an "unsafe" string.</p>
- *
- * <p>This converter is NOT namespace aware.</p>
- */
-public class XMLParser extends AbstractEndpoint {
-
- /** Address. */
- @Nonnull @NotEmpty public static final String ADDRESS = "net.shibboleth.sp.XMLParser";
-
- /** Class logger. */
- @Nonnull private final Logger log = LoggerFactory.getLogger(XMLParser.class);
-
- /** Parser pool. */
- @NonnullAfterInit private ParserPool parserPool;
-
- /** {@inheritDoc} */
- @Nonnull @NotEmpty public String getAddress() {
- return ADDRESS;
- }
-
- /**
- * Set the {@link ParserPool} instance to use.
- *
- * @param parser parser pool
- */
- public void setParserPool(@Nonnull final ParserPool parser) {
- checkSetterPreconditions();
-
- parserPool = Constraint.isNotNull(parser, "ParserPool cannot be null");
- }
-
- /** {@inheritDoc} */
- @Override
- protected void doInitialize() throws ComponentInitializationException {
- super.doInitialize();
-
- if (parserPool == null) {
- throw new ComponentInitializationException("ParserPool cannot be null");
- }
- }
-
- /** {@inheritDoc} */
- @Override
- @Nonnull public DDF doReceive(@Nonnull final DDF input) throws RemoteProcessingException {
- checkComponentActive();
-
- if (!input.isunsafestring()) {
- throw new IllegalArgumentException("Input was not an unsafe string");
- }
-
- try (final InputStream data = new ByteArrayInputStream(input.unsafe_string())) {
- final Document doc = parserPool.parse(data);
- final DDF output = new DDF("xml").structure();
- output.add(DDFSupport.fromElement(doc.getDocumentElement()));
- return output;
- } catch (final IOException | XMLParserException e) {
- log.warn("Unable to parse supplied XML", e);
- throw new RemoteProcessingException(e);
- }
- }
-
-}
\ No newline at end of file
diff --git a/sp-server-impl/src/main/java/net/shibboleth/sp/remoting/endpoint/impl/package-info.java b/sp-server-impl/src/main/java/net/shibboleth/sp/remoting/endpoint/impl/package-info.java
deleted file mode 100644
index 47e5676..0000000
--- a/sp-server-impl/src/main/java/net/shibboleth/sp/remoting/endpoint/impl/package-info.java
+++ /dev/null
@@ -1,19 +0,0 @@
-/*
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * https://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-/**
- * {@link net.shibboleth.sp.remoting.Endpoint} implementations.
- */
-
-package net.shibboleth.sp.remoting.endpoint.impl;
\ No newline at end of file
diff --git a/sp-server-impl/src/main/java/net/shibboleth/sp/remoting/impl/BasicApplicationEndpointManager.java b/sp-server-impl/src/main/java/net/shibboleth/sp/remoting/impl/BasicApplicationEndpointManager.java
deleted file mode 100644
index 1485dce..0000000
--- a/sp-server-impl/src/main/java/net/shibboleth/sp/remoting/impl/BasicApplicationEndpointManager.java
+++ /dev/null
@@ -1,72 +0,0 @@
-/*
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * https://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package net.shibboleth.sp.remoting.impl;
-
-import java.util.Collection;
-import java.util.Map;
-import java.util.stream.Collectors;
-
-import javax.annotation.Nonnull;
-import javax.annotation.Nullable;
-
-import org.slf4j.Logger;
-
-import org.springframework.beans.factory.annotation.Autowired;
-
-import net.shibboleth.shared.annotation.constraint.NonnullElements;
-import net.shibboleth.shared.annotation.constraint.NotEmpty;
-import net.shibboleth.shared.collection.CollectionSupport;
-import net.shibboleth.shared.component.AbstractIdentifiableInitializableComponent;
-import net.shibboleth.shared.primitive.LoggerFactory;
-import net.shibboleth.sp.remoting.ApplicationEndpoint;
-import net.shibboleth.sp.remoting.ApplicationEndpointManager;
-
-/**
- * Simple implementation of {@link ApplicationEndpointManager} that relies on an in-memory map
- * of auto-wired components.
- */
-public class BasicApplicationEndpointManager extends AbstractIdentifiableInitializableComponent
- implements ApplicationEndpointManager {
-
- /** Class logger. */
- @Nonnull private final Logger log = LoggerFactory.getLogger(BasicApplicationEndpointManager.class);
-
- /** Map of auto-wired message sinks. */
- @Nonnull @NonnullElements Map<String,ApplicationEndpoint> addressMap;
-
- /**
- * Constructor.
- *
- * @param remotedObjects auto-wired endpoints
- */
- @Autowired
- public BasicApplicationEndpointManager(@Nullable @NonnullElements Collection<ApplicationEndpoint> remotedObjects) {
- if (remotedObjects != null) {
- addressMap = remotedObjects.stream()
- .collect(CollectionSupport.nonnullCollector(
- Collectors.toMap(ApplicationEndpoint::getAddress, r -> r))).get();
- } else {
- addressMap = CollectionSupport.emptyMap();
- }
-
- log.debug("Registered addresses: {}", addressMap.keySet());
- }
-
- /** {@inheritDoc} */
- @Nullable public ApplicationEndpoint getApplicationEndpoint(@Nonnull @NotEmpty final String address) {
- return addressMap.get(address);
- }
-
-}
\ No newline at end of file
diff --git a/sp-server-impl/src/main/java/net/shibboleth/sp/remoting/impl/BasicEndpointManager.java b/sp-server-impl/src/main/java/net/shibboleth/sp/remoting/impl/BasicEndpointManager.java
deleted file mode 100644
index ad33eb8..0000000
--- a/sp-server-impl/src/main/java/net/shibboleth/sp/remoting/impl/BasicEndpointManager.java
+++ /dev/null
@@ -1,71 +0,0 @@
-/*
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * https://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package net.shibboleth.sp.remoting.impl;
-
-import java.util.Collection;
-import java.util.Map;
-import java.util.stream.Collectors;
-
-import javax.annotation.Nonnull;
-import javax.annotation.Nullable;
-
-import org.slf4j.Logger;
-
-import org.springframework.beans.factory.annotation.Autowired;
-
-import net.shibboleth.shared.annotation.constraint.NonnullElements;
-import net.shibboleth.shared.annotation.constraint.NotEmpty;
-import net.shibboleth.shared.collection.CollectionSupport;
-import net.shibboleth.shared.component.AbstractIdentifiableInitializableComponent;
-import net.shibboleth.shared.primitive.LoggerFactory;
-import net.shibboleth.sp.remoting.Endpoint;
-import net.shibboleth.sp.remoting.EndpointManager;
-
-/**
- * Simple implementation of {@link EndpointManager} that relies on an in-memory map
- * of auto-wired components.
- */
-public class BasicEndpointManager extends AbstractIdentifiableInitializableComponent implements EndpointManager {
-
- /** Class logger. */
- @Nonnull private final Logger log = LoggerFactory.getLogger(BasicEndpointManager.class);
-
- /** Map of auto-wired message sinks. */
- @Nonnull @NonnullElements Map<String,Endpoint> addressMap;
-
- /**
- * Constructor.
- *
- * @param remotedObjects auto-wired endpoints
- */
- @Autowired
- public BasicEndpointManager(@Nullable @NonnullElements Collection<Endpoint> remotedObjects) {
- if (remotedObjects != null) {
- addressMap = remotedObjects.stream()
- .collect(CollectionSupport.nonnullCollector(
- Collectors.toMap(Endpoint::getAddress, r -> r))).get();
- } else {
- addressMap = CollectionSupport.emptyMap();
- }
-
- log.debug("Registered addresses: {}", addressMap.keySet());
- }
-
- /** {@inheritDoc} */
- @Nullable public Endpoint getEndpoint(@Nonnull @NotEmpty final String address) {
- return addressMap.get(address);
- }
-
-}
\ No newline at end of file
diff --git a/sp-server-impl/src/main/java/net/shibboleth/sp/remoting/impl/ErrorTransformer.java b/sp-server-impl/src/main/java/net/shibboleth/sp/remoting/impl/ErrorTransformer.java
deleted file mode 100644
index 7df9272..0000000
--- a/sp-server-impl/src/main/java/net/shibboleth/sp/remoting/impl/ErrorTransformer.java
+++ /dev/null
@@ -1,64 +0,0 @@
-/*
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * https://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-
-package net.shibboleth.sp.remoting.impl;
-
-import java.io.ByteArrayOutputStream;
-import java.io.IOException;
-
-import org.springframework.integration.transformer.AbstractPayloadTransformer;
-
-import net.shibboleth.sp.remoting.RemoteProcessingException;
-import net.shibboleth.sp.ddf.DDF;
-
-/**
- * Spring Integration message transformer that turns exceptions into data for the
- * integration gateway.
- */
-public class ErrorTransformer extends AbstractPayloadTransformer<Throwable,byte[]> {
-
- /** {@inheritDoc} */
- protected byte[] transformPayload(Throwable payload) {
- final DDF err = new DDF("exception").structure();
-
- Throwable cause = payload.getCause() != null ? payload.getCause() : payload;
-
- // If this is our wrapper type, just skip down a layer.
- if (cause instanceof RemoteProcessingException && cause.getCause() != null) {
- cause = cause.getCause();
- }
-
- if (cause != null) {
- err.addmember("type").string(cause.getClass().getName());
- err.addmember("message").string(cause.getMessage());
- DDF nested = err;
- while (cause.getCause() != null) {
- cause = cause.getCause();
- nested = nested.addmember("exception").structure();
- nested.addmember("type").string(cause.getClass().getName());
- nested.addmember("message").string(cause.getMessage());
- }
- }
-
- try (final ByteArrayOutputStream out = new ByteArrayOutputStream()) {
- err.serialize(out);
- return out.toByteArray();
- } catch (final IOException e) {
- // This is a pre-baked error object.
- return new String("exception 4 2\n" + "type 1 java.lang.IOException\n" + "message 1 Unable%20to%20marshall%20exception%20to%20error%20channel\n").getBytes();
- }
- }
-
-}
\ No newline at end of file
diff --git a/sp-server-impl/src/main/java/net/shibboleth/sp/remoting/impl/ReloadingEndpointManager.java b/sp-server-impl/src/main/java/net/shibboleth/sp/remoting/impl/ReloadingEndpointManager.java
deleted file mode 100644
index 5eefd68..0000000
--- a/sp-server-impl/src/main/java/net/shibboleth/sp/remoting/impl/ReloadingEndpointManager.java
+++ /dev/null
@@ -1,65 +0,0 @@
-/*
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package net.shibboleth.sp.remoting.impl;
-
-import javax.annotation.Nonnull;
-import javax.annotation.Nullable;
-
-import net.shibboleth.shared.annotation.ParameterName;
-import net.shibboleth.shared.annotation.constraint.NotEmpty;
-import net.shibboleth.shared.component.ComponentInitializationException;
-import net.shibboleth.shared.logic.Constraint;
-import net.shibboleth.shared.service.ServiceableComponent;
-import net.shibboleth.shared.spring.service.AbstractServiceableComponent;
-import net.shibboleth.sp.remoting.Endpoint;
-import net.shibboleth.sp.remoting.EndpointManager;
-
-/**
- * This class wraps an {@link EndpointManager} in a {@link ServiceableComponent}.
- */
-public class ReloadingEndpointManager extends AbstractServiceableComponent<EndpointManager>
- implements EndpointManager {
-
- /** The embedded service. */
- @Nonnull private final EndpointManager service;
-
- /**
- * Constructor.
- *
- * @param svc the embedded service
- */
- public ReloadingEndpointManager(@Nonnull @ParameterName(name="svc") final EndpointManager svc) {
- service = Constraint.isNotNull(svc, "EndpointManager cannot be null");
- }
-
- /** {@inheritDoc} */
- @Override
- protected void doInitialize() throws ComponentInitializationException {
- setId(Constraint.isNotNull(service.getId(), "Service ID cannot be null"));
- super.doInitialize();
- }
-
- /** {@inheritDoc} */
- @Nullable public Endpoint getEndpoint(@Nonnull @NotEmpty final String address) {
- return service.getEndpoint(address);
- }
-
- /** {@inheritDoc} */
- @Override
- @Nonnull public EndpointManager getComponent() {
- return this;
- }
-
-}
\ No newline at end of file
diff --git a/sp-server-impl/src/main/java/net/shibboleth/sp/remoting/impl/RequestProcessor.java b/sp-server-impl/src/main/java/net/shibboleth/sp/remoting/impl/RequestProcessor.java
deleted file mode 100644
index ebebc0d..0000000
--- a/sp-server-impl/src/main/java/net/shibboleth/sp/remoting/impl/RequestProcessor.java
+++ /dev/null
@@ -1,163 +0,0 @@
-/*
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * https://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package net.shibboleth.sp.remoting.impl;
-
-import java.net.InetAddress;
-import java.net.UnknownHostException;
-import java.util.Collection;
-
-import javax.annotation.Nonnull;
-import javax.annotation.Nullable;
-
-import org.slf4j.Logger;
-
-import org.springframework.integration.ip.IpHeaders;
-import org.springframework.messaging.Message;
-
-import net.shibboleth.sp.remoting.RemoteProcessingException;
-import net.shibboleth.shared.annotation.constraint.NonnullAfterInit;
-import net.shibboleth.shared.annotation.constraint.NonnullElements;
-import net.shibboleth.shared.collection.CollectionSupport;
-import net.shibboleth.shared.component.AbstractIdentifiableInitializableComponent;
-import net.shibboleth.shared.component.ComponentInitializationException;
-import net.shibboleth.shared.logic.Constraint;
-import net.shibboleth.shared.net.IPRange;
-import net.shibboleth.shared.primitive.LoggerFactory;
-import net.shibboleth.shared.service.ReloadableService;
-import net.shibboleth.shared.service.ServiceException;
-import net.shibboleth.shared.service.ServiceableComponent;
-import net.shibboleth.sp.remoting.Endpoint;
-import net.shibboleth.sp.remoting.EndpointManager;
-import net.shibboleth.sp.ddf.DDF;
-
-/**
- * Core request processing service called by Spring Integration to handle requests.
- *
- * <p>Any exceptions raised by the call chain will be trapped by the {@link ErrorTransformer}.</p>
- */
-public class RequestProcessor extends AbstractIdentifiableInitializableComponent {
-
- /** Class logger. */
- @Nonnull private final Logger log = LoggerFactory.getLogger(RequestProcessor.class);
-
- /** List of CIDR blocks allowed to access connections. */
- @Nonnull @NonnullElements private Collection<IPRange> allowedRanges;
-
- /** Address lookup service. */
- @NonnullAfterInit ReloadableService<EndpointManager> service;
-
- /** Constructor. */
- public RequestProcessor() {
- allowedRanges = CollectionSupport.emptyList();
- }
-
- /**
- * Sets the {@link EndpointManager} to use.
- *
- * @param svc endpoint manager wrapped in a service component
- */
- public void setEndpointManager(@Nonnull final ReloadableService<EndpointManager> svc) {
- checkSetterPreconditions();
-
- service = Constraint.isNotNull(svc, "EndpointManager service cannot be null");
- }
-
- /**
- * Sets the allowed client address ranges.
- *
- * @param ranges allowed ranges for client connection enforcement
- */
- public void setAllowedRanges(@Nullable @NonnullElements final Collection<IPRange> ranges) {
- checkSetterPreconditions();
-
- if (ranges != null) {
- allowedRanges = CollectionSupport.copyToList(ranges);
- } else {
- allowedRanges = CollectionSupport.emptyList();
- }
- }
-
- /** {@inheritDoc} */
- @Override
- protected void doInitialize() throws ComponentInitializationException {
- super.doInitialize();
-
- if (service == null) {
- throw new ComponentInitializationException("EndpointManager service cannot be null");
- } else if (allowedRanges.isEmpty()) {
- throw new ComponentInitializationException("At least one IPRange must be permitted");
- }
- }
-
- /**
- * Execute a remote request.
- *
- * @param message input message
- *
- * @return output data object
- *
- * @throws RemoteProcessingException if an error is raised by the destination of the message
- */
- @Nonnull public DDF execute(@Nonnull final Message<DDF> message) throws RemoteProcessingException {
- checkComponentActive();
-
- final Object address = message.getHeaders().get(IpHeaders.IP_ADDRESS);
- if (address instanceof String) {
- final InetAddress parsedAddress;
- try {
- parsedAddress = InetAddress.getByName((String) address);
- } catch (final UnknownHostException e) {
- log.warn("Unable to parse client address {}", address, e);
- throw new RemoteProcessingException("Unable to parse client address", e);
- }
- if (!allowedRanges.stream().anyMatch(range -> range.contains(parsedAddress))) {
- log.warn("Blocked request from unauthorized client address {}", address);
- throw new RemoteProcessingException("Blocked request from unauthorized client address");
- }
- } else {
- throw new RemoteProcessingException("Save my walrus! ip_address header was not a String?");
- }
-
- final DDF input = Constraint.isNotNull(message.getPayload(), "Input object cannot be null");
-
- log.trace("Input message: {}", input.toString());
-
- final String name = input.name();
- if (name == null) {
- log.warn("Input message lacked an address");
- throw new RemoteProcessingException("Input message lacked an address");
- }
-
- final Endpoint endpoint;
- try (final ServiceableComponent<EndpointManager> component = service.getServiceableComponent()) {
- endpoint = component.getComponent().getEndpoint(name);
- } catch (final ServiceException e) {
- throw new RemoteProcessingException("Error accessing EndpointManager component: Invalid configuration", e);
- }
-
- if (endpoint == null) {
- log.warn("No registered target for address {}", name);
- throw new RemoteProcessingException("No registered target for address " + name);
- }
-
- final DDF output = endpoint.receive(input);
- Constraint.isNotNull(output, "Output object cannot be null");
-
- log.trace("Output message: {}", output.toString());
-
- return output;
- }
-
-}
\ No newline at end of file
diff --git a/sp-server-impl/src/main/java/net/shibboleth/sp/remoting/impl/package-info.java b/sp-server-impl/src/main/java/net/shibboleth/sp/remoting/impl/package-info.java
deleted file mode 100644
index d777a7f..0000000
--- a/sp-server-impl/src/main/java/net/shibboleth/sp/remoting/impl/package-info.java
+++ /dev/null
@@ -1,19 +0,0 @@
-/*
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * https://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-/**
- * Remote messaging classes.
- */
-
-package net.shibboleth.sp.remoting.impl;
\ No newline at end of file
diff --git a/sp-server-impl/src/main/java/net/shibboleth/sp/remoting/tcp/impl/TCPConnectionInterceptorFactory.java b/sp-server-impl/src/main/java/net/shibboleth/sp/remoting/tcp/impl/TCPConnectionInterceptorFactory.java
deleted file mode 100644
index e4e25c1..0000000
--- a/sp-server-impl/src/main/java/net/shibboleth/sp/remoting/tcp/impl/TCPConnectionInterceptorFactory.java
+++ /dev/null
@@ -1,104 +0,0 @@
-/*
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * https://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-
-package net.shibboleth.sp.remoting.tcp.impl;
-
-import java.util.Collection;
-
-import javax.annotation.Nonnull;
-import javax.annotation.Nullable;
-
-import org.slf4j.Logger;
-
-import org.springframework.context.ApplicationEventPublisher;
-import org.springframework.context.ApplicationEventPublisherAware;
-import org.springframework.integration.ip.tcp.connection.TcpConnectionInterceptorFactory;
-import org.springframework.integration.ip.tcp.connection.TcpConnectionInterceptorSupport;
-import org.springframework.messaging.Message;
-import org.springframework.messaging.MessagingException;
-
-import net.shibboleth.shared.annotation.constraint.NonnullElements;
-import net.shibboleth.shared.collection.CollectionSupport;
-import net.shibboleth.shared.net.IPRange;
-import net.shibboleth.shared.primitive.LoggerFactory;
-import net.shibboleth.sp.remoting.RemoteProcessingException;
-
-/**
- * Interceptor that adds security to connections.
- */
-public class TCPConnectionInterceptorFactory implements TcpConnectionInterceptorFactory, ApplicationEventPublisherAware {
-
- /** List of CIDR blocks allowed to access connections. */
- @Nonnull @NonnullElements private Collection<IPRange> allowedRanges;
-
- /** Object passed through to interceptor. */
- @Nullable private ApplicationEventPublisher applicationEventPublisher;
-
- /**
- * Constructor.
- *
- * @param ranges allowed ranges for client connection enforcement
- */
- public TCPConnectionInterceptorFactory(@Nullable @NonnullElements final Collection<IPRange> ranges) {
- if (ranges != null) {
- allowedRanges = CollectionSupport.copyToList(ranges);
- } else {
- allowedRanges = CollectionSupport.emptyList();
- }
- }
-
- /** {@inheritDoc} */
- @Override
- public void setApplicationEventPublisher(@Nonnull ApplicationEventPublisher publisher) {
- applicationEventPublisher = publisher;
- }
-
- /** {@inheritDoc} */
- @Override
- @Nonnull public TcpConnectionInterceptorSupport getInterceptor() {
- return new TCPConnectionInterceptor(applicationEventPublisher);
- }
-
- /**
- * Actual interceptor built by the factory.
- */
- public class TCPConnectionInterceptor extends TcpConnectionInterceptorSupport {
-
- /** Class logger. */
- @Nonnull private Logger log = LoggerFactory.getLogger(TCPConnectionInterceptor.class);
-
- /**
- * Constructor.
- *
- * @param publisher event publisher
- */
- public TCPConnectionInterceptor(final ApplicationEventPublisher publisher) {
- super(publisher);
- }
-
- /** {@inheritDoc} */
- @Override
- public boolean onMessage(@Nonnull final Message<?> message) {
-
- if (allowedRanges.stream().anyMatch(range -> range.contains(getSocketInfo().getInetAddress()))) {
- return super.onMessage(message);
- }
-
- log.warn("Blocked message from client address: {}", getSocketInfo().getInetAddress().getHostAddress());
- throw new MessagingException("Access Denied", new RemoteProcessingException("Blocked message from unauthorized client address"));
- }
-
- }
-}
\ No newline at end of file
diff --git a/sp-server-impl/src/main/java/net/shibboleth/sp/remoting/tcp/impl/package-info.java b/sp-server-impl/src/main/java/net/shibboleth/sp/remoting/tcp/impl/package-info.java
deleted file mode 100644
index 4ced633..0000000
--- a/sp-server-impl/src/main/java/net/shibboleth/sp/remoting/tcp/impl/package-info.java
+++ /dev/null
@@ -1,19 +0,0 @@
-/*
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * https://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-/**
- * Classes supporting TCP as a remoting protocol.
- */
-
-package net.shibboleth.sp.remoting.tcp.impl;
\ No newline at end of file
diff --git a/sp-server-impl/src/main/java/net/shibboleth/sp/spring/impl/ByteArrayToDDFConverter.java b/sp-server-impl/src/main/java/net/shibboleth/sp/spring/impl/ByteArrayToDDFConverter.java
deleted file mode 100644
index e61c7bb..0000000
--- a/sp-server-impl/src/main/java/net/shibboleth/sp/spring/impl/ByteArrayToDDFConverter.java
+++ /dev/null
@@ -1,41 +0,0 @@
-/*
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package net.shibboleth.sp.spring.impl;
-
-import java.io.ByteArrayInputStream;
-import java.io.IOException;
-
-import javax.annotation.Nonnull;
-import javax.annotation.Nullable;
-
-import org.springframework.core.convert.converter.Converter;
-
-import net.shibboleth.sp.ddf.DDF;
-
-/**
- * Spring converter from byte array to {@link DDF} object.
- */
-public class ByteArrayToDDFConverter implements Converter<byte[], DDF> {
-
- /** {@inheritDoc} */
- @Nullable public DDF convert(@Nonnull final byte[] source) {
- try (final ByteArrayInputStream bais = new ByteArrayInputStream(source)) {
- return DDF.deserialize(bais);
- } catch (final IOException e) {
- return null;
- }
- }
-
-}
\ No newline at end of file
diff --git a/sp-server-impl/src/main/java/net/shibboleth/sp/spring/impl/package-info.java b/sp-server-impl/src/main/java/net/shibboleth/sp/spring/impl/package-info.java
deleted file mode 100644
index 83c0971..0000000
--- a/sp-server-impl/src/main/java/net/shibboleth/sp/spring/impl/package-info.java
+++ /dev/null
@@ -1,18 +0,0 @@
-/*
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * https://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-/**
- * Low-level Spring implementation classes.
- */
-package net.shibboleth.sp.spring.impl;
\ No newline at end of file
diff --git a/sp-session-api/.checkstyle b/sp-session-api/.checkstyle
index 5bae456..1feabed 100644
--- a/sp-session-api/.checkstyle
+++ b/sp-session-api/.checkstyle
@@ -1,7 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<fileset-config file-format-version="1.2.0" simple-config="true" sync-formatter="false">
- <local-check-config name="Shibboleth Checkstyle" location="/java-sp-server/resources/checkstyle.xml" type="project" description="">
+ <local-check-config name="Shibboleth Checkstyle" location="/java-plugin-shibd/resources/checkstyle/checkstyle.xml" type="project" description="">
<additional-data name="protect-config-file" value="false"/>
</local-check-config>
<fileset name="all" enabled="true" check-config-name="Shibboleth Checkstyle" local="true">
diff --git a/sp-session-api/pom.xml b/sp-session-api/pom.xml
index deca6d7..6b0ab28 100644
--- a/sp-session-api/pom.xml
+++ b/sp-session-api/pom.xml
@@ -5,7 +5,7 @@
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>net.shibboleth.sp</groupId>
- <artifactId>sp-server-parent</artifactId>
+ <artifactId>sp-parent</artifactId>
<version>0.0.1-SNAPSHOT</version>
</parent>
diff --git a/sp-server-api/.checkstyle b/sp-session-impl/.checkstyle
similarity index 84%
copy from sp-server-api/.checkstyle
copy to sp-session-impl/.checkstyle
index ef6cff6..1feabed 100644
--- a/sp-server-api/.checkstyle
+++ b/sp-session-impl/.checkstyle
@@ -1,7 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<fileset-config file-format-version="1.2.0" simple-config="true" sync-formatter="false">
- <local-check-config name="Shibboleth Checkstyle" location="/java-sp-server/resources/checkstyle/checkstyle.xml" type="project" description="">
+ <local-check-config name="Shibboleth Checkstyle" location="/java-plugin-shibd/resources/checkstyle/checkstyle.xml" type="project" description="">
<additional-data name="protect-config-file" value="false"/>
</local-check-config>
<fileset name="all" enabled="true" check-config-name="Shibboleth Checkstyle" local="true">
diff --git a/sp-session-impl/pom.xml b/sp-session-impl/pom.xml
index 29b369a..debd6a5 100644
--- a/sp-session-impl/pom.xml
+++ b/sp-session-impl/pom.xml
@@ -5,7 +5,7 @@
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>net.shibboleth.sp</groupId>
- <artifactId>sp-server-parent</artifactId>
+ <artifactId>sp-parent</artifactId>
<version>0.0.1-SNAPSHOT</version>
</parent>
diff --git a/sp-testing/.checkstyle b/sp-testing/.checkstyle
index 5bae456..1feabed 100644
--- a/sp-testing/.checkstyle
+++ b/sp-testing/.checkstyle
@@ -1,7 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<fileset-config file-format-version="1.2.0" simple-config="true" sync-formatter="false">
- <local-check-config name="Shibboleth Checkstyle" location="/java-sp-server/resources/checkstyle.xml" type="project" description="">
+ <local-check-config name="Shibboleth Checkstyle" location="/java-plugin-shibd/resources/checkstyle/checkstyle.xml" type="project" description="">
<additional-data name="protect-config-file" value="false"/>
</local-check-config>
<fileset name="all" enabled="true" check-config-name="Shibboleth Checkstyle" local="true">
diff --git a/sp-testing/pom.xml b/sp-testing/pom.xml
index 5564d97..db9971e 100644
--- a/sp-testing/pom.xml
+++ b/sp-testing/pom.xml
@@ -5,7 +5,7 @@
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>net.shibboleth.sp</groupId>
- <artifactId>sp-server-parent</artifactId>
+ <artifactId>sp-parent</artifactId>
<version>0.0.1-SNAPSHOT</version>
</parent>
--
To stop receiving notification emails like this one, please contact
the administrator of this repository.
More information about the commits
mailing list