/// <summary> /// Constructor /// </summary> /// <param name="options">The CORS options to be applied</param> public CorsBasedSecurityMessageHandler( CorsOptions options = null) { options.NotNull(nameof(options)); Options = options; }
public static CorsPolicy GetCorsPolicy( this CorsOptions options) { options.NotNull(nameof(options)); var corsPolicy = new CorsPolicy { AllowAnyHeader = options.AllowAnyHeader, AllowAnyMethod = options.AllowAnyMethod, AllowAnyOrigin = options.AllowAnyOrigin, SupportsCredentials = options.SupportsCredentials, }; if (options.PreflightMaxAge.HasValue) { corsPolicy.PreflightMaxAge = options.PreflightMaxAge; } options.SetHeadersIfRequired(corsPolicy); options.SetMethodsIfRequired(corsPolicy); options.SetOriginsIfRequired(corsPolicy); return(corsPolicy); }