diff options
Diffstat (limited to 'id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/protocols/saml1/GetArtifactAction.java')
-rw-r--r-- | id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/protocols/saml1/GetArtifactAction.java | 72 |
1 files changed, 7 insertions, 65 deletions
diff --git a/id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/protocols/saml1/GetArtifactAction.java b/id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/protocols/saml1/GetArtifactAction.java index 75186eec2..fa9dbe990 100644 --- a/id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/protocols/saml1/GetArtifactAction.java +++ b/id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/protocols/saml1/GetArtifactAction.java @@ -1,28 +1,15 @@ package at.gv.egovernment.moa.id.protocols.saml1; -import java.io.IOException; -import java.io.PrintWriter; -import java.io.UnsupportedEncodingException; - import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; -import javax.servlet.http.HttpSession; - -import org.apache.commons.lang.StringEscapeUtils; -import at.gv.egovernment.moa.id.auth.builder.RedirectFormBuilder; import at.gv.egovernment.moa.id.auth.data.AuthenticationSession; import at.gv.egovernment.moa.id.auth.exception.AuthenticationException; -import at.gv.egovernment.moa.id.auth.exception.BuildException; import at.gv.egovernment.moa.id.auth.exception.WrongParametersException; import at.gv.egovernment.moa.id.auth.servlet.RedirectServlet; -import at.gv.egovernment.moa.id.commons.db.dao.session.AuthenticatedSessionStore; -import at.gv.egovernment.moa.id.commons.db.ex.MOADatabaseException; -import at.gv.egovernment.moa.id.config.ConfigurationException; import at.gv.egovernment.moa.id.config.auth.AuthConfigurationProvider; import at.gv.egovernment.moa.id.config.auth.OAAuthParameter; import at.gv.egovernment.moa.id.data.AuthenticationData; -import at.gv.egovernment.moa.id.moduls.AuthenticationManager; import at.gv.egovernment.moa.id.moduls.IAction; import at.gv.egovernment.moa.id.moduls.IRequest; import at.gv.egovernment.moa.id.storage.AuthenticationSessionStoreage; @@ -34,15 +21,7 @@ public class GetArtifactAction implements IAction { public String processRequest(IRequest req, HttpServletRequest httpReq, HttpServletResponse httpResp, AuthenticationSession session) throws AuthenticationException { - -// HttpSession httpSession = httpReq.getSession(); -// AuthenticationManager authmanager = AuthenticationManager.getInstance(); -// AuthenticationSession session = authmanager.getAuthenticationSession(httpSession); - -// if (!AuthenticationSessionStoreage.isAuthenticated(session.getSessionID())) { -// throw new AuthenticationException("auth.21", new Object[] {}); -// } - + String oaURL = (String) req.getOAURL(); String target = (String) req.getTarget(); @@ -59,23 +38,10 @@ public class GetArtifactAction implements IAction { throw new WrongParametersException("StartAuthentication", PARAM_OA, "auth.12"); - - // if (oaURL == null) { -// oaURL = session.getOAURLRequested(); -// } - - // TODO: Support Mandate MODE! OAAuthParameter oaParam = AuthConfigurationProvider.getInstance() .getOnlineApplicationParameter(oaURL); - - // builds authentication data and stores it together with a SAML - // artifact - - //TODO: check, if this is correct!!!! - //AuthenticationData authData = buildAuthenticationData(session, session.getXMLVerifySignatureResponse(), - // useUTC, false); - + SAML1AuthenticationServer saml1server = SAML1AuthenticationServer.getInstace(); AuthenticationData authData = SAML1AuthenticationServer.buildAuthenticationData(session, @@ -97,18 +63,13 @@ public class GetArtifactAction implements IAction { httpResp.addHeader("Location", url); } else { - String redirectURL = oaURL; - - //session.getOAURLRequested(); - + String redirectURL = oaURL; if (!oaParam.getBusinessService()) { -// redirectURL = addURLParameter(redirectURL, PARAM_TARGET, -// URLEncoder.encode(session.getTarget(), "UTF-8")); redirectURL = addURLParameter(redirectURL, PARAM_TARGET, URLEncoder.encode(oaParam.getTarget(), "UTF-8")); - } + redirectURL = addURLParameter(redirectURL, PARAM_SAMLARTIFACT, URLEncoder.encode(samlArtifactBase64, "UTF-8")); redirectURL = httpResp.encodeRedirectURL(redirectURL); @@ -120,30 +81,11 @@ public class GetArtifactAction implements IAction { return authData.getAssertionID(); - } catch (WrongParametersException ex) { - // handleWrongParameters(ex, req, httpResp); - ex.printStackTrace(); - } catch (ConfigurationException e) { - // TODO Auto-generated catch block - e.printStackTrace(); - } catch (BuildException e) { - // TODO Auto-generated catch block - e.printStackTrace(); - } catch (AuthenticationException e) { - // TODO Auto-generated catch block - e.printStackTrace(); - } catch (UnsupportedEncodingException e) { - // TODO Auto-generated catch block - e.printStackTrace(); - } catch (IOException e) { - // TODO Auto-generated catch block - e.printStackTrace(); - } catch (MOADatabaseException e) { - // TODO Auto-generated catch block - e.printStackTrace(); + } catch (Exception ex) { + Logger.error("SAML1 Assertion build error", ex); + throw new AuthenticationException("SAML1 Assertion build error.", new Object[]{}, ex); } - return null; } protected static String addURLParameter(String url, String paramname, |