Mam problem z plikiem security.yml i routingiem -tak sądzę. Poniżej plik security.yml
Kod
# you can read more about security in the related section of the documentation
# http://symfony.com/doc/current/book/security.html
security:
# http://symfony.com/doc/current/book/security.html#encoding-the-user-s-password
encoders:
Common\UserBundle\Entity\User:
algorithm: bcrypt
# http://symfony.com/doc/current/book/security.html#hierarchical-roles
role_hierarchy:
ROLE_ADMIN: ROLE_USER
ROLE_SUPER_ADMIN: [ROLE_USER, ROLE_ADMIN, ROLE_ALLOWED_TO_SWITCH]
# http://symfony.com/doc/current/book/security.html#where-do-users-come-from-user-providers
providers:
blog_users:
entity:
class: CommonUserBundle:User
property: username
# the main part of the security, where you can set up firewalls
# for specific sections of your app
firewalls:
# disables authentication for assets and the profiler, adapt it according to your needs
dev:
pattern: ^/(_(profiler|wdt)|css|img|js)/
security: false
# secures part of the application
blog_security:
pattern: ^/
anonymous: ~
form_login:
check_path: _check_path
login_path: _blog_login
default_target_path: blog_index
logout:
path: _logout
target: blog_index
#http_basic:
# realm: "Secured Demo Area"
# with these settings you can restrict or allow access for different parts
# of your application based on roles, ip, host or methods
# http://symfony.com/doc/current/book/security.html#security-book-access-control-matching-options
access_control:
#- { path: ^/login, roles: IS_AUTHENTICATED_ANONYMOUSLY, requires_channel: https }
# http://symfony.com/doc/current/book/security.html
security:
# http://symfony.com/doc/current/book/security.html#encoding-the-user-s-password
encoders:
Common\UserBundle\Entity\User:
algorithm: bcrypt
# http://symfony.com/doc/current/book/security.html#hierarchical-roles
role_hierarchy:
ROLE_ADMIN: ROLE_USER
ROLE_SUPER_ADMIN: [ROLE_USER, ROLE_ADMIN, ROLE_ALLOWED_TO_SWITCH]
# http://symfony.com/doc/current/book/security.html#where-do-users-come-from-user-providers
providers:
blog_users:
entity:
class: CommonUserBundle:User
property: username
# the main part of the security, where you can set up firewalls
# for specific sections of your app
firewalls:
# disables authentication for assets and the profiler, adapt it according to your needs
dev:
pattern: ^/(_(profiler|wdt)|css|img|js)/
security: false
# secures part of the application
blog_security:
pattern: ^/
anonymous: ~
form_login:
check_path: _check_path
login_path: _blog_login
default_target_path: blog_index
logout:
path: _logout
target: blog_index
#http_basic:
# realm: "Secured Demo Area"
# with these settings you can restrict or allow access for different parts
# of your application based on roles, ip, host or methods
# http://symfony.com/doc/current/book/security.html#security-book-access-control-matching-options
access_control:
#- { path: ^/login, roles: IS_AUTHENTICATED_ANONYMOUSLY, requires_channel: https }
routing.yml w CommonUserBundle:
Kod
common_user:
resource: "@CommonUserBundle/Controller/"
type: annotation
prefix: /
_check_path:
path: /login-check
_logout:
path: /logout
resource: "@CommonUserBundle/Controller/"
type: annotation
prefix: /
_check_path:
path: /login-check
_logout:
path: /logout
Problem polega na tym że po kliku na "Zaloguj" następuje przekierowanie na ścieżkę lgon-check, co z kolei skutkuje wyświetleniem błędu:
Unable to find the controller for path "/login-check". Maybe you forgot to add the matching route in your routing configuration?
Podpowiedzi które znalazłem do tej pory nie naprowadziły mnie niestety na rozwiązanie problemu. Od razu dodam że zapoznałem się ze stroną dokumentacji:
http://symfony.com/doc/current/book/securi...-authentication
Tyle tylko że nie potrafię przenieść opisu, który tam jest na mój kod ;/ jakieś sugestie co tutaj jest źle? Będę wdzięczny za pomoc i z góry dziękuję
