E1.19 Php Symfony Security: deployment steps (Wpf, Xamarin, Angular SPA, Reactjs SPA) - chempkovsky/CS2WPF-and-CS2XAMARIN GitHub Wiki

  1. Step
  • Under Symfony project install additional bundles.
  1. Step
  • Under Symfony project create User-class with a special name
  1. Step
  • with #4 Wpf Forms Wizard generate Entity Framework (EF) classes and context
    • We have already discussed that EF classes is not a coding tool. They are part of a modeling tool.
  1. Step
  • with #2 ModelView Wizard import viewModel definitions for each Entitiy of the step 3
    • This is the most time consuming part of the deployment process. Other steps will take a few minutes of time.
  1. Step
  • with #4 Wpf Forms Wizard execute batch to generate php deployment entities (they will be used only to create database tables)
  1. Step
  • Under Symfony project configure Doctrine connection for deployment entities
  1. Step
  • Under Symfony project create database tables
  1. Step
  • with #4 Wpf Forms Wizard execute batch to generate production entities.
    • It will replace "User"-class of step #2.
  1. Step
  • with #4 Wpf Forms Wizard execute batch to generate Auth helper classes.
    • These classes will be used by login controller.
  1. Step
  • with #4 Wpf Forms Wizard execute batch to generate Security controllers and Authenticator.
    • At the begining of each generated file you will find an instructions of how to configure Doctrine connection for production
  1. Step
  • Under Symfony project configure Doctrine connection for production
  1. Step
  • Under Symfony project configure security.yaml
    • configurations for register/login/change password/logout and Authenticator

Note:

Symfony offers several approaches to securing microservices using roles. The developer must decide which one to use in his project. But very first step is to define the names for the roles. Generated code does not expect any names except "ROLE_USER".

    public function getRoles(): array
    {
        $roles = $this->roles;
        // guarantee every user at least has ROLE_USER
        $roles[] = 'ROLE_USER';

        return array_unique($roles);
    }