symfony-notes/http-basic-authenticator-bundle

该软件包已被放弃且不再维护。没有建议替代软件包。

Symfony Http Basic Authenticator Bundle

dev-master / 1.x-dev 2017-03-25 11:50 UTC

This package is auto-updated.

Last update: 2023-02-09 10:31:28 UTC


README

此软件包可以帮助您在项目中添加http基本认证,包括自定义凭据检查器和自定义响应。

SensioLabsInsight

License Build Status

安装

  • 使用Composer要求软件包
composer require symfony-notes/http-basic-authenticator-bundle
  • 在内核中启用软件包
public function registerBundles()
{
    $bundles = [
        // ...
        new SymfonyNotes\HttpBasicAuthenticatorBundle\SymfonyNotesHttpBasicAuthenticatorBundle(),
        // ...
    ];
    ...
}
  • security.yml中启用认证器
security:
    ...
    firewalls:
        ...
        default:
            guard:
                authenticators:
                    - notes.http_basic_authenticator

配置

默认软件包配置

notes_http_basic_authenticator:
    realm_message: Realm
    supports_remember_me: false
    failure_response: notes.authenticator_failure_response.plain

realm_message 配置允许您更改HTTP头 WWW-Authenticate: Basic realm="{your_text}"

supports_remember_me 启用或禁用Symfony "记住我"功能。

failure_response 允许您设置自己的服务,该服务将为认证失败返回响应。