'Set the default CSRF options used by subsequent view registrations.
``require_csrf`` controls whether CSRF checks will be automatically
enabled on each view in the application. This value is used as the
fallback when ``require_csrf`` is left at the default of ``None`` on
:meth:`pyramid.config.Configurator.add_view`.
``token`` is the name of the CSRF token used in the body of the
request, accessed via ``request.POST[token]``. Default: ``csrf_token``.
``header`` is the name of the header containing the CSRF token,
accessed via ``request.headers[header]``. Default: ``X-CSRF-Token``.
If ``token`` or ``header`` are set to ``None`` they will not be used
for checking CSRF tokens.
``safe_methods`` is an iterable of HTTP methods which are expected to
not contain side-effects as defined by RFC2616. Safe methods will
never be automatically checked for CSRF tokens.
Default: ``(\'GET\', \'HEAD\', \'OPTIONS\', TRACE\')``.
If ``callback`` is set, it must be a callable accepting ``(request)``
and returning ``True`` if the request should be checked for a valid
CSRF token. This callback allows an application to support
alternate authentication methods that do not rely on cookies which
are not subject to CSRF attacks. For example, if a request is
authenticated using the ``Authorization`` header instead of a cookie,
this may return ``False`` for that request so that clients do not
need to send the ``X-CSRF-Token`` header. The callback is only tested
for non-safe methods as defined by ``safe_methods``.
.. versionadded:: 1.7
.. versionchanged:: 1.8
Added the ``callback`` option.'

@action_method
def set_default_csrf_options(self, require_csrf=True, token='csrf_token', header='X-CSRF-Token', safe_methods=('GET', 'HEAD', 'OPTIONS', 'TRACE'), callback=None):

    options = DefaultCSRFOptions(require_csrf, token, header, safe_methods, callback)
    def register():
        self.registry.registerUtility(options, IDefaultCSRFOptions)
    intr = self.introspectable('default    csrf    view    options', None, options, 'default    csrf    view    options')
    intr['require_csrf'] = require_csrf
    intr['token'] = token
    intr['header'] = header
    intr['safe_methods'] = as_sorted_tuple(safe_methods)
    intr['callback'] = callback
    self.action(IDefaultCSRFOptions, register, order=PHASE1_CONFIG, introspectables=(intr,))
