micore/api-security-bundle

Symfony bundle

1.0.3 2020-06-26 07:45 UTC

This package is auto-updated.

Last update: 2024-10-26 17:18:53 UTC


README


// config/packages/security.yaml

providers:
    users:
        entity:
               
           class: 'App\Entity\User'
               
           property: 'username'    
    users_by_token:
        entity:
               
           class: 'App\Entity\User'
               
           property: 'token'

token:
    provider: users_by_token
    guard:
       authenticators:
          - MiCore\ApiSecurityBundle\Security\TokenAuthenticator
    access_denied_handler: MiCore\ApiSecurityBundle\Security\ApiAccessDeniedHandler
    stateless: true

user_name:
    provider: users
    guard:
       authenticators:
          - MiCore\ApiSecurityBundle\Security\LoginAuthenticator   
    stateless: true