/// <summary>
 /// Add the policy to the policy collection
 /// </summary>
 /// <param name="policies"></param>
 /// <param name="policy"></param>
 /// <returns></returns>
 internal static HeaderPolicyCollection ApplyPolicy(
     this HeaderPolicyCollection policies,
     IHeaderPolicy policy)
 {
     policies[policy.Header] = policy;
     return(policies);
 }
 private SecureHeaderMiddleware CreateSecurityMiddleware(IHeaderPolicy policy, bool stopOnException = true)
 {
     return(new SecureHeaderMiddleware(
                next: (innerHttpContext) =>
     {
         innerHttpContext.Response.WriteAsync(CultureInfo.CurrentCulture.TwoLetterISOLanguageName);
         return Task.CompletedTask;
     }, policy, stopOnException));
 }
示例#3
0
 public SecureHeaderMiddleware(RequestDelegate next, IHeaderPolicy policy, bool stopOnException = true)
 {
     Next = next;
     if (Validation.ObjectIsNull(policy))
     {
         throw new Exception("Error: The Constructor input parameter policy is null");
     }
     Policy          = policy;
     StopOnException = stopOnException;
 }