Beispiel #1
0
 public override SoapFilterResult ProcessMessage(SoapEnvelope envelope)
 {
     if (SericeUtil.versionsnummer(envelope) == "1.1")
     {
         if (cert != null)
         {
             Signering.Sign(envelope.DocumentElement, resrefs, "Security", NamespaceAlias.wsse, "MessageSignature", cert);
         }
     }
     return(SoapFilterResult.Continue);
 }
Beispiel #2
0
        public override SoapFilterResult ProcessMessage(SoapEnvelope envelope)
        {
            try
            {
                if (SericeUtil.versionsnummer(envelope) != "1.1" && ServiceAcceptOtherThan11)
                {
                    return(SoapFilterResult.Continue);
                }

                var certificate = Signering.validateSignature(envelope.DocumentElement, "MessageSignature", "", NamespaceAlias.wsse, true);
                if (certificate == null)
                {
                    return(errorhandler.makeServiceError(new ErrorType(ErrorCode.InvalidInput, "Fejl i MessageSignature")));
                }

                HashValues hv = Signering.GetHashValues(envelope);

                if (hv.IsSingleSignOn)
                {
                    if (certificate.GetCertHashString() == hv.ClientVOCESHash)
                    {
                        return(SoapFilterResult.Continue);
                    }
                }
                else
                {
                    if (cf(certificate))
                    {
                        return(SoapFilterResult.Continue);
                    }
                }
                return(errorhandler.makeServiceError(new ErrorType(ErrorCode.NotAuthorized, "MessageSignature ikke accepteret")));
            }
            catch (Exception ex)
            {
                return(errorhandler.makeServiceError(new ErrorType(ErrorCode.InternalError, "MessageSignServiceInFilter " + ex.Message)));
            }
        }