From bd13b36516fc5a57409348fba2d266c8fa8d8f99 Mon Sep 17 00:00:00 2001 From: Thomas Lenz Date: Sun, 20 Dec 2015 22:06:37 +0100 Subject: add very simple metadata processor without signature validation --- .../engine/MOAeIDASSimpleMetadataProvider.java | 50 ++++++++++++++++++++++ .../auth/modules/eidas/utils/SAMLEngineUtils.java | 20 ++------- 2 files changed, 53 insertions(+), 17 deletions(-) create mode 100644 id/server/modules/moa-id-module-eIDAS/src/main/java/at/gv/egovernment/moa/id/auth/modules/eidas/engine/MOAeIDASSimpleMetadataProvider.java (limited to 'id/server/modules') diff --git a/id/server/modules/moa-id-module-eIDAS/src/main/java/at/gv/egovernment/moa/id/auth/modules/eidas/engine/MOAeIDASSimpleMetadataProvider.java b/id/server/modules/moa-id-module-eIDAS/src/main/java/at/gv/egovernment/moa/id/auth/modules/eidas/engine/MOAeIDASSimpleMetadataProvider.java new file mode 100644 index 000000000..2aec81db5 --- /dev/null +++ b/id/server/modules/moa-id-module-eIDAS/src/main/java/at/gv/egovernment/moa/id/auth/modules/eidas/engine/MOAeIDASSimpleMetadataProvider.java @@ -0,0 +1,50 @@ +package at.gv.egovernment.moa.id.auth.modules.eidas.engine; + +import java.security.KeyStore; + +import org.opensaml.saml2.metadata.EntityDescriptor; +import org.opensaml.saml2.metadata.IDPSSODescriptor; +import org.opensaml.saml2.metadata.SPSSODescriptor; + +import at.gv.egovernment.moa.logging.Logger; +import eu.eidas.auth.engine.EIDASSAMLEngine; +import eu.eidas.auth.engine.metadata.SimpleMetadataProcessor; +import eu.eidas.engine.exceptions.SAMLEngineException; + +public class MOAeIDASSimpleMetadataProvider extends SimpleMetadataProcessor { + + @Override + public EntityDescriptor getEntityDescriptor(String url) { + EntityDescriptor entityDescriptor=getEntityDescriptorHelper(url); + + if(Logger.isDebugEnabled()){ + Logger.debug("got entityDescriptor: " + entityDescriptor); + } + return entityDescriptor; + } + + @Override + public SPSSODescriptor getSPSSODescriptor(String url) throws SAMLEngineException { + return getFirstRoleDescriptor(getEntityDescriptor(url), SPSSODescriptor.class); + + } + + @Override + public IDPSSODescriptor getIDPSSODescriptor(String url) throws SAMLEngineException { + return getFirstRoleDescriptor(getEntityDescriptor(url), IDPSSODescriptor.class); + + } + + @Override + public void checkValidMetadataSignature(String url, EIDASSAMLEngine engine) throws SAMLEngineException { + //TODO: implement Metadata signature validation + Logger.warn("MetadataProcessor in demo SP does not actually check the signature of metadata"); + + } + @Override + public void checkValidMetadataSignature(String url, KeyStore store) throws SAMLEngineException { + //not implemented + + } + +} diff --git a/id/server/modules/moa-id-module-eIDAS/src/main/java/at/gv/egovernment/moa/id/auth/modules/eidas/utils/SAMLEngineUtils.java b/id/server/modules/moa-id-module-eIDAS/src/main/java/at/gv/egovernment/moa/id/auth/modules/eidas/utils/SAMLEngineUtils.java index 0d6a49a47..2c2435ff6 100644 --- a/id/server/modules/moa-id-module-eIDAS/src/main/java/at/gv/egovernment/moa/id/auth/modules/eidas/utils/SAMLEngineUtils.java +++ b/id/server/modules/moa-id-module-eIDAS/src/main/java/at/gv/egovernment/moa/id/auth/modules/eidas/utils/SAMLEngineUtils.java @@ -24,6 +24,7 @@ package at.gv.egovernment.moa.id.auth.modules.eidas.utils; import at.gv.egovernment.moa.id.auth.modules.eidas.Constants; import at.gv.egovernment.moa.id.auth.modules.eidas.config.MOAIDCertificateManagerConfigurationImpl; +import at.gv.egovernment.moa.id.auth.modules.eidas.engine.MOAeIDASSimpleMetadataProvider; import at.gv.egovernment.moa.id.auth.modules.eidas.exceptions.EIDASEngineException; import at.gv.egovernment.moa.logging.Logger; import eu.eidas.auth.engine.EIDASSAMLEngine; @@ -47,8 +48,8 @@ public class SAMLEngineUtils { configManager); //set Metadata managment to eIDAS SAMLengine - //TODO: implement Metadata processor - engine.setMetadataProcessor(null); + //TODO: implement final Metadata processor (this is only a first solution!!!) + engine.setMetadataProcessor(new MOAeIDASSimpleMetadataProvider()); return engine; @@ -60,19 +61,4 @@ public class SAMLEngineUtils { } - public static void main(String[] args) { - try { - EIDASSAMLEngine test = createSAMLEngine(); - - - } catch (EIDASEngineException e) { - // TODO Auto-generated catch block - e.printStackTrace(); - - } - - System.out.println("Success"); - - } - } -- cgit v1.2.3