gepur-it / ldap-bundle

gepur应用授权组件

安装次数: 10,093

依赖关系: 0

建议者: 0

安全性: 0

星标: 1

关注者: 3

分支: 0

开放问题: 1

类型:symfony-bundle

5.1.0 2021-04-12 17:16 UTC

This package is auto-updated.

Last update: 2024-08-28 14:47:47 UTC


README

gepur应用授权组件

修复security.yaml

在security.yaml的providers部分添加provider

security:
    ...
    providers:
        gepur_ldap:
        id: GepurIt\LdapBundle\Contracts\ErpUserProviderInterface

添加API密钥和ldap认证器

security:
    ...
    firewalls:
        ...
        main:
            guard:
                authenticators:
                    - GepurIt\LdapBundle\Guard\ApiKeyAuthenticator
                    - GepurIt\LdapBundle\Guard\LdapAuthenticator
                entry_point: GepurIt\LdapBundle\Guard\ApiKeyAuthenticator

添加注销处理器(用于清除API密钥)

security:
    ...
    firewalls:
        ...
        main:
            ...
            logout:
                path:   logout
                target: /login
                invalidate_session: true
                success_handler: GepurIt\LdapBundle\Logout\LogoutSuccessHandler
                handlers: [GepurIt\LdapBundle\Logout\LogoutHandler]

完整配置

security:
    ...
    providers:
        gepur_ldap:
        id: GepurIt\LdapBundle\Contracts\ErpUserProviderInterface
    firewalls:
        dev:
            pattern: ^/(_(profiler|wdt)|css|images|js)/
            security: false

        main:
            pattern: ^/
            stateless: true
            anonymous: ~
            logout:
                path:   logout
                target: /login
                invalidate_session: true
                success_handler: GepurIt\LdapBundle\Logout\LogoutSuccessHandler
                handlers: [GepurIt\LdapBundle\Logout\LogoutHandler]
            guard:
                authenticators:
                    - GepurIt\LdapBundle\Guard\ApiKeyAuthenticator
                    - GepurIt\LdapBundle\Guard\LdapAuthenticator
                entry_point: GepurIt\LdapBundle\Guard\ApiKeyAuthenticator