/// <summary> /// Incepts the request and punes the input. /// </summary> /// <param name="message"></param> public override void InterceptRequest(InterceptorMessage message) { try { XmlDocument body = message.GetBody(); CompiledXslt styleSheet = LoadStyleSheet(body); XmlDocument transformedBody = _xsltUtility.TransformXml(body, styleSheet); message.SetBody(transformedBody); if (_configuration.PropagateOriginalMessage) { OriginalBody orgBody = new OriginalBody(body); message.AddProperty(ServerXsltTransformationBindingExtensionElement.ORIGINALBODYPROPERTYNAME, orgBody); } } catch (Exception ex) { throw new XsltTransformFailedException(ex); } }
/// <summary> /// Overrides the abstract method and implements the basic intercept on a /// request. /// </summary> /// <param name="interceptorMessage"></param> public override void InterceptRequest(InterceptorMessage interceptorMessage) { try { X509Certificate2 certificate = interceptorMessage.Certificate; XmlDocument xmlDocument = interceptorMessage.GetBody(); DocumentTypeConfigSearcher searcher = new DocumentTypeConfigSearcher(); DocumentTypeConfig documentType = searcher.FindUniqueDocumentType(xmlDocument); bool authorised = _authoriser.Authorise(certificate, xmlDocument, documentType); if (!authorised) { throw new NotAuthorisedException(certificate, xmlDocument, documentType); } } catch (NotAuthorisedException) { throw; } catch (Exception ex) { throw new AuthorisationProcessFailedException(ex); } }