From 1c802614fe489280f93d36bfb6908ebffc96e4aa Mon Sep 17 00:00:00 2001 From: Florian Reimair Date: Tue, 11 Mar 2014 08:03:45 +0100 Subject: logging --- .../moa/id/protocols/stork2/AttributeCollector.java | 15 +++++++++++++++ .../moa/id/protocols/stork2/AuthenticationRequest.java | 1 + .../id/protocols/stork2/EHvdAttributeProviderPlugin.java | 4 ++++ .../moa/id/protocols/stork2/STORKProtocol.java | 1 + .../stork2/SignedDocAttributeRequestProvider.java | 5 ++++- .../protocols/stork2/StorkAttributeRequestProvider.java | 13 +++++++++---- 6 files changed, 34 insertions(+), 5 deletions(-) (limited to 'id/server') diff --git a/id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/protocols/stork2/AttributeCollector.java b/id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/protocols/stork2/AttributeCollector.java index 842c06f15..9cd825fc8 100644 --- a/id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/protocols/stork2/AttributeCollector.java +++ b/id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/protocols/stork2/AttributeCollector.java @@ -99,6 +99,7 @@ public class AttributeCollector implements IAction { * @throws MOAIDException */ public String processRequest(DataContainer container, HttpServletRequest request, HttpServletResponse response, AuthenticationSession moasession, OAAuthParameter oaParam) throws MOAIDException { + Logger.setHierarchy("moa.id.protocols.stork2"); // check if there are attributes we need to fetch IPersonalAttributeList requestAttributeList = container.getRequest().getPersonalAttributeList(); @@ -108,6 +109,8 @@ public class AttributeCollector implements IAction { if (!responseAttributeList.containsKey(current.getName())) missingAttributes.add(current); + Logger.debug("found " + missingAttributes.size() + " missing attributes"); + // Try to get all missing attributes try { // for each attribute still missing @@ -126,7 +129,9 @@ public class AttributeCollector implements IAction { for (AttributeProvider currentProvider : AttributeProviderFactory.getConfiguredPlugins(oaParam.getStorkAPs())) { try { // - hand over control to the suitable plugin + Logger.info(currentProvider.getClass().getSimpleName() + " called to handle attribute '" + currentAttribute.getName() + "'"); aquiredAttributes = currentProvider.acquire(currentAttribute, container.getRequest().getSpCountry(), moasession); + Logger.info(currentProvider.getClass().getSimpleName() + " can handle attribute '" + currentAttribute.getName() + "'"); break; } catch (UnsupportedAttributeException e) { // ok, try the next attributeprovider @@ -156,12 +161,17 @@ public class AttributeCollector implements IAction { // the attribute request is ongoing and requires an external service. try { // memorize the container again + Logger.debug("prepare putting the container into temporary storage..."); + // - generate new key String newArtifactId = new SecureRandomIdentifierGenerator() .generateIdentifier(); // - put container in temporary store. AssertionStorage.getInstance().put(newArtifactId, container); + Logger.debug("...successful"); + + Logger.info(e.getAp().getClass().getSimpleName() + " is going to ask an external service provider for the requested attributes"); // add container-key to redirect embedded within the return URL e.getAp().performRedirect(AuthConfigurationProvider.getInstance().getPublicURLPrefix() + "/stork2/ResumeAuthentication?" + ARTIFACT_ID + "=" + newArtifactId, request, response, oaParam); @@ -256,7 +266,10 @@ public class AttributeCollector implements IAction { * @throws MOAIDException */ private void addOrUpdateAll(IPersonalAttributeList target, IPersonalAttributeList source) throws MOAIDException { + Logger.info("Updating " + source.size() + " attributes..."); for (PersonalAttribute current : source) { + Logger.debug("treating " + current.getName()); + // check if we need to update the current pa if (target.containsKey(current.getName())) { PersonalAttribute existing = target.get(current.getName()); @@ -271,6 +284,8 @@ public class AttributeCollector implements IAction { target.get(current.getName()).setComplexValue(current.getComplexValue()); } else target.add(current); + + Logger.debug("...successfully treated " + current.getName()); } } diff --git a/id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/protocols/stork2/AuthenticationRequest.java b/id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/protocols/stork2/AuthenticationRequest.java index 2ae3ab03c..3d5fbd337 100644 --- a/id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/protocols/stork2/AuthenticationRequest.java +++ b/id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/protocols/stork2/AuthenticationRequest.java @@ -36,6 +36,7 @@ public class AuthenticationRequest implements IAction { public String processRequest(IRequest req, HttpServletRequest httpReq, HttpServletResponse httpResp, AuthenticationSession moasession) throws MOAIDException { + Logger.setHierarchy("moa.id.protocols.stork2"); this.moaSession = moasession; if (req instanceof MOASTORKRequest) { diff --git a/id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/protocols/stork2/EHvdAttributeProviderPlugin.java b/id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/protocols/stork2/EHvdAttributeProviderPlugin.java index b99e0ca4d..f7d105ab8 100644 --- a/id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/protocols/stork2/EHvdAttributeProviderPlugin.java +++ b/id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/protocols/stork2/EHvdAttributeProviderPlugin.java @@ -71,6 +71,8 @@ public class EHvdAttributeProviderPlugin implements AttributeProvider { throw new UnsupportedAttributeException(); try { + Logger.setHierarchy("moa.id.protocols.stork2"); + Logger.debug("initializing SOAP connections..."); // create SOAP connection SOAPConnection soapConnection = SOAPConnectionFactory.newInstance().createConnection(); @@ -109,6 +111,7 @@ public class EHvdAttributeProviderPlugin implements AttributeProvider { requestMessage.saveChanges(); // perform SOAP call + Logger.debug("call..."); SOAPMessage responseMessage = soapConnection.call(requestMessage, destination); // parse SOAP response @@ -131,6 +134,7 @@ public class EHvdAttributeProviderPlugin implements AttributeProvider { see https://stork.ehealth.gv.at/GDAService.asmx?op=IsHealthcareProfessional */ + Logger.debug("call successful. Parse..."); SOAPBody responseBody = responseMessage.getSOAPBody(); // iterate through tree diff --git a/id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/protocols/stork2/STORKProtocol.java b/id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/protocols/stork2/STORKProtocol.java index 496d1044b..e415daf3e 100644 --- a/id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/protocols/stork2/STORKProtocol.java +++ b/id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/protocols/stork2/STORKProtocol.java @@ -55,6 +55,7 @@ public class STORKProtocol implements IModulInfo, MOAIDAuthConstants { and other info are obtained, in the second step the request will be processed and the user redirected */ public IRequest preProcess(HttpServletRequest request, HttpServletResponse response, String action) throws MOAIDException { + Logger.setHierarchy("moa.id.protocols.stork2"); Logger.debug("Starting preprocessing"); Logger.debug("Request method: " + request.getMethod()); Logger.debug("Request content length: " + request.getContentLength()); diff --git a/id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/protocols/stork2/SignedDocAttributeRequestProvider.java b/id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/protocols/stork2/SignedDocAttributeRequestProvider.java index 3993ee92f..f629db5a4 100644 --- a/id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/protocols/stork2/SignedDocAttributeRequestProvider.java +++ b/id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/protocols/stork2/SignedDocAttributeRequestProvider.java @@ -75,6 +75,7 @@ public class SignedDocAttributeRequestProvider implements AttributeProvider { * .servlet.http.HttpServletRequest) */ public IPersonalAttributeList parse(HttpServletRequest httpReq) throws MOAIDException, UnsupportedAttributeException { + Logger.setHierarchy("moa.id.protocols.stork2"); Logger.debug("Beginning to extract OASIS-DSS response out of HTTP Request"); try { @@ -106,6 +107,8 @@ public class SignedDocAttributeRequestProvider implements AttributeProvider { public void performRedirect(String url, HttpServletRequest req, HttpServletResponse resp, OAAuthParameter oaParam) throws MOAIDException { + Logger.setHierarchy("moa.id.protocols.stork2"); + try { Logger.trace("Initialize VelocityEngine..."); @@ -121,7 +124,7 @@ public class SignedDocAttributeRequestProvider implements AttributeProvider { resp.getOutputStream().write(writer.toString().getBytes()); } catch (Exception e) { - Logger.error("Error sending STORK SAML AttrRequest.", e); + Logger.error("Error sending DSS signrequest.", e); throw new MOAIDException("stork.11", null); } } diff --git a/id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/protocols/stork2/StorkAttributeRequestProvider.java b/id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/protocols/stork2/StorkAttributeRequestProvider.java index 73b8e01b9..b3d831b80 100644 --- a/id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/protocols/stork2/StorkAttributeRequestProvider.java +++ b/id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/protocols/stork2/StorkAttributeRequestProvider.java @@ -72,7 +72,9 @@ public class StorkAttributeRequestProvider implements AttributeProvider { * @see at.gv.egovernment.moa.id.protocols.stork2.AttributeProvider#parse(javax.servlet.http.HttpServletRequest) */ public IPersonalAttributeList parse(HttpServletRequest httpReq) throws MOAIDException, UnsupportedAttributeException { - Logger.debug("Beginning to extract SAMLResponse out of HTTP Request"); + + Logger.setHierarchy("moa.id.protocols.stork2"); + Logger.info(this.getClass().getSimpleName() + " tries to extract SAMLResponse out of HTTP Request"); //extract STORK Response from HTTP Request //Decodes SAML Response @@ -91,7 +93,7 @@ public class StorkAttributeRequestProvider implements AttributeProvider { //validate SAML Token Logger.debug("Starting validation of SAML response"); attrResponse = engine.validateSTORKAttrQueryResponse(decSamlToken, (String) httpReq.getRemoteHost()); - Logger.info("SAML response succesfully verified!"); + Logger.info("SAML response successfully verified!"); }catch(STORKSAMLEngineException e){ Logger.error("Failed to verify STORK SAML Response", e); throw new MOAIDException("stork.05", null); @@ -104,7 +106,9 @@ public class StorkAttributeRequestProvider implements AttributeProvider { * @see at.gv.egovernment.moa.id.protocols.stork2.AttributeProvider#performRedirect(java.lang.String) */ public void performRedirect(String url, HttpServletRequest req, HttpServletResponse resp, OAAuthParameter oaParam) throws MOAIDException { - + + Logger.setHierarchy("moa.id.protocols.stork2"); + String spSector = "Business"; String spInstitution = StringUtils.isEmpty(oaParam.getFriendlyName()) ? "UNKNOWN" : oaParam.getFriendlyName(); String spApplication = spInstitution; @@ -125,7 +129,7 @@ public class StorkAttributeRequestProvider implements AttributeProvider { attributeRequest.setCitizenCountryCode("AT"); - Logger.debug("STORK AttrRequest succesfully assembled."); + Logger.debug("STORK AttrRequest successfully assembled."); STORKSAMLEngine samlEngine = STORKSAMLEngine.getInstance("VIDP"); try { @@ -154,6 +158,7 @@ public class StorkAttributeRequestProvider implements AttributeProvider { Logger.error("Error sending STORK SAML AttrRequest.", e); throw new MOAIDException("stork.11", null); } + Logger.info("STORK AttrRequest successfully rendered!"); } } -- cgit v1.2.3