gepur-it/ldap-bundle

Authorisation bundle fot gepur apps

Installs: 10 056

Dependents: 0

Suggesters: 0

Security: 0

Stars: 1

Watchers: 3

Forks: 0

Open Issues: 1

Type:symfony-bundle

5.1.0 2021-04-12 17:16 UTC

This package is auto-updated.

Last update: 2024-03-28 14:03:35 UTC


README

Authorisation bundle fot gepur apps

Fix security.yaml:

add provider to providers section in security.yaml

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

add api key and ldap authenticators:

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

add logout handler (to clear api key):

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

full added configs:

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