当前位置: 首页>>代码示例>>PHP>>正文


PHP Context::getCsrfProtectionToken方法代码示例

本文整理汇总了PHP中TYPO3\Flow\Security\Context::getCsrfProtectionToken方法的典型用法代码示例。如果您正苦于以下问题:PHP Context::getCsrfProtectionToken方法的具体用法?PHP Context::getCsrfProtectionToken怎么用?PHP Context::getCsrfProtectionToken使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在TYPO3\Flow\Security\Context的用法示例。


在下文中一共展示了Context::getCsrfProtectionToken方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: renderCsrfTokenField

 /**
  * Render the a hidden field with a CSRF token
  *
  * @return string the CSRF token field
  */
 protected function renderCsrfTokenField()
 {
     if (!$this->securityContext->isInitialized()) {
         return '';
     }
     $csrfToken = $this->securityContext->getCsrfProtectionToken();
     return '<input type="hidden" name="__csrfToken" value="' . htmlspecialchars($csrfToken) . '" />' . chr(10);
 }
开发者ID:animaltool,项目名称:webinterface,代码行数:13,代码来源:FormViewHelper.php

示例2: renderCsrfTokenField

 /**
  * Render the a hidden field with a CSRF token
  *
  * @return string the CSRF token field
  */
 protected function renderCsrfTokenField()
 {
     if (strtolower($this->arguments['method']) === 'get') {
         return '';
     }
     if (!$this->securityContext->isInitialized() || !$this->authenticationManager->isAuthenticated()) {
         return '';
     }
     $csrfToken = $this->securityContext->getCsrfProtectionToken();
     return '<input type="hidden" name="__csrfToken" value="' . htmlspecialchars($csrfToken) . '" />' . chr(10);
 }
开发者ID:sengkimlong,项目名称:Flow3-Authentification,代码行数:16,代码来源:FormViewHelper.php

示例3: render

 /**
  * @param string $presetName
  * @return string
  */
 public function render($presetName = 'default')
 {
     $mergedConfiguration = array();
     $presetConfiguration = $this->formBuilderFactory->getPresetConfiguration($presetName);
     $supertypeResolver = new \TYPO3\Form\Utility\SupertypeResolver($presetConfiguration['formElementTypes']);
     $mergedConfiguration['formElementTypes'] = $supertypeResolver->getCompleteMergedTypeDefinition(TRUE);
     $mergedConfiguration['formElementGroups'] = isset($presetConfiguration['formElementGroups']) ? $presetConfiguration['formElementGroups'] : array();
     $stylesheets = isset($presetConfiguration['stylesheets']) ? $presetConfiguration['stylesheets'] : array();
     $mergedConfiguration['stylesheets'] = array();
     foreach ($stylesheets as $stylesheet) {
         if (isset($stylesheet['skipInFormBuilder']) && $stylesheet['skipInFormBuilder'] === TRUE) {
             continue;
         }
         $mergedConfiguration['stylesheets'][] = $this->resolveResourcePath($stylesheet['source']);
     }
     $javaScripts = isset($presetConfiguration['javaScripts']) ? $presetConfiguration['javaScripts'] : array();
     $mergedConfiguration['javaScripts'] = array();
     foreach ($javaScripts as $javaScript) {
         if (isset($javaScript['skipInFormBuilder']) && $javaScript['skipInFormBuilder'] === TRUE) {
             continue;
         }
         $mergedConfiguration['javaScripts'][] = $this->resolveResourcePath($javaScript['source']);
     }
     $mergedConfiguration['endpoints']['formPageRenderer'] = $this->controllerContext->getUriBuilder()->uriFor('renderformpage');
     $mergedConfiguration['endpoints']['loadForm'] = $this->controllerContext->getUriBuilder()->uriFor('loadform');
     $mergedConfiguration['endpoints']['saveForm'] = $this->controllerContext->getUriBuilder()->uriFor('saveform');
     $mergedConfiguration['endpoints']['editForm'] = $this->controllerContext->getUriBuilder()->uriFor('index');
     $mergedConfiguration['endpoints']['previewForm'] = $this->controllerContext->getUriBuilder()->uriFor('show', array(), 'FormManager');
     $mergedConfiguration['csrfToken'] = $this->securityContext->getCsrfProtectionToken();
     $mergedConfiguration['formPersistenceIdentifier'] = $this->controllerContext->getArguments()->getArgument('formPersistenceIdentifier')->getValue();
     $mergedConfiguration['presetName'] = $presetName;
     $availablePresets = array();
     foreach ($this->formBuilderFactory->getPresetNames() as $presetName) {
         $presetConfiguration = $this->formBuilderFactory->getPresetConfiguration($presetName);
         $availablePresets[] = array('name' => $presetName, 'title' => isset($presetConfiguration['title']) ? $presetConfiguration['title'] : $presetName);
     }
     $mergedConfiguration['availablePresets'] = $availablePresets;
     return json_encode($mergedConfiguration);
 }
开发者ID:neos,项目名称:form-builder,代码行数:43,代码来源:JsonConfigurationViewHelper.php

示例4: getSubmitArgumentsForPersistedEntity

 /**
  * Creates an entity as an array that you can submit as if you used a form
  * 
  * @param  string $argumentName                the name
  * @param  Object $persistedEntity             the Entity that you'd like to create this argument from
  * @param  array  $customProperties            the properties to set if wished
  * @param  array  $additionalTrustedProperties more properties to be trusted
  * @return array  the argument you can then submit
  */
 public function getSubmitArgumentsForPersistedEntity($argumentName, $persistedEntity, $customProperties = array(), $additionalTrustedProperties = array())
 {
     $arguments = array($argumentName => $this->getIdentityArgumentFromPersistedEntity($persistedEntity));
     $propertyNamesForMappingService = array($argumentName . '[__identity]') + $additionalTrustedProperties;
     // set the properties
     foreach ($customProperties as $propertyName => $propertyValue) {
         $arguments[$argumentName][$propertyName] = $propertyValue;
         $propertyNamesForMappingService[] = $argumentName . '[' . $propertyName . ']';
     }
     $propertyNamesForMappingService[] = '';
     // add __trustedProperties
     $arguments['__trustedProperties'] = $this->mvcPropertyMappingConfigurationService->generateTrustedPropertiesToken($propertyNamesForMappingService, '');
     // add __csrfToken
     $arguments['__csrfToken'] = $this->securityContext->getCsrfProtectionToken();
     return $arguments;
 }
开发者ID:econic,项目名称:testing,代码行数:25,代码来源:EntityFactory.php

示例5: render

 /**
  * @return string
  */
 public function render()
 {
     return $this->securityContext->getCsrfProtectionToken();
 }
开发者ID:animaltool,项目名称:webinterface,代码行数:7,代码来源:CsrfTokenViewHelper.php


注:本文中的TYPO3\Flow\Security\Context::getCsrfProtectionToken方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。