class Amber::Pipe::CSRF

Overview

The CSRF Handler adds support for Cross Site Request Forgery.

Defined in:

amber/pipes/csrf.cr

Constant Summary

CHECK_METHODS = ["PUT", "POST", "PATCH", "DELETE"] of ::String
CSRF_KEY = "csrf.token"
HEADER_KEY = "X-CSRF-TOKEN"
PARAM_KEY = "_csrf"
TOKEN_LENGTH = 32

Class Method Summary

Instance Method Summary

Instance methods inherited from class Amber::Pipe::Base

call(context : HTTP::Server::Context) call

Class Method Detail

def self.metatag(context) #

[View source]
def self.tag(context) #

[View source]
def self.token(context) #

[View source]
def self.token_strategy : PersistentToken | RefreshableToken #

[View source]
def self.token_strategy=(token_strategy : PersistentToken | RefreshableToken) #

[View source]

Instance Method Detail

def call(context : HTTP::Server::Context) #
Description copied from class Amber::Pipe::Base

Execution of this handler.


[View source]
def valid_http_method?(context) #

[View source]