SonataUserBundle icon indicating copy to clipboard operation
SonataUserBundle copied to clipboard

User Bundle + Sonata Admin: No redirect to login form when opening /admin/dashboard without being logged in

Open Saerdn opened this issue 2 years ago • 3 comments

Environment

Sonata packages

show

sonata-project/admin-bundle              4.9.0  4.9.0  The missing Symfony Admin Generator
sonata-project/block-bundle              4.11.0 4.11.0 Symfony SonataBlockBundle
sonata-project/cache                     2.2.0  2.2.0  Cache library
sonata-project/doctrine-extensions       1.16.0 1.16.0 Doctrine2 behavioral extensions
sonata-project/doctrine-orm-admin-bundle 4.2.7  4.2.7  Integrate Doctrine ORM into the SonataAdminBundle
sonata-project/exporter                  2.11.0 2.11.0 Lightweight Exporter library
sonata-project/form-extensions           1.13.1 1.13.1 Symfony form extensions
sonata-project/twig-extensions           1.9.1  1.9.1  Sonata twig extensions
sonata-project/user-bundle               5.0.0  5.0.0  Symfony SonataUserBundle

Symfony packages

show

symfony/asset                      v6.0.3  v6.0.3  Manages URL generation and versioning of web assets such as CSS stylesheets, JavaScript files and image files
symfony/cache                      v6.0.6  v6.0.6  Provides an extended PSR-6, PSR-16 (and tags) implementation
symfony/cache-contracts            v3.0.0  v3.0.0  Generic abstractions related to caching
symfony/config                     v6.0.3  v6.0.3  Helps you find, load, combine, autofill and validate configuration values of any kind
symfony/console                    v6.0.5  v6.0.5  Eases the creation of beautiful and testable command line interfaces
symfony/dependency-injection       v6.0.6  v6.0.6  Allows you to standardize and centralize the way objects are constructed in your application
symfony/deprecation-contracts      v3.0.0  v3.0.0  A generic function and convention to trigger deprecation notices
symfony/doctrine-bridge            v6.0.6  v6.0.6  Provides integration for Doctrine with various Symfony components
symfony/dotenv                     v6.0.5  v6.0.5  Registers environment variables from a .env file
symfony/error-handler              v6.0.3  v6.0.3  Provides tools to manage errors and ease debugging PHP code
symfony/event-dispatcher           v6.0.3  v6.0.3  Provides tools that allow your application components to communicate with each other by dispatching events and listening to them
symfony/event-dispatcher-contracts v3.0.0  v3.0.0  Generic abstractions related to dispatching event
symfony/expression-language        v6.0.3  v6.0.3  Provides an engine that can compile and evaluate expressions
symfony/filesystem                 v6.0.6  v6.0.6  Provides basic utilities for the filesystem
symfony/finder                     v6.0.3  v6.0.3  Finds files and directories via an intuitive fluent interface
symfony/flex                       v2.1.6  v2.1.6  Composer plugin for Symfony
symfony/form                       v6.0.5  v6.0.5  Allows to easily create, process and reuse HTML forms
symfony/framework-bundle           v6.0.6  v6.0.6  Provides a tight integration between Symfony components and the Symfony full-stack framework
symfony/http-foundation            v6.0.6  v6.0.6  Defines an object-oriented layer for the HTTP specification
symfony/http-kernel                v6.0.6  v6.0.6  Provides a structured process for converting a Request into a Response
symfony/mailer                     v6.0.5  v6.0.5  Helps sending emails
symfony/maker-bundle               v1.37.0 v1.38.0 Symfony Maker helps you create empty commands, controllers, form classes, tests and more so you can forget about writing boilerplate code.
symfony/mime                       v6.0.3  v6.0.3  Allows manipulating MIME messages
symfony/options-resolver           v6.0.3  v6.0.3  Provides an improved replacement for the array_replace PHP function
symfony/password-hasher            v6.0.3  v6.0.3  Provides password hashing utilities
symfony/polyfill-intl-grapheme     v1.25.0 v1.25.0 Symfony polyfill for intl's grapheme_* functions
symfony/polyfill-intl-icu          v1.25.0 v1.25.0 Symfony polyfill for intl's ICU-related data and classes
symfony/polyfill-intl-idn          v1.25.0 v1.25.0 Symfony polyfill for intl's idn_to_ascii and idn_to_utf8 functions
symfony/polyfill-intl-normalizer   v1.25.0 v1.25.0 Symfony polyfill for intl's Normalizer class and related functions
symfony/polyfill-mbstring          v1.25.0 v1.25.0 Symfony polyfill for the Mbstring extension
symfony/polyfill-php81             v1.25.0 v1.25.0 Symfony polyfill backporting some PHP 8.1+ features to lower PHP versions
symfony/property-access            v6.0.5  v6.0.5  Provides functions to read and write from/to an object or array using a simple string notation
symfony/property-info              v6.0.3  v6.0.3  Extracts information about PHP class' properties using metadata of popular sources
symfony/routing                    v6.0.5  v6.0.5  Maps an HTTP request to a set of configuration variables
symfony/runtime                    v6.0.5  v6.0.5  Enables decoupling PHP applications from global state
symfony/security-acl               v3.3.1  v3.3.1  Symfony Security Component - ACL (Access Control List)
symfony/security-bundle            v6.0.5  v6.0.5  Provides a tight integration of the Security component into the Symfony full-stack framework
symfony/security-core              v6.0.5  v6.0.5  Symfony Security Component - Core Library
symfony/security-csrf              v6.0.3  v6.0.3  Symfony Security Component - CSRF Library
symfony/security-http              v6.0.5  v6.0.5  Symfony Security Component - HTTP Integration
symfony/service-contracts          v3.0.0  v3.0.0  Generic abstractions related to writing services
symfony/stopwatch                  v6.0.5  v6.0.5  Provides a way to profile code
symfony/string                     v6.0.3  v6.0.3  Provides an object-oriented API to strings and deals with bytes, UTF-8 code points and grapheme clusters in a unified way
symfony/translation                v6.0.6  v6.0.6  Provides tools to internationalize your application
symfony/translation-contracts      v3.0.0  v3.0.0  Generic abstractions related to translation
symfony/twig-bridge                v6.0.5  v6.0.5  Provides integration for Twig with various Symfony components
symfony/twig-bundle                v6.0.3  v6.0.3  Provides a tight integration of Twig into the Symfony full-stack framework
symfony/validator                  v6.0.6  v6.0.6  Provides tools to validate values
symfony/var-dumper                 v6.0.6  v6.0.6  Provides mechanisms for walking through any arbitrary PHP variable
symfony/var-exporter               v6.0.6  v6.0.6  Allows exporting any serializable PHP data structure to plain PHP code
symfony/yaml                       v6.0.3  v6.0.3  Loads and dumps YAML files

PHP version

PHP 8.1.3 (cli) (built: Mar 11 2022 03:14:41) (NTS)

Subject

I'm trying to connect the Sonata User Bundle with the Sonata Admin Bundle to secure the admin with a login. I followed the documentation (https://docs.sonata-project.org/projects/SonataUserBundle/en/5.x/reference/installation/).

Steps to reproduce

  • Follow documentation on https://docs.sonata-project.org/projects/SonataUserBundle/en/5.x/reference/installation/ up until/including "3.4 Integrating the bundle into the Sonata Admin Bundle".
  • Open /admin or /admin/dashboard

Expected results

Opening /admin or /admin/dashboard redirects user to /admin/login Basically the same behavior as with Sonata User Bundle 4.x

Actual results

Opening /admin or /admin/dashboard does not redirect user to /admin/login but throws error message Full authentication is required to access this resource.

Saerdn avatar Mar 16 '22 13:03 Saerdn

Ping @jordisala1991

VincentLanglet avatar Mar 16 '22 15:03 VincentLanglet

I couldn't reproduce the problem in one of my projects. Mind to share your full configuration to see if something is missing?

(Or if you have a reproducer it would be easier)

jordisala1991 avatar Mar 17 '22 08:03 jordisala1991

Yes I'll create a repo

Saerdn avatar Mar 17 '22 11:03 Saerdn