Implemented FOS bundle

This commit is contained in:
Kevin Frantz
2018-09-13 02:24:25 +02:00
parent 777b4aee61
commit 629ed13c51
46 changed files with 451 additions and 202 deletions

View File

@@ -0,0 +1,7 @@
fos_user:
db_driver: orm # other valid values are 'mongodb' and 'couchdb'
firewall_name: main
user_class: App\Entity\User
from_email:
address: "%env(MAILER_SENDER)%"
sender_name: "%env(MAILER_USER)%"

View File

@@ -28,3 +28,5 @@ framework:
# APCu (not recommended with heavy random-write workloads as memory fragmentation can cause perf issues)
#app: cache.adapter.apcu
templating:
engines: ['twig', 'php']

View File

@@ -1,13 +1,13 @@
security:
# https://symfony.com/doc/current/security.html#where-do-users-come-from-user-providers
encoders:
App\Entity\User:
algorithm: bcrypt
FOS\UserBundle\Model\UserInterface: bcrypt
providers:
our_db_provider:
entity:
class: App\Entity\User
property: username
fos_userbundle:
id: fos_user.user_provider.username
role_hierarchy:
ROLE_ADMIN: ROLE_USER
ROLE_SUPER_ADMIN: ROLE_ADMIN
hide_user_not_found: false
firewalls:
dev:
@@ -16,21 +16,18 @@ security:
main:
anonymous: true
form_login:
login_path: login
check_path: login
logout:
path: /logout
target: /
provider: fos_userbundle
csrf_token_generator: security.csrf.token_manager
logout: true
# activate different ways to authenticate
# http_basic: true
# https://symfony.com/doc/current/security.html#a-configuring-how-your-users-will-authenticate
# form_login: true
# https://symfony.com/doc/current/security/form_login_setup.html
# Easy way to control access for large sections of your site
# Note: Only the *first* access control that matches will be used
access_control:
# - { path: ^/admin, roles: ROLE_ADMIN }
# - { path: ^/profile, roles: ROLE_USER }
- { path: ^/login$, role: IS_AUTHENTICATED_ANONYMOUSLY }
- { path: ^/register, role: IS_AUTHENTICATED_ANONYMOUSLY }
- { path: ^/resetting, role: IS_AUTHENTICATED_ANONYMOUSLY }
- { path: ^/admin/, role: ROLE_ADMIN }