nuvolapl/cf-turnstile-authenticator-bundle 问题修复 & 功能扩展

解决BUG、新增功能、兼容多环境部署,快速响应你的开发需求

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

nuvolapl/cf-turnstile-authenticator-bundle

最新稳定版本:0.0.4

Composer 安装命令:

composer require nuvolapl/cf-turnstile-authenticator-bundle

包简介

README 文档

README

.github/workflows/main.yaml

This bundle provides authentication based on the response from Cloudflare Turnstile.

Configuration

To install the bundle, follow these steps:

  • The following parameters are required for bundle configuration in the ./config/packages/cf_turnstile_authenticator.yaml file:
cf_turnstile_authenticator:
    secret_key: '%env(string:CF_TURNSTILE_AUTHENTICATOR_SECRET_KEY)%'
  • add the CF_TURNSTILE_AUTHENTICATOR_SECRET_KEY environment variable to the .env file with a dummy secret key
  • add the CF_TURNSTILE_AUTHENTICATOR_SECRET_KEY environment variable to the .env.local file with the secret key from Cloudflare Turnstile

Installation

To install the bundle, follow these steps:

  • Run the following command to install the bundle:
composer require nuvola/cloudflare-turnstile-authenticator-bundle
  • add the bundle to the ./config/bundles.php file:
<?php
// ...
    Nuvola\CloudflareTurnstileAuthenticatorBundle\CloudflareTurnstileAuthenticatorBundle::class => ['all' => true],
// ...
  • to use the bundle, add the following code to the ./config/packages/security.yaml file:
security:
# ...
    firewalls:
# ...
        # adjust the name and pattern to your application!
        public:
            pattern: ^/api/public/
            stateless: true
            custom_authenticators:
              - Nuvola\CloudflareTurnstileAuthenticatorBundle\Security\CloudflareTurnstileAuthenticator
# ...
    access_control:
      - { path: ^/api/public/, roles: IS_AUTHENTICATED_FULLY }
# ...

After adding this configuration, only authenticated by response token from the Cloudflare Turnstile will be passed.

Usage

curl -H "x-cf-turnstile-response: $RESPONSE" https://api.nuvola.pl/api/public/users/7ff847d9-a2e0-4f93-9c00-b59ecd51a766

统计信息

  • 总下载量: 14
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 0
  • 点击次数: 0
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 0
  • Watchers: 1
  • Forks: 1
  • 开发语言: PHP

其他信息

  • 授权协议: proprietary
  • 更新时间: 2023-09-18