From f7c35a0214cb10cf6f7de031e9e5e73f40e4569d Mon Sep 17 00:00:00 2001 From: Thomas Lenz Date: Wed, 7 Aug 2013 18:02:34 +0200 Subject: WebInterface MOAID-General finished --- .../moa/id/config/auth/AuthConfigurationProvider.java | 19 ++++++++++++++++--- .../moa/id/config/auth/OAAuthParameter.java | 4 ++-- .../moa/id/config/legacy/BuildFromLegacyConfig.java | 11 ++++++++--- .../moa/id/entrypoints/DispatcherServlet.java | 6 +++--- .../moa/id/protocols/pvp2x/PVP2XProtocol.java | 1 + 5 files changed, 30 insertions(+), 11 deletions(-) (limited to 'id/server/idserverlib/src/main/java/at') 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 192be5bbb..3fc59a78d 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 @@ -31,6 +31,7 @@ import java.io.File; import java.io.FileInputStream; import java.io.FileNotFoundException; import java.io.IOException; +import java.math.BigInteger; import java.net.MalformedURLException; import java.security.NoSuchAlgorithmException; import java.security.NoSuchProviderException; @@ -50,6 +51,7 @@ import javax.xml.bind.Unmarshaller; import org.hibernate.cfg.Configuration; +import at.gv.egovernment.moa.id.auth.AuthenticationServer; import at.gv.egovernment.moa.id.commons.db.ConfigurationDBRead; import at.gv.egovernment.moa.id.commons.db.ConfigurationDBUtils; import at.gv.egovernment.moa.id.commons.db.MOASessionDBUtils; @@ -425,9 +427,20 @@ public class AuthConfigurationProvider extends ConfigurationProvider { if (auth.getGeneralConfiguration().getTimeOuts() != null) { timeouts = new TimeOuts(); - timeouts.setAssertion(auth.getGeneralConfiguration().getTimeOuts().getAssertion()); - timeouts.setMOASessionCreated(auth.getGeneralConfiguration().getTimeOuts().getMOASessionCreated()); - timeouts.setMOASessionUpdated(auth.getGeneralConfiguration().getTimeOuts().getMOASessionUpdated()); + 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 { 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 19a006982..57f6ee4f1 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 @@ -222,12 +222,12 @@ public List getTransformsInfos() { return false; } - public boolean useSSOWithoutQuestion() { + public boolean useSSOQuestion() { OASSO sso = oa_auth.getOASSO(); if (sso != null) return sso.isAuthDataFrame(); else - return false; + return true; } diff --git a/id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/config/legacy/BuildFromLegacyConfig.java b/id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/config/legacy/BuildFromLegacyConfig.java index 7ec8c823e..0c5a50393 100644 --- a/id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/config/legacy/BuildFromLegacyConfig.java +++ b/id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/config/legacy/BuildFromLegacyConfig.java @@ -24,6 +24,7 @@ import org.w3c.dom.Element; import eu.stork.vidp.messages.util.SAMLUtil; import eu.stork.vidp.messages.util.XMLUtil; +import at.gv.egovernment.moa.id.commons.db.ConfigurationDBUtils; import at.gv.egovernment.moa.id.commons.db.dao.config.AuthComponentGeneral; import at.gv.egovernment.moa.id.commons.db.dao.config.AuthComponentOA; import at.gv.egovernment.moa.id.commons.db.dao.config.BKUURLS; @@ -345,8 +346,10 @@ public class BuildFromLegacyConfig { //set OnlineApplications OAAuthParameter[] onlineApplicationAuthParameters = builder.buildOnlineApplicationAuthParameters(defaultVerifyInfoboxParameters, moaSpIdentityLinkTrustProfileID); - ArrayList moa_oas = new ArrayList(); - moaIDConfig.setOnlineApplication(moa_oas); + + // ArrayList moa_oas = new ArrayList(); +// moaIDConfig.setOnlineApplication(moa_oas); + for (OAAuthParameter oa : onlineApplicationAuthParameters) { OnlineApplication moa_oa = new OnlineApplication(); @@ -416,6 +419,7 @@ public class BuildFromLegacyConfig { oa_auth.setOASSO(oa_sso); oa_sso.setUseSSO(true); oa_sso.setSingleLogOutURL(""); + oa_sso.setAuthDataFrame(true); //OA_SAML1 OASAML1 oa_saml1 = new OASAML1(); @@ -446,7 +450,8 @@ public class BuildFromLegacyConfig { oa_pvp2.setCertificate(null); } - moa_oas.add(moa_oa); + //moa_oas.add(moa_oa); + ConfigurationDBUtils.save(moa_oa); } //removed from MOAID 2.0 config diff --git a/id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/entrypoints/DispatcherServlet.java b/id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/entrypoints/DispatcherServlet.java index 83d12be87..2a28bcd15 100644 --- a/id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/entrypoints/DispatcherServlet.java +++ b/id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/entrypoints/DispatcherServlet.java @@ -403,7 +403,7 @@ public class DispatcherServlet extends AuthServlet{ moasession = AuthenticationSessionStoreage.getSession(moasessionID); //use new OAParameter - if (!oaParam.useSSOWithoutQuestion() && !AuthenticationSessionStoreage.isAuthenticated(moasessionID)) { + if (oaParam.useSSOQuestion() && !AuthenticationSessionStoreage.isAuthenticated(moasessionID)) { authmanager.sendTransmitAssertionQuestion(req, resp, protocolRequest, oaParam); return; } @@ -466,8 +466,8 @@ public class DispatcherServlet extends AuthServlet{ } catch (MOAIDException ex) { handleError(null, ex, req, resp, protocolRequestID); } catch (Throwable e) { - e.printStackTrace(); - resp.sendError(HttpServletResponse.SC_INTERNAL_SERVER_ERROR); + handleErrorNoRedirect(e.getMessage(), null, req, + resp); } finally { diff --git a/id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/protocols/pvp2x/PVP2XProtocol.java b/id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/protocols/pvp2x/PVP2XProtocol.java index a63276d6e..34becbd49 100644 --- a/id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/protocols/pvp2x/PVP2XProtocol.java +++ b/id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/protocols/pvp2x/PVP2XProtocol.java @@ -270,6 +270,7 @@ public class PVP2XProtocol implements IModulInfo, MOAIDAuthConstants { encoder = new RedirectBinding(); } + //TODO: getOAURL is maybe not a valid ErrorResponse URL encoder.encodeRespone(request, response, samlResponse, protocolRequest.getOAURL()); return true; } -- cgit v1.2.3