diff options
author | Thomas Knall <t.knall@datentechnik-innovation.com> | 2015-01-30 08:53:27 +0100 |
---|---|---|
committer | Thomas Knall <t.knall@datentechnik-innovation.com> | 2015-01-30 08:53:27 +0100 |
commit | 6371e01c520de77b0f37f59c72dbe20fce88c91a (patch) | |
tree | 911aa029ac464d21ee3d0cdb5e33c10f8eeed199 | |
parent | 88f2ac75cf316c755e35303cf2d6faa2343b9408 (diff) | |
download | moa-id-spss-6371e01c520de77b0f37f59c72dbe20fce88c91a.tar.gz moa-id-spss-6371e01c520de77b0f37f59c72dbe20fce88c91a.tar.bz2 moa-id-spss-6371e01c520de77b0f37f59c72dbe20fce88c91a.zip |
Add Spring based discovery for STORKAuthModule
- Add wildcard import to applicationContext.xml
- Add some javadoc to AuthModule interface.
- Remove STORKAuthModuleImpl from serviceloader based registration.
7 files changed, 49 insertions, 16 deletions
diff --git a/id/server/auth/src/main/webapp/WEB-INF/applicationContext.xml b/id/server/auth/src/main/webapp/WEB-INF/applicationContext.xml index 818524e49..d9e254451 100644 --- a/id/server/auth/src/main/webapp/WEB-INF/applicationContext.xml +++ b/id/server/auth/src/main/webapp/WEB-INF/applicationContext.xml @@ -27,5 +27,8 @@ <bean id="authenticationManager" class="at.gv.egovernment.moa.id.moduls.AuthenticationManager" factory-method="getInstance" />
<bean id="moduleRegistration" class="at.gv.egovernment.moa.id.moduls.moduleregistration.ModuleRegistration" factory-method="getInstance" />
+
+ <!-- import auth modules -->
+ <import resource="classpath*:**/*.authmodule.beans.xml" />
</beans>
diff --git a/id/server/auth/src/main/webapp/WEB-INF/web.xml b/id/server/auth/src/main/webapp/WEB-INF/web.xml index 10c772aca..f81e01ccd 100644 --- a/id/server/auth/src/main/webapp/WEB-INF/web.xml +++ b/id/server/auth/src/main/webapp/WEB-INF/web.xml @@ -138,8 +138,9 @@ </servlet> <servlet-mapping> <servlet-name>ProcessEngineSignal</servlet-name> + <!-- Use this url-pattern in order to signal the next (asynchronous) task. --> <url-pattern>/signalProcess</url-pattern> - <!-- legacy url patterns --> + <!-- legacy url patterns for asynchronous tasks --> <url-pattern>/GetMISSessionID</url-pattern> <url-pattern>/GetForeignID</url-pattern> <url-pattern>/VerifyAuthBlock</url-pattern> diff --git a/id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/auth/modules/internal/DefaultAuthModuleImpl.java b/id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/auth/modules/internal/DefaultAuthModuleImpl.java index 99c28fd7f..35c7e5c79 100644 --- a/id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/auth/modules/internal/DefaultAuthModuleImpl.java +++ b/id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/auth/modules/internal/DefaultAuthModuleImpl.java @@ -6,11 +6,13 @@ import at.gv.egovernment.moa.id.moduls.moduleregistration.AuthModule; import com.datentechnik.process_engine.api.ExecutionContext; +/** + * Module descriptor + */ public class DefaultAuthModuleImpl implements AuthModule { @Override public int getPriority() { - // neutral priority between Integer.MIN_VALUE and Integer.MAX_VALUE return 0; } diff --git a/id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/auth/modules/stork/STORK.authmodule.beans.xml b/id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/auth/modules/stork/STORK.authmodule.beans.xml new file mode 100644 index 000000000..2e924bdd0 --- /dev/null +++ b/id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/auth/modules/stork/STORK.authmodule.beans.xml @@ -0,0 +1,14 @@ +<?xml version="1.0" encoding="UTF-8"?>
+<beans xmlns="http://www.springframework.org/schema/beans"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xmlns:context="http://www.springframework.org/schema/context"
+ 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">
+
+ <context:annotation-config />
+
+ <bean id="storkAuthModule" class="at.gv.egovernment.moa.id.auth.modules.stork.STORKAuthModuleImpl">
+ <property name="priority" value="0" />
+ </bean>
+
+</beans>
diff --git a/id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/auth/modules/stork/STORKAuthModuleImpl.java b/id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/auth/modules/stork/STORKAuthModuleImpl.java index 140334b36..52423166a 100644 --- a/id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/auth/modules/stork/STORKAuthModuleImpl.java +++ b/id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/auth/modules/stork/STORKAuthModuleImpl.java @@ -6,12 +6,25 @@ import com.datentechnik.process_engine.api.ExecutionContext; import at.gv.egovernment.moa.id.moduls.moduleregistration.AuthModule;
+/**
+ * Module descriptor for an auth module providing stork authentication related processes.
+ * @author tknall
+ */
public class STORKAuthModuleImpl implements AuthModule {
+
+ private int priority = 0;
@Override
public int getPriority() {
- // neutral priority between Integer.MIN_VALUE and Integer.MAX_VALUE
- return 0;
+ return priority;
+ }
+
+ /**
+ * Sets the priority of this module. Default value is {@code 0}.
+ * @param priority The priority.
+ */
+ public void setPriority(int priority) {
+ this.priority = priority;
}
@Override
diff --git a/id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/moduls/moduleregistration/AuthModule.java b/id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/moduls/moduleregistration/AuthModule.java index 35273cd2b..fa0149c17 100644 --- a/id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/moduls/moduleregistration/AuthModule.java +++ b/id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/moduls/moduleregistration/AuthModule.java @@ -9,31 +9,32 @@ import com.datentechnik.process_engine.model.ProcessDefinition; public interface AuthModule { /** - * Returns the priority of the module. The priority defines the place in the - * order of modules. The module with a highest priority is asked first, if - * it has a process which can do an authentication. + * Returns the priority of the module. The priority defines the order of the respective module within the chain of + * discovered modules. Higher priorized modules are asked before lower priorized modules for a process that they can + * handle. + * <p/> + * Internal default modules are priorized neutral ({@code 0}. Use a higher priority ({@code 1...Integer.MAX_VALUE}) + * in order to have your module(s) priorized or a lower priority ({@code Integer.MIN_VALUE...-1}) in order to put + * your modules behind default modules. * * @return the priority of the module. */ int getPriority(); /** - * Checks if the module has a process, which is able to perform an authentication - * with the given {@link ExecutionContext}. + * Checks if the module has a process, which is able to perform an authentication with the given + * {@link ExecutionContext}. * * @param context * an ExecutionContext for a process. - * @return the process-ID of a process which is able to work with the given - * ExecutionContext, or {@code null}. + * @return the process-ID of a process which is able to work with the given ExecutionContext, or {@code null}. */ String selectProcess(ExecutionContext context); /** - * Returns the an Array of {@link ProcessDefinition}s of the processes - * included in this module. + * Returns the an Array of {@link ProcessDefinition}s of the processes included in this module. * - * @return an array of resource uris of the processes included in this - * module. + * @return an array of resource uris of the processes included in this module. */ String[] getProcessDefinitions(); diff --git a/id/server/idserverlib/src/main/resources/META-INF/services/at.gv.egovernment.moa.id.moduls.moduleregistration.AuthModule b/id/server/idserverlib/src/main/resources/META-INF/services/at.gv.egovernment.moa.id.moduls.moduleregistration.AuthModule index 03cb2c631..865096055 100644 --- a/id/server/idserverlib/src/main/resources/META-INF/services/at.gv.egovernment.moa.id.moduls.moduleregistration.AuthModule +++ b/id/server/idserverlib/src/main/resources/META-INF/services/at.gv.egovernment.moa.id.moduls.moduleregistration.AuthModule @@ -1,3 +1,2 @@ # The default moaid process at.gv.egovernment.moa.id.auth.modules.internal.DefaultAuthModuleImpl -at.gv.egovernment.moa.id.auth.modules.stork.STORKAuthModuleImpl |