1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69
| # To get started with security, check out the documentation:
# http://symfony.com/doc/current/security.html
security:
encoders:
AppBundle\Entity\User:
algorithm: sha512
encode_as_base64: true
iterations: 5000
# http://symfony.com/doc/current/security.html#b-configuring-how-users-are-loaded
providers:
# in_memory:
# memory: ~
db_providers:
entity:
class: AppBundle:User
property: username #devrai être enlevé si tu permet le log via username ou email dans ta requete comme le montre la requete du repository ci-après
firewalls:
# disables authentication for assets and the profiler, adapt it according to your needs
dev:
pattern: ^/(_(profiler|wdt)|css|images|js)/
security: false
main:
anonymous: ~
# activate different ways to authenticate
# http_basic: ~
# http://symfony.com/doc/current/security.html#a-configuring-how-your-users-will-authenticate
# form_login: ~
# http://symfony.com/doc/current/cookbook/security/form_login_setup.html
form_login:
login_path: login
check_path: login
username_parameter: form[username] # ou username si tu n'utilise pas le builder
password_parameter: form[password]
default_target_path: homepage #redirection on success
use_referer: true #identification du referant (verifie que celui qui arrive sur ta page vient d'une requete légal et nom pas hacked.biz)
csrf_token_generator: security.csrf.token_manager
csrf_parameter: form[_token]
logout:
path: /logout
target: logout
invalidate_session: false
delete_cookies:
a: { path: /, domain: test.loc }
# b: { path: null, domain: null }
# handlers: [some.service.id, another.service.id]
# success_handler: some.service.id
remember_me:
# token_provider: name
secret: "%secret%"
name: _ds_l
lifetime: 3600
path: /
domain: test.loc
secure: false
httponly: true
always_remember_me: false
remember_me_parameter: form[keep_login]
access_control:
- { path: ^/login, roles: IS_AUTHENTICATED_ANONYMOUSLY }
- { path: ^/, roles: IS_AUTHENTICATED_ANONYMOUSLY }
- { path: ^/home, roles: IS_AUTHENTICATED_ANONYMOUSLY }
- { path: ^/about, roles: IS_AUTHENTICATED_ANONYMOUSLY }
- { path: ^/cv, roles: IS_AUTHENTICATED_FULLY }
- { path: ^/admin, roles: ROLE_ADMIN } |
Partager