What are the Slack Archives?

It’s a history of our time together in the Slack Community! There’s a ton of knowledge in here, so feel free to search through the archives for a possible answer to your question.

Because this space is not active, you won’t be able to create a new post or comment here. If you have a question or want to start a discussion about something, head over to our categories and pick one to post in! You can always refer back to a post from Slack Archives if needed; just copy the link to use it as a reference..

Hey, trying to upgrade one of our modules in ZED, and getting the following there: ``` Spryker \ Ser

UK5DS29L2
UK5DS29L2 Posts: 546 πŸ§‘πŸ»β€πŸš€ - Cadet

Hey, trying to upgrade one of our modules in ZED, and getting the following there:

 Spryker \ Service \ Container \ Exception \ NotFoundException
The requested service "security.authentication_providers" was not found in the container!

can you help me pinpoint where this is configured in ZED (so: where do we miss it)?

Comments

  • U013EK8RD7A
    U013EK8RD7A Posts: 127 πŸ§‘πŸ»β€πŸš€ - Cadet
    edited January 2021

    Do you have SecurityApplicationPlugin() in src/Pyz/Yves/ShopApplication/ShopApplicationDependencyProvider.php:247 getApplicationPlugins()method?

  • UK5DS29L2
    UK5DS29L2 Posts: 546 πŸ§‘πŸ»β€πŸš€ - Cadet

    yes:

    protected function getApplicationPlugins(): array
        {
            $applicationPlugins = [
                new TwigApplicationPlugin(),
                new EventDispatcherApplicationPlugin(),
                new ShopApplicationApplicationPlugin(),
                new StoreApplicationPlugin(),
                new LocaleApplicationPlugin(),
                new TranslatorApplicationPlugin(),
                new RouterApplicationPlugin(),
                new SessionApplicationPlugin(),
                new HttpApplicationPlugin(),
                new ErrorHandlerApplicationPlugin(),
                new FlashMessengerApplicationPlugin(),
                new FormApplicationPlugin(),
                new ValidatorApplicationPlugin(),
                new SecurityApplicationPlugin(),
                new ShopContextApplicationPlugin(),
                new CustomerConfirmationUserCheckerApplicationPlugin(),
            ];
    
  • UK5DS29L2
    UK5DS29L2 Posts: 546 πŸ§‘πŸ»β€πŸš€ - Cadet

    from what I understand providers are from
    \Spryker\Yves\Security\Plugin\Application\SecurityApplicationPlugin::getFirewallMap
    but what is this referring to?

  • UK5DS29L2
    UK5DS29L2 Posts: 546 πŸ§‘πŸ»β€πŸš€ - Cadet
    $securityAuthenticationProviders = array_map(function ($provider) use ($container) {
                return $container->get($provider);
            }, array_unique($providers));
    
            $container->set(static::SERVICE_SECURITY_AUTHENTICATION_PROVIDERS, $securityAuthenticationProviders);
    

    how to check If i have this set "correctly" ?

  • U013EK8RD7A
    U013EK8RD7A Posts: 127 πŸ§‘πŸ»β€πŸš€ - Cadet

    put a breakpoint and debug?

  • UK5DS29L2
    UK5DS29L2 Posts: 546 πŸ§‘πŸ»β€πŸš€ - Cadet

    I'm afraid I need a "correct" reference to see if what I'm getting is correct

  • UK5DS29L2
    UK5DS29L2 Posts: 546 πŸ§‘πŸ»β€πŸš€ - Cadet

    right now I have nothing to compare this to, and it might be I'm missing some config I cannot find

  • U013EK8RD7A
    U013EK8RD7A Posts: 127 πŸ§‘πŸ»β€πŸš€ - Cadet

    I’d say drop a breakpoint in the place where it should be set, then where it should be retrevied

  • U013EK8RD7A
    U013EK8RD7A Posts: 127 πŸ§‘πŸ»β€πŸš€ - Cadet
    edited January 2021

    you’ll then know if both places work, and the config parameter is filled

  • U013EK8RD7A
    U013EK8RD7A Posts: 127 πŸ§‘πŸ»β€πŸš€ - Cadet

    but it’s very funny

  • U013EK8RD7A
    U013EK8RD7A Posts: 127 πŸ§‘πŸ»β€πŸš€ - Cadet

    because if you’d look here

  • U013EK8RD7A
    U013EK8RD7A Posts: 127 πŸ§‘πŸ»β€πŸš€ - Cadet

    \Spryker\Yves\Security\Plugin\Application\SecurityApplicationPlugin::provide

  • U013EK8RD7A
    U013EK8RD7A Posts: 127 πŸ§‘πŸ»β€πŸš€ - Cadet

    the method in which it is used is:

  • U013EK8RD7A
    U013EK8RD7A Posts: 127 πŸ§‘πŸ»β€πŸš€ - Cadet
    $container = $this->addAuthenticationManager($container);
    
  • U013EK8RD7A
    U013EK8RD7A Posts: 127 πŸ§‘πŸ»β€πŸš€ - Cadet

    and the method where it set is:

  • U013EK8RD7A
    U013EK8RD7A Posts: 127 πŸ§‘πŸ»β€πŸš€ - Cadet
    $container = $this->addFirewall($container);
    
  • U013EK8RD7A
    U013EK8RD7A Posts: 127 πŸ§‘πŸ»β€πŸš€ - Cadet

    and it is executed afterwads 🀷

  • UK5DS29L2
    UK5DS29L2 Posts: 546 πŸ§‘πŸ»β€πŸš€ - Cadet

    can you maybe check and tell me if

    Error: Class 'Spryker\Zed\SecuritySystemUser\Communication\Plugin\Security\SystemUserSecurityPlugin' not found in file /src/Pyz/Zed/Security/SecurityDependencyProvider.php on line 26
    

    you maybe have this file?

  • UK5DS29L2
    UK5DS29L2 Posts: 546 πŸ§‘πŸ»β€πŸš€ - Cadet

    ah ok, so this was indeed missing in zed all along

  • U013EK8RD7A
    U013EK8RD7A Posts: 127 πŸ§‘πŸ»β€πŸš€ - Cadet

    I don’t have this file

  • U013EK8RD7A
    U013EK8RD7A Posts: 127 πŸ§‘πŸ»β€πŸš€ - Cadet

    but it’s also not there in the array

  • UK5DS29L2
    UK5DS29L2 Posts: 546 πŸ§‘πŸ»β€πŸš€ - Cadet

    yeah, most likely some leftover from the upgrade

  • UK5DS29L2
    UK5DS29L2 Posts: 546 πŸ§‘πŸ»β€πŸš€ - Cadet

    ok I can add

                new SecurityApplicationPlugin(),
    to 
    

    \Pyz\Zed\Application\ApplicationDependencyProvider
    to get rid of

    The requested service "security.authentication_providers" was not found in the container!
    

    but this gives me

    InvalidArgumentException: You must at least add one authentication provider. in file vendor/symfony/security-core/Authentication/AuthenticationProviderManager.php on line 51
    

    so I guess there's more to it πŸ˜•

  • giovanni.piemontese
    giovanni.piemontese Technical Lead @ LΓΆffelhardt Spryker Solution Partner Posts: 871 πŸ§‘πŸ»β€πŸš€ - Cadet

    I think is missing security-gui in your project...
    auth bundle is deprecated and replaced from security and security-gui bundles

    securityDependencyProvider should be so;:

    class SecurityDependencyProvider extends SprykerSecurityDependencyProvider
    {
        /**
         * @return \Spryker\Shared\SecurityExtension\Dependency\Plugin\SecurityPluginInterface[]
         */
        protected function getSecurityPlugins(): array
        {
            return [
                new UserSessionHandlerSecurityPlugin(),
                new SystemUserSecurityPlugin(),
                new MerchantUserSecurityPlugin(),
                new UserSecurityPlugin(),
            ];
        }
    }
    

    and u have to register the new security application plugin
    Spryker\Zed\Security\Communication\Plugin\Application\SecurityApplicationPlugin in \Pyz\Zed\Application\ApplicationDependencyProvider::getApplicationPlugins and Spryker\Yves\Security\Plugin\Application\SecurityApplicationPlugin in \Pyz\Yves\ShopApplication\ShopApplicationDependencyProvider::getApplicationPlugins

  • Stanislav Matveyev
    Stanislav Matveyev Tech Lead @ Spryker Sprykee Posts: 211 πŸ§‘πŸ»β€πŸš€ - Cadet
    MerchantUserSecurityPlugin
    

    is needed only if you want to use merchant user login into Merchant Portal.

    SystemUserSecurityPlugin
    

    is for ZedRequests from Yves/Glue to Zed

    UserSecurityPlugin
    

    For regular admin users to login into Zed Backoffice

    Important thing here is you need to have symfony/security-http v4 || v5