Example #1
0
        private static FaultException CreateFault(string code, string reason, SoapContext context)
        {
            var ns      = WsSecurityConstants.WsSecurity10.Namespace;
            var version = context.MessageVersion;

            if (version.Envelope == EnvelopeVersion.Soap11)
            {
                return(new FaultException(
                           new FaultReason(reason),
                           new FaultCode(code, ns),
                           context.Request.Headers.Action
                           ));
            }

            return(new FaultException(
                       new FaultReason(reason),
                       new FaultCode("Sender", SoapConstants.Soap12.EnvelopeNamespace, new FaultCode(code, ns)),
                       context.Request.Headers.Action
                       ));
        }
Example #2
0
 public static Timestamp GetWsSecurityTimestamp(this SoapContext context)
 => context.HttpContext.Items.TryGetValue(WsSecurityTimestampKey, out var timestamp) ? timestamp as Timestamp : null;
Example #3
0
 internal static void SetWsSecurityTimestamp(this SoapContext context, Timestamp timestamp)
 => context.HttpContext.Items.Add(WsSecurityTimestampKey, timestamp);
Example #4
0
 public static FaultException CreateMessageExpiredFault(this SoapContext context) => CreateFault("MessageExpired", "The message has expired", context);
Example #5
0
 public static FaultException CreateFailedCheckFault(this SoapContext context) => CreateFault("FailedCheck", "The signature or decryption was invalid", context);
Example #6
0
 public static FaultException CreateSecurityTokenUnavailableFault(this SoapContext context) => CreateFault("SecurityTokenUnavailable", "Referenced security token could not be retrieved", context);
Example #7
0
 public static FaultException CreateFailedAuthenticationFault(this SoapContext context) => CreateFault("FailedAuthentication", "The security token could not be authenticated or authorized", context);
Example #8
0
 public static FaultException CreateInvalidSecurityTokenFault(this SoapContext context) => CreateFault("InvalidSecurityToken", "An invalid security token was provided", context);
Example #9
0
 public static FaultException CreateInvalidSecurityFault(this SoapContext context) => CreateFault("InvalidSecurity", "An error was discovered processing the <wsse:Security> header", context);
Example #10
0
 public static FaultException CreateUnsupportedAlgorithmFault(this SoapContext context) => CreateFault("UnsupportedAlgorithm", "An unsupported signature or encryption algorithm was used", context);
Example #11
0
 public static FaultException CreateUnsupportedSecurityTokenFault(this SoapContext context) => CreateFault("UnsupportedSecurityToken", "An unsupported token was provided", context);