Class: AWSCDK::CloudFront::CfnResponseHeadersPolicy::SecurityHeadersConfigProperty

Inherits:
Jsii::Struct
  • Object
show all
Defined in:
cloud_front/cfn_response_headers_policy.rb

Overview

A configuration for a set of security-related HTTP response headers.

CloudFront adds these headers to HTTP responses that it sends for requests that match a cache behavior associated with this response headers policy.

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(content_security_policy: nil, content_type_options: nil, frame_options: nil, referrer_policy: nil, strict_transport_security: nil, xss_protection: nil) ⇒ SecurityHeadersConfigProperty

Returns a new instance of SecurityHeadersConfigProperty.

Parameters:



1235
1236
1237
1238
1239
1240
1241
1242
1243
1244
1245
1246
1247
1248
# File 'cloud_front/cfn_response_headers_policy.rb', line 1235

def initialize(content_security_policy: nil, content_type_options: nil, frame_options: nil, referrer_policy: nil, strict_transport_security: nil, xss_protection: nil)
  @content_security_policy = content_security_policy.is_a?(Hash) ? ::AWSCDK::CloudFront::CfnResponseHeadersPolicy::ContentSecurityPolicyProperty.new(**content_security_policy.transform_keys(&:to_sym)) : content_security_policy
  Jsii::Type.check_type(@content_security_policy, JSON.parse(Base64.strict_decode64("eyJ1bmlvbiI6eyJ0eXBlcyI6W3siZnFuIjoiYXdzLWNkay1saWIuSVJlc29sdmFibGUifSx7ImZxbiI6ImF3cy1jZGstbGliLmF3c19jbG91ZGZyb250LkNmblJlc3BvbnNlSGVhZGVyc1BvbGljeS5Db250ZW50U2VjdXJpdHlQb2xpY3lQcm9wZXJ0eSJ9XX19")), "contentSecurityPolicy") unless @content_security_policy.nil?
  @content_type_options = content_type_options.is_a?(Hash) ? ::AWSCDK::CloudFront::CfnResponseHeadersPolicy::ContentTypeOptionsProperty.new(**content_type_options.transform_keys(&:to_sym)) : content_type_options
  Jsii::Type.check_type(@content_type_options, JSON.parse(Base64.strict_decode64("eyJ1bmlvbiI6eyJ0eXBlcyI6W3siZnFuIjoiYXdzLWNkay1saWIuSVJlc29sdmFibGUifSx7ImZxbiI6ImF3cy1jZGstbGliLmF3c19jbG91ZGZyb250LkNmblJlc3BvbnNlSGVhZGVyc1BvbGljeS5Db250ZW50VHlwZU9wdGlvbnNQcm9wZXJ0eSJ9XX19")), "contentTypeOptions") unless @content_type_options.nil?
  @frame_options = frame_options.is_a?(Hash) ? ::AWSCDK::CloudFront::CfnResponseHeadersPolicy::FrameOptionsProperty.new(**frame_options.transform_keys(&:to_sym)) : frame_options
  Jsii::Type.check_type(@frame_options, JSON.parse(Base64.strict_decode64("eyJ1bmlvbiI6eyJ0eXBlcyI6W3siZnFuIjoiYXdzLWNkay1saWIuSVJlc29sdmFibGUifSx7ImZxbiI6ImF3cy1jZGstbGliLmF3c19jbG91ZGZyb250LkNmblJlc3BvbnNlSGVhZGVyc1BvbGljeS5GcmFtZU9wdGlvbnNQcm9wZXJ0eSJ9XX19")), "frameOptions") unless @frame_options.nil?
  @referrer_policy = referrer_policy.is_a?(Hash) ? ::AWSCDK::CloudFront::CfnResponseHeadersPolicy::ReferrerPolicyProperty.new(**referrer_policy.transform_keys(&:to_sym)) : referrer_policy
  Jsii::Type.check_type(@referrer_policy, JSON.parse(Base64.strict_decode64("eyJ1bmlvbiI6eyJ0eXBlcyI6W3siZnFuIjoiYXdzLWNkay1saWIuSVJlc29sdmFibGUifSx7ImZxbiI6ImF3cy1jZGstbGliLmF3c19jbG91ZGZyb250LkNmblJlc3BvbnNlSGVhZGVyc1BvbGljeS5SZWZlcnJlclBvbGljeVByb3BlcnR5In1dfX0=")), "referrerPolicy") unless @referrer_policy.nil?
  @strict_transport_security = strict_transport_security.is_a?(Hash) ? ::AWSCDK::CloudFront::CfnResponseHeadersPolicy::StrictTransportSecurityProperty.new(**strict_transport_security.transform_keys(&:to_sym)) : strict_transport_security
  Jsii::Type.check_type(@strict_transport_security, JSON.parse(Base64.strict_decode64("eyJ1bmlvbiI6eyJ0eXBlcyI6W3siZnFuIjoiYXdzLWNkay1saWIuSVJlc29sdmFibGUifSx7ImZxbiI6ImF3cy1jZGstbGliLmF3c19jbG91ZGZyb250LkNmblJlc3BvbnNlSGVhZGVyc1BvbGljeS5TdHJpY3RUcmFuc3BvcnRTZWN1cml0eVByb3BlcnR5In1dfX0=")), "strictTransportSecurity") unless @strict_transport_security.nil?
  @xss_protection = xss_protection.is_a?(Hash) ? ::AWSCDK::CloudFront::CfnResponseHeadersPolicy::XSSProtectionProperty.new(**xss_protection.transform_keys(&:to_sym)) : xss_protection
  Jsii::Type.check_type(@xss_protection, JSON.parse(Base64.strict_decode64("eyJ1bmlvbiI6eyJ0eXBlcyI6W3siZnFuIjoiYXdzLWNkay1saWIuSVJlc29sdmFibGUifSx7ImZxbiI6ImF3cy1jZGstbGliLmF3c19jbG91ZGZyb250LkNmblJlc3BvbnNlSGVhZGVyc1BvbGljeS5YU1NQcm90ZWN0aW9uUHJvcGVydHkifV19fQ==")), "xssProtection") unless @xss_protection.nil?
end

Instance Attribute Details

#content_security_policyAWSCDK::IResolvable, ... (readonly)

The policy directives and their values that CloudFront includes as values for the Content-Security-Policy HTTP response header.

For more information about the Content-Security-Policy HTTP response header, see Content-Security-Policy in the MDN Web Docs.



1256
1257
1258
# File 'cloud_front/cfn_response_headers_policy.rb', line 1256

def content_security_policy
  @content_security_policy
end

#content_type_optionsAWSCDK::IResolvable, ... (readonly)

Determines whether CloudFront includes the X-Content-Type-Options HTTP response header with its value set to nosniff .

For more information about the X-Content-Type-Options HTTP response header, see X-Content-Type-Options in the MDN Web Docs.



1263
1264
1265
# File 'cloud_front/cfn_response_headers_policy.rb', line 1263

def content_type_options
  @content_type_options
end

#frame_optionsAWSCDK::IResolvable, ... (readonly)

Determines whether CloudFront includes the X-Frame-Options HTTP response header and the header's value.

For more information about the X-Frame-Options HTTP response header, see X-Frame-Options in the MDN Web Docs.



1270
1271
1272
# File 'cloud_front/cfn_response_headers_policy.rb', line 1270

def frame_options
  @frame_options
end

#referrer_policyAWSCDK::IResolvable, ... (readonly)

Determines whether CloudFront includes the Referrer-Policy HTTP response header and the header's value.

For more information about the Referrer-Policy HTTP response header, see Referrer-Policy in the MDN Web Docs.



1277
1278
1279
# File 'cloud_front/cfn_response_headers_policy.rb', line 1277

def referrer_policy
  @referrer_policy
end

#strict_transport_securityAWSCDK::IResolvable, ... (readonly)

Determines whether CloudFront includes the Strict-Transport-Security HTTP response header and the header's value.

For more information about the Strict-Transport-Security HTTP response header, see Security headers in the Amazon CloudFront Developer Guide and Strict-Transport-Security in the MDN Web Docs.



1284
1285
1286
# File 'cloud_front/cfn_response_headers_policy.rb', line 1284

def strict_transport_security
  @strict_transport_security
end

#xss_protectionAWSCDK::IResolvable, ... (readonly)

Determines whether CloudFront includes the X-XSS-Protection HTTP response header and the header's value.

For more information about the X-XSS-Protection HTTP response header, see X-XSS-Protection in the MDN Web Docs.



1291
1292
1293
# File 'cloud_front/cfn_response_headers_policy.rb', line 1291

def xss_protection
  @xss_protection
end

Class Method Details

.jsii_propertiesObject



1293
1294
1295
1296
1297
1298
1299
1300
1301
1302
# File 'cloud_front/cfn_response_headers_policy.rb', line 1293

def self.jsii_properties
  {
    :content_security_policy => "contentSecurityPolicy",
    :content_type_options => "contentTypeOptions",
    :frame_options => "frameOptions",
    :referrer_policy => "referrerPolicy",
    :strict_transport_security => "strictTransportSecurity",
    :xss_protection => "xssProtection",
  }
end

Instance Method Details

#to_jsiiObject



1304
1305
1306
1307
1308
1309
1310
1311
1312
1313
1314
1315
# File 'cloud_front/cfn_response_headers_policy.rb', line 1304

def to_jsii
  result = {}
  result.merge!({
    "contentSecurityPolicy" => @content_security_policy,
    "contentTypeOptions" => @content_type_options,
    "frameOptions" => @frame_options,
    "referrerPolicy" => @referrer_policy,
    "strictTransportSecurity" => @strict_transport_security,
    "xssProtection" => @xss_protection,
  })
  result.compact
end