diff options
Diffstat (limited to 'id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/config/auth')
2 files changed, 106 insertions, 82 deletions
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 1804b5fd5..1a3c1b0a1 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 @@ -110,6 +110,7 @@ import at.gv.egovernment.moa.id.config.auth.data.ProtocolAllowed; import at.gv.egovernment.moa.id.config.legacy.BuildFromLegacyConfig; import at.gv.egovernment.moa.id.config.stork.STORKConfig; import at.gv.egovernment.moa.id.data.IssuerAndSerial; +import at.gv.egovernment.moa.id.protocols.pvp2x.config.MOADefaultBootstrap; import at.gv.egovernment.moa.logging.Logger; import at.gv.egovernment.moa.util.MiscUtil; @@ -211,6 +212,8 @@ public class AuthConfigurationProvider extends ConfigurationProvider { private static Date date = null; + private String publicURLPreFix = null; + /** * Return the single instance of configuration data. * @@ -365,7 +368,8 @@ public class AuthConfigurationProvider extends ConfigurationProvider { //Initialize OpenSAML for STORK Logger.info("Starting initialization of OpenSAML..."); - DefaultBootstrap.bootstrap(); + MOADefaultBootstrap.bootstrap(); + //DefaultBootstrap.bootstrap(); Logger.debug("OpenSAML successfully initialized"); @@ -485,32 +489,41 @@ public class AuthConfigurationProvider extends ConfigurationProvider { //set TrustManagerRevocationChecking setTrustManagerRevocationChecking(); - //set TimeOuts - if (auth.getGeneralConfiguration() != null) { - if (auth.getGeneralConfiguration().getTimeOuts() != null) { - - timeouts = new TimeOuts(); - if (auth.getGeneralConfiguration().getTimeOuts().getAssertion() == null) - timeouts.setAssertion(new BigInteger("120")); - else - timeouts.setAssertion(auth.getGeneralConfiguration().getTimeOuts().getAssertion()); - - if (auth.getGeneralConfiguration().getTimeOuts().getMOASessionCreated() == null) - timeouts.setMOASessionCreated(new BigInteger("2700")); - else - timeouts.setMOASessionCreated(auth.getGeneralConfiguration().getTimeOuts().getMOASessionCreated()); - - if (auth.getGeneralConfiguration().getTimeOuts().getMOASessionUpdated() == null) - timeouts.setMOASessionUpdated(new BigInteger("1200")); - else - timeouts.setMOASessionUpdated(auth.getGeneralConfiguration().getTimeOuts().getMOASessionUpdated()); - } - } - else { - Logger.warn("Error in MOA-ID Configuration. No TimeOuts defined."); - throw new ConfigurationException("config.02", null); - } + //set default timeouts + timeouts = new TimeOuts(); + timeouts.setAssertion(new BigInteger("300")); + timeouts.setMOASessionCreated(new BigInteger("2700")); + timeouts.setMOASessionUpdated(new BigInteger("1200")); + //search timeouts in config + if (auth.getGeneralConfiguration() != null) { + if (auth.getGeneralConfiguration().getTimeOuts() != null) { + if (auth.getGeneralConfiguration().getTimeOuts().getAssertion() != null) + timeouts.setAssertion(auth.getGeneralConfiguration().getTimeOuts().getAssertion()); + + if (auth.getGeneralConfiguration().getTimeOuts().getMOASessionCreated() != null) + timeouts.setMOASessionCreated(auth.getGeneralConfiguration().getTimeOuts().getMOASessionCreated()); + + if (auth.getGeneralConfiguration().getTimeOuts().getMOASessionUpdated() != null) + timeouts.setMOASessionUpdated(auth.getGeneralConfiguration().getTimeOuts().getMOASessionUpdated()); + + } else { + Logger.info("No TimeOuts defined. Use default values"); + } + } + + // sets the authentication session and authentication data time outs + AuthenticationServer.getInstance() + .setSecondsSessionTimeOutCreated(timeouts.getMOASessionCreated().longValue()); + + AuthenticationServer.getInstance() + .setSecondsSessionTimeOutUpdated(timeouts.getMOASessionUpdated().longValue()); + + AuthenticationServer.getInstance() + .setSecondsAuthDataTimeOut(timeouts.getAssertion().longValue()); + + + //set PVP2 general config Protocols protocols = auth.getProtocols(); if (protocols != null) { @@ -519,6 +532,11 @@ public class AuthConfigurationProvider extends ConfigurationProvider { if (protocols.getSAML1() != null) { allowedProtcols.setSAML1Active(protocols.getSAML1().isIsActive()); + + //load alternative sourceID + if (MiscUtil.isNotEmpty(protocols.getSAML1().getSourceID())) + alternativesourceid = protocols.getSAML1().getSourceID(); + } if (protocols.getOAuth() != null) { @@ -562,36 +580,21 @@ public class AuthConfigurationProvider extends ConfigurationProvider { } //set alternativeSourceID - if (auth.getGeneralConfiguration() != null) - alternativesourceid = auth.getGeneralConfiguration().getAlternativeSourceID(); - - // sets the authentication session and authentication data time outs - BigInteger param = auth.getGeneralConfiguration().getTimeOuts().getMOASessionCreated(); - - if (param != null) { - long sessionTimeOut = param.longValue(); - if (sessionTimeOut > 0) - AuthenticationServer.getInstance() - .setSecondsSessionTimeOutCreated(sessionTimeOut); - } - - param = auth.getGeneralConfiguration().getTimeOuts().getMOASessionUpdated(); - if (param != null) { - long sessionTimeOut = param.longValue(); - if (sessionTimeOut > 0) - AuthenticationServer.getInstance() - .setSecondsSessionTimeOutUpdated(sessionTimeOut); - } - - param = auth.getGeneralConfiguration().getTimeOuts().getAssertion(); - if (param != null) { - long authDataTimeOut = param.longValue(); - if (authDataTimeOut > 0) - AuthenticationServer.getInstance() - .setSecondsAuthDataTimeOut(authDataTimeOut); - } - - else { + if (auth.getGeneralConfiguration() != null) { + + //TODO: can be removed in a further version, because it is moved to SAML1 config + if (MiscUtil.isEmpty(alternativesourceid)) + alternativesourceid = auth.getGeneralConfiguration().getAlternativeSourceID(); + + if (MiscUtil.isNotEmpty(auth.getGeneralConfiguration().getPublicURLPreFix())) + publicURLPreFix = auth.getGeneralConfiguration().getPublicURLPreFix(); + + else { + Logger.error("No Public URL Prefix configured."); + throw new ConfigurationException("config.05", new Object[]{"Public URL Prefix"}); + } + + } else { Logger.warn("Error in MOA-ID Configuration. No GeneralConfig defined."); throw new ConfigurationException("config.02", null); } @@ -744,7 +747,7 @@ public class AuthConfigurationProvider extends ConfigurationProvider { } public ProtocolAllowed getAllowedProtocols() { - return this.allowedProtcols; + return allowedProtcols; } public PVP2 getGeneralPVP2DBConfig() { @@ -895,27 +898,27 @@ public class AuthConfigurationProvider extends ConfigurationProvider { } } - public boolean isSSOBusinessService() throws ConfigurationException { - - if (ssoconfig != null && ssoconfig.getIdentificationNumber() != null) - return true; - else - return false; - } +// public boolean isSSOBusinessService() throws ConfigurationException { +// +// if (ssoconfig != null && ssoconfig.getIdentificationNumber() != null) +// return true; +// else +// return false; +// } - public IdentificationNumber getSSOBusinessService() throws ConfigurationException { + public String getSSOTagetIdentifier() throws ConfigurationException { if (ssoconfig != null) - return ssoconfig.getIdentificationNumber(); + return ssoconfig.getTarget(); else return null; } - public String getSSOTarget() throws ConfigurationException { - if (ssoconfig!= null) - return ssoconfig.getTarget(); - - return null; - } +// public String getSSOTarget() throws ConfigurationException { +// if (ssoconfig!= null) +// return ssoconfig.getTarget(); +// +// return null; +// } public String getSSOFriendlyName() { if (ssoconfig!= null) { @@ -937,16 +940,6 @@ public class AuthConfigurationProvider extends ConfigurationProvider { return new String(); } - public String getSSOPublicUrl() { - if (ssoconfig!= null) { - String url = ssoconfig.getPublicURL(); - if (MiscUtil.isEmpty(url)) - url = new String(); - return url; - } - return new String(); - } - public String getMOASessionEncryptionKey() { String prop = props.getProperty("configuration.moasession.key"); @@ -995,6 +988,10 @@ public class AuthConfigurationProvider extends ConfigurationProvider { return Boolean.valueOf(prop); } + public String getPublicURLPrefix() { + return publicURLPreFix; + } + /** * Retruns the STORK Configuration * @return STORK Configuration diff --git a/id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/config/auth/OAAuthParameter.java b/id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/config/auth/OAAuthParameter.java index c3943d816..881d3bb2a 100644 --- a/id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/config/auth/OAAuthParameter.java +++ b/id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/config/auth/OAAuthParameter.java @@ -322,6 +322,12 @@ public Map<String, String> getFormCustomizaten() { if (MiscUtil.isNotEmpty(bkuselection.getAppletRedirectTarget())) map.put(FormBuildUtils.REDIRECTTARGET, bkuselection.getAppletRedirectTarget()); + if (MiscUtil.isNotEmpty(bkuselection.getAppletHeight())) + map.put(FormBuildUtils.APPLET_HEIGHT, bkuselection.getAppletHeight()); + + if (MiscUtil.isNotEmpty(bkuselection.getAppletWidth())) + map.put(FormBuildUtils.APPLET_WIDTH, bkuselection.getAppletWidth()); + } } @@ -346,6 +352,27 @@ public List<OAStorkAttribute> getRequestedAttributes() { public List<AttributeProviderPlugin> getStorkAPs() { return oa_auth.getOASTORK().getAttributeProviders(); + +public byte[] getBKUSelectionTemplate() { + + TemplatesType templates = oa_auth.getTemplates(); + if (templates != null && templates.getBKUSelectionTemplate() != null) { + return templates.getBKUSelectionTemplate().getTransformation(); + + } + + return null; +} + +public byte[] getSendAssertionTemplate() { + + TemplatesType templates = oa_auth.getTemplates(); + if (templates != null && templates.getSendAssertionTemplate() != null) { + return templates.getSendAssertionTemplate().getTransformation(); + + } + + return null; } |