diff options
author | Thomas Lenz <thomas.lenz@egiz.gv.at> | 2015-12-20 22:06:37 +0100 |
---|---|---|
committer | Thomas Lenz <thomas.lenz@egiz.gv.at> | 2015-12-20 22:06:37 +0100 |
commit | bd13b36516fc5a57409348fba2d266c8fa8d8f99 (patch) | |
tree | 231ebe948e4ba7609f49413e51ed43cb7be45075 /id/server | |
parent | 5df604a0ae5f1433c37759d4f7ebaa7d4f8af8d6 (diff) | |
download | moa-id-spss-bd13b36516fc5a57409348fba2d266c8fa8d8f99.tar.gz moa-id-spss-bd13b36516fc5a57409348fba2d266c8fa8d8f99.tar.bz2 moa-id-spss-bd13b36516fc5a57409348fba2d266c8fa8d8f99.zip |
add very simple metadata processor without signature validation
Diffstat (limited to 'id/server')
2 files changed, 53 insertions, 17 deletions
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"); - - } - } |