PHP 클래스 lithium\template\helper\Security

또한 보기: lithium\security\validation\RequestToken
상속: extends lithium\template\Helper
파일 보기 프로젝트 열기: unionofrad/lithium 1 사용 예제들

보호된 프로퍼티들

프로퍼티 타입 설명
$_classes
$_state

공개 메소드들

메소드 설명
__construct ( array $config = [] ) : void Constructor. Configures the helper with the default settings for interacting with security tokens.
requestToken ( array $options = [] ) : string Generates a request key used to protect your forms against CSRF attacks. See the RequestToken class for examples and proper usage.
sign ( object $form = null ) : void Binds the Security helper to the Form helper to create a signature used to secure form fields against tampering.

메소드 상세

__construct() 공개 메소드

Constructor. Configures the helper with the default settings for interacting with security tokens.
public __construct ( array $config = [] ) : void
$config array
리턴 void

requestToken() 공개 메소드

Generates a request key used to protect your forms against CSRF attacks. See the RequestToken class for examples and proper usage.
또한 보기: lithium\security\validation\RequestToken
public requestToken ( array $options = [] ) : string
$options array Options used as HTML when generating the field.
리턴 string Returns a hidden `` field containing a request-specific CSRF token key.

sign() 공개 메소드

First FormSignature must be provided with a secret unique to your app. This is best done in the bootstrap process. The secret key should be a random lengthy string. php use lithium\security\validation\FormSignature; FormSignature::config(array('secret' => 'a long secret key')); In the view call the sign() method before creating the form. php security->sign(); ?> form->create(...); ?> Form fields... form->end(); ?> In the corresponding controller action verify the signature. php if ($this->request->is('post') && !FormSignature::check($this->request)) { The key didn't match, meaning the request has been tampered with. } Calling this method before a form is created adds two additional options to the $options parameter in all form inputs: - 'locked' _boolean_: If true, _locks_ the value specified in the field when the field is generated, such that tampering with the value will invalidate the signature. Defaults to true for hidden fields, and false for all other form inputs. - 'exclude' _boolean_: If true, this field and all subfields of the same name will be excluded from the signature calculation. This is useful in situations where fields may be added dynamically on the client side. Defaults to false.
또한 보기: lithium\template\helper\Form
또한 보기: lithium\security\validation\FormSignature
public sign ( object $form = null ) : void
$form object Optional. Allows specifying an instance of the `Form` helper manually.
리턴 void

프로퍼티 상세

$_classes 보호되어 있는 프로퍼티

protected $_classes

$_state 보호되어 있는 프로퍼티

protected $_state