aboutsummaryrefslogtreecommitdiff
path: root/id/server/idserverlib/src/main
diff options
context:
space:
mode:
authorGerwin Gsenger <g.gsenger@datentechnik-innovation.at>2015-01-14 10:27:47 +0100
committerThomas Lenz <tlenz@iaik.tugraz.at>2015-06-19 11:07:47 +0200
commit8ce4c2f836484676b5d5a98001613a72df15d22d (patch)
treee1eeceeedc53904d7920bd105b580e9462c9628d /id/server/idserverlib/src/main
parent7d3a585005e9907b043770891206eb591e064ebe (diff)
downloadmoa-id-spss-8ce4c2f836484676b5d5a98001613a72df15d22d.tar.gz
moa-id-spss-8ce4c2f836484676b5d5a98001613a72df15d22d.tar.bz2
moa-id-spss-8ce4c2f836484676b5d5a98001613a72df15d22d.zip
add NewAuthenticationProvider (instantiated as Spring bean, reads JSON from db), add AuthConfiguration interface for Authentication providers
Diffstat (limited to 'id/server/idserverlib/src/main')
-rw-r--r--id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/config/auth/AuthConfiguration.java85
-rw-r--r--id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/config/auth/AuthConfigurationProvider.java2
-rw-r--r--id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/config/auth/ConfigurationToJSONConverter.java23
-rw-r--r--id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/config/auth/NewAuthConfigurationProvider.java216
4 files changed, 316 insertions, 10 deletions
diff --git a/id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/config/auth/AuthConfiguration.java b/id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/config/auth/AuthConfiguration.java
new file mode 100644
index 000000000..760b2cd0a
--- /dev/null
+++ b/id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/config/auth/AuthConfiguration.java
@@ -0,0 +1,85 @@
+package at.gv.egovernment.moa.id.config.auth;
+
+import java.util.List;
+import java.util.Properties;
+
+import at.gv.egovernment.moa.id.commons.db.dao.config.PVP2;
+import at.gv.egovernment.moa.id.commons.db.dao.config.TimeOuts;
+import at.gv.egovernment.moa.id.config.ConfigurationException;
+import at.gv.egovernment.moa.id.config.ConnectionParameter;
+import at.gv.egovernment.moa.id.config.auth.data.ProtocolAllowed;
+import at.gv.egovernment.moa.id.config.stork.STORKConfig;
+
+public interface AuthConfiguration {
+
+ public Properties getGeneralPVP2ProperiesConfig();
+
+ public Properties getGeneralOAuth20ProperiesConfig();
+
+ public ProtocolAllowed getAllowedProtocols();
+
+ public PVP2 getGeneralPVP2DBConfig();
+
+ public TimeOuts getTimeOuts() throws ConfigurationException;
+
+ public String getAlternativeSourceID() throws ConfigurationException;
+
+ public List<String> getLegacyAllowedProtocols();
+
+ public OAAuthParameter getOnlineApplicationParameter(String oaURL);
+
+ public String getMoaSpAuthBlockTrustProfileID() throws ConfigurationException;
+
+ public List<String> getMoaSpAuthBlockVerifyTransformsInfoIDs() throws ConfigurationException;
+
+ public ConnectionParameter getMoaSpConnectionParameter() throws ConfigurationException;
+
+ public ConnectionParameter getForeignIDConnectionParameter() throws ConfigurationException;
+
+ public ConnectionParameter getOnlineMandatesConnectionParameter() throws ConfigurationException;
+
+ public String getMoaSpIdentityLinkTrustProfileID() throws ConfigurationException;
+
+ public List<String> getTransformsInfos() throws ConfigurationException;
+
+ public List<String> getIdentityLinkX509SubjectNames() throws ConfigurationException;
+
+ public List<String> getSLRequestTemplates() throws ConfigurationException;
+
+ public String getSLRequestTemplates(String type) throws ConfigurationException;
+
+ public List<String> getDefaultBKUURLs() throws ConfigurationException;
+
+ public String getDefaultBKUURL(String type) throws ConfigurationException;
+
+ public String getSSOTagetIdentifier() throws ConfigurationException;
+
+ public String getSSOFriendlyName();
+
+ public String getSSOSpecialText();
+
+ public String getMOASessionEncryptionKey();
+
+ public String getMOAConfigurationEncryptionKey();
+
+ public boolean isIdentityLinkResigning();
+
+ public String getIdentityLinkResigningKey();
+
+ public boolean isMonitoringActive();
+
+ public String getMonitoringTestIdentityLinkURL();
+
+ public String getMonitoringMessageSuccess();
+
+ public boolean isAdvancedLoggingActive();
+
+ public String getPublicURLPrefix();
+
+ public boolean isPVP2AssertionEncryptionActive();
+
+ public boolean isCertifiacteQCActive();
+
+ public STORKConfig getStorkConfig() throws ConfigurationException;
+
+}
diff --git a/id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/config/auth/AuthConfigurationProvider.java b/id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/config/auth/AuthConfigurationProvider.java
index 5ccaa4f35..5fc416b16 100644
--- a/id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/config/auth/AuthConfigurationProvider.java
+++ b/id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/config/auth/AuthConfigurationProvider.java
@@ -137,7 +137,7 @@ import com.fasterxml.jackson.annotation.JsonIgnore;
*
* @version $Id$
*/
-public class AuthConfigurationProvider extends ConfigurationProvider {
+public class AuthConfigurationProvider extends ConfigurationProvider implements AuthConfiguration {
// /** DEFAULT_ENCODING is "UTF-8" */
// private static final String DEFAULT_ENCODING="UTF-8";
diff --git a/id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/config/auth/ConfigurationToJSONConverter.java b/id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/config/auth/ConfigurationToJSONConverter.java
index b47ba0e27..90543e588 100644
--- a/id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/config/auth/ConfigurationToJSONConverter.java
+++ b/id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/config/auth/ConfigurationToJSONConverter.java
@@ -5,6 +5,8 @@ import java.beans.Introspector;
import java.beans.PropertyDescriptor;
import java.lang.reflect.InvocationTargetException;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.beans.factory.config.AutowireCapableBeanFactory;
import org.springframework.context.ApplicationContext;
import org.springframework.context.support.ClassPathXmlApplicationContext;
@@ -12,13 +14,15 @@ import at.gv.egovernment.moa.id.config.ConfigurationException;
import at.gv.egovernment.moa.id.config.ConfigurationProvider;
import com.datentechnik.moa.id.conf.persistence.Configuration;
-import com.datentechnik.moa.id.conf.persistence.ConfigurationImpl;
import com.fasterxml.jackson.annotation.JsonIgnore;
import com.fasterxml.jackson.annotation.JsonProperty;
public class ConfigurationToJSONConverter {
- AuthConfigurationProvider configProvider;
+ @Autowired
+ NewAuthConfigurationProvider configProvider;
+
+ @Autowired
Configuration configDataBase;
public static void main(String[] args) {
@@ -39,11 +43,11 @@ public class ConfigurationToJSONConverter {
}
public ConfigurationToJSONConverter(String pathToDBConfigPropertiesFile) throws ConfigurationException {
- configProvider = AuthConfigurationProvider.getInstance();
System.getProperties().setProperty("location", "file:" + pathToDBConfigPropertiesFile);
ApplicationContext context = new ClassPathXmlApplicationContext("configuration.beans.xml");
- configDataBase = (ConfigurationImpl) context.getBean(ConfigurationImpl.class);
+ AutowireCapableBeanFactory acbFactory = context.getAutowireCapableBeanFactory();
+ acbFactory.autowireBean(this);
}
@@ -51,9 +55,11 @@ public class ConfigurationToJSONConverter {
try {
// find all getter methods
- for (PropertyDescriptor pd : Introspector.getBeanInfo(AuthConfigurationProvider.class).getPropertyDescriptors()) {
+ for (PropertyDescriptor pd : Introspector.getBeanInfo(NewAuthConfigurationProvider.class).getPropertyDescriptors()) {
// check if correct methods, and not annotated with @JsonIgnore
- if ((pd.getReadMethod() != null) && (!"class".equals(pd.getName())) && (pd.getReadMethod().getAnnotation(JsonIgnore.class) == null)) {
+ if ((pd.getReadMethod() != null)
+ && (!"class".equals(pd.getName()))
+ && (pd.getReadMethod().getAnnotation(JsonIgnore.class) == null)) {
JsonProperty name = pd.getReadMethod().getAnnotation(JsonProperty.class);
// get result of get method
@@ -86,13 +92,12 @@ public class ConfigurationToJSONConverter {
public void readConfigFromDB() {
try {
// find all getter methods
- for (PropertyDescriptor pd : Introspector.getBeanInfo(AuthConfigurationProvider.class)
+ for (PropertyDescriptor pd : Introspector.getBeanInfo(NewAuthConfigurationProvider.class)
.getPropertyDescriptors()) {
// check if correct methods, and not annotated with @JsonIgnore
if ((pd.getReadMethod() != null)
&& (!"class".equals(pd.getName()))
&& (pd.getReadMethod().getAnnotation(JsonIgnore.class) == null)) {
-
JsonProperty name = pd.getReadMethod().getAnnotation(JsonProperty.class);
// get result of get method
if (name != null) {
@@ -106,7 +111,7 @@ public class ConfigurationToJSONConverter {
System.out.println("Problems while using reflection to get all getter methods.");
} catch (IntrospectionException e) {
System.out.println("Problems while using reflection to get all getter methods.");
+ }
}
- }
}
diff --git a/id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/config/auth/NewAuthConfigurationProvider.java b/id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/config/auth/NewAuthConfigurationProvider.java
new file mode 100644
index 000000000..4f2284d3d
--- /dev/null
+++ b/id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/config/auth/NewAuthConfigurationProvider.java
@@ -0,0 +1,216 @@
+package at.gv.egovernment.moa.id.config.auth;
+
+import java.util.List;
+import java.util.Properties;
+
+import org.springframework.beans.factory.annotation.Autowired;
+
+import at.gv.egovernment.moa.id.commons.db.dao.config.PVP2;
+import at.gv.egovernment.moa.id.commons.db.dao.config.TimeOuts;
+import at.gv.egovernment.moa.id.config.ConfigurationException;
+import at.gv.egovernment.moa.id.config.ConfigurationProvider;
+import at.gv.egovernment.moa.id.config.ConnectionParameter;
+import at.gv.egovernment.moa.id.config.auth.data.ProtocolAllowed;
+import at.gv.egovernment.moa.id.config.stork.STORKConfig;
+
+import com.datentechnik.moa.id.conf.persistence.ConfigurationImpl;
+import com.fasterxml.jackson.annotation.JsonProperty;
+
+public class NewAuthConfigurationProvider extends ConfigurationProvider implements AuthConfiguration {
+
+ @Autowired
+ private ConfigurationImpl configuration;
+
+ @JsonProperty("getGeneralPVP2ProperiesConfig")
+ public Properties getGeneralPVP2ProperiesConfig() {
+ return configuration.get("getGeneralPVP2ProperiesConfig", Properties.class);
+ }
+
+ @JsonProperty("getGeneralOAuth20ProperiesConfig")
+ public Properties getGeneralOAuth20ProperiesConfig() {
+ return configuration.get("getGeneralOAuth20ProperiesConfig", Properties.class);
+ }
+
+ @JsonProperty("getAllowedProtocols")
+ public ProtocolAllowed getAllowedProtocols() {
+ return configuration.get("getAllowedProtocols", ProtocolAllowed.class);
+ }
+
+ @JsonProperty("getGeneralPVP2DBConfig")
+ public PVP2 getGeneralPVP2DBConfig() {
+ return configuration.get("getGeneralPVP2DBConfig", PVP2.class);
+ }
+
+ @JsonProperty("getTimeOuts")
+ public TimeOuts getTimeOuts() throws ConfigurationException {
+ return configuration.get("getTimeOuts", TimeOuts.class);
+ }
+
+ @JsonProperty("getAlternativeSourceID")
+ public String getAlternativeSourceID() throws ConfigurationException {
+ return configuration.get("getAlternativeSourceID", String.class);
+ }
+
+ @JsonProperty("getLegacyAllowedProtocols")
+ public List<String> getLegacyAllowedProtocols() {
+ return configuration.getList("getLegacyAllowedProtocols", String.class);
+ }
+
+ @JsonProperty("getOnlineApplicationParameter")
+ public OAAuthParameter getOnlineApplicationParameter(String oaURL) {
+ return configuration.get("getOnlineApplicationParameter", OAAuthParameter.class);
+ }
+
+ @JsonProperty("getMoaSpAuthBlockTrustProfileID")
+ public String getMoaSpAuthBlockTrustProfileID() throws ConfigurationException {
+ return configuration.get("getMoaSpAuthBlockTrustProfileID", String.class);
+ }
+
+ @JsonProperty("getMoaSpAuthBlockVerifyTransformsInfoIDs")
+ public List<String> getMoaSpAuthBlockVerifyTransformsInfoIDs() throws ConfigurationException {
+ return configuration.getList("getMoaSpAuthBlockVerifyTransformsInfoIDs", String.class);
+ }
+
+ @JsonProperty("getMoaSpConnectionParameter")
+ public ConnectionParameter getMoaSpConnectionParameter() throws ConfigurationException {
+ return configuration.get("getMoaSpConnectionParameter", ConnectionParameter.class);
+ }
+
+ @JsonProperty("getForeignIDConnectionParameter")
+ public ConnectionParameter getForeignIDConnectionParameter() throws ConfigurationException {
+ return configuration.get("getForeignIDConnectionParameter", ConnectionParameter.class);
+ }
+
+ @JsonProperty("getOnlineMandatesConnectionParameter")
+ public ConnectionParameter getOnlineMandatesConnectionParameter() throws ConfigurationException {
+ return configuration.get("getOnlineMandatesConnectionParameter", ConnectionParameter.class);
+ }
+
+ @JsonProperty("getMoaSpIdentityLinkTrustProfileID")
+ public String getMoaSpIdentityLinkTrustProfileID() throws ConfigurationException {
+ return configuration.get("getMoaSpIdentityLinkTrustProfileID", String.class);
+ }
+
+ @JsonProperty("getTransformsInfos")
+ public List<String> getTransformsInfos() throws ConfigurationException {
+ return configuration.getList("getTransformsInfos", String.class);
+ }
+
+ @JsonProperty("getIdentityLinkX509SubjectNames")
+ public List<String> getIdentityLinkX509SubjectNames() throws ConfigurationException {
+ return configuration.getList("getIdentityLinkX509SubjectNames", String.class);
+ }
+
+ @JsonProperty("getSLRequestTemplates")
+ public List<String> getSLRequestTemplates() throws ConfigurationException {
+ return configuration.getList("getSLRequestTemplates", String.class);
+ }
+
+ @JsonProperty("getSLRequestTemplates")
+ public String getSLRequestTemplates(String type) throws ConfigurationException {
+ return configuration.get("getSLRequestTemplates", String.class);
+ }
+
+ @JsonProperty("getDefaultBKUURLs")
+ public List<String> getDefaultBKUURLs() throws ConfigurationException {
+ return configuration.getList("getDefaultBKUURLs", String.class);
+ }
+
+ @JsonProperty("getDefaultBKUURL")
+ public String getDefaultBKUURL(String type) throws ConfigurationException {
+
+ // FIXME find a solution for this getter
+ // String el = DefaultBKUURLs.get(type);
+ // if (MiscUtil.isNotEmpty(el))
+ // return el;
+ // else {
+ // Logger.warn("getSLRequestTemplates: BKU Type does not match: " +
+ // IOAAuthParameters.ONLINEBKU + " or "
+ // + IOAAuthParameters.HANDYBKU + " or " + IOAAuthParameters.LOCALBKU);
+ // return null;
+ // }
+ return null;
+ }
+
+ @JsonProperty("getSSOTagetIdentifier")
+ public String getSSOTagetIdentifier() throws ConfigurationException {
+ return configuration.get("getSSOTagetIdentifier", String.class);
+ }
+
+ @JsonProperty("getSSOFriendlyName")
+ public String getSSOFriendlyName() {
+ return configuration.get("getSSOFriendlyName", String.class);
+ }
+
+ @JsonProperty("getSSOSpecialText")
+ public String getSSOSpecialText() {
+ return configuration.get("getSSOSpecialText", String.class);
+ }
+
+ @JsonProperty("getMOASessionEncryptionKey")
+ public String getMOASessionEncryptionKey() {
+ return configuration.get("getMOASessionEncryptionKey", String.class);
+ }
+
+ @JsonProperty("getMOAConfigurationEncryptionKey")
+ public String getMOAConfigurationEncryptionKey() {
+ return configuration.get("getMOAConfigurationEncryptionKey", String.class);
+ }
+
+ @JsonProperty("isIdentityLinkResigning")
+ public boolean isIdentityLinkResigning() {
+ return configuration.get("isIdentityLinkResigning", Boolean.class);
+ }
+
+ @JsonProperty("getIdentityLinkResigningKey")
+ public String getIdentityLinkResigningKey() {
+ return configuration.get("getIdentityLinkResigningKey", String.class);
+ }
+
+ @JsonProperty("isMonitoringActive")
+ public boolean isMonitoringActive() {
+ return configuration.get("isMonitoringActive", Boolean.class);
+ }
+
+ @JsonProperty("getMonitoringTestIdentityLinkURL")
+ public String getMonitoringTestIdentityLinkURL() {
+ return configuration.get("getMonitoringTestIdentityLinkURL", String.class);
+ }
+
+ @JsonProperty("getMonitoringMessageSuccess")
+ public String getMonitoringMessageSuccess() {
+ return configuration.get("getMonitoringMessageSuccess", String.class);
+ }
+
+ @JsonProperty("isAdvancedLoggingActive")
+ public boolean isAdvancedLoggingActive() {
+ return configuration.get("isAdvancedLoggingActive", Boolean.class);
+ }
+
+ @JsonProperty("getPublicURLPrefix")
+ public String getPublicURLPrefix() {
+ return configuration.get("getPublicURLPrefix", String.class);
+ }
+
+ @JsonProperty("isPVP2AssertionEncryptionActive")
+ public boolean isPVP2AssertionEncryptionActive() {
+ return configuration.get("isPVP2AssertionEncryptionActive", Boolean.class);
+ }
+
+ @JsonProperty("isCertifiacteQCActive")
+ public boolean isCertifiacteQCActive() {
+ return configuration.get("isCertifiacteQCActive", Boolean.class);
+ }
+
+ /**
+ * Retruns the STORK Configuration
+ *
+ * @return STORK Configuration
+ * @throws ConfigurationException
+ */
+ @JsonProperty("getStorkConfig")
+ public STORKConfig getStorkConfig() throws ConfigurationException {
+ return configuration.get("getStorkConfig", STORKConfig.class);
+ }
+
+}