指尖上的记忆指尖上的记忆
首页
  • 基础
  • Laravel框架
  • Symfony框架
  • 基础
  • Gin框架
  • 基础
  • Spring框架
  • 命令
  • Nginx
  • Ai
  • Deploy
  • Docker
  • K8s
  • Micro
  • RabbitMQ
  • Mysql
  • PostgreSsql
  • Redis
  • MongoDb
  • Html
  • Js
  • 前端
  • 后端
  • Git
  • 知识扫盲
  • Golang
🌟 gitHub
首页
  • 基础
  • Laravel框架
  • Symfony框架
  • 基础
  • Gin框架
  • 基础
  • Spring框架
  • 命令
  • Nginx
  • Ai
  • Deploy
  • Docker
  • K8s
  • Micro
  • RabbitMQ
  • Mysql
  • PostgreSsql
  • Redis
  • MongoDb
  • Html
  • Js
  • 前端
  • 后端
  • Git
  • 知识扫盲
  • Golang
🌟 gitHub

通过如下命令即可实现: ①查看config/packages下所有bundle的配置文件格式

php bin/console config:dump-reference

====================================================================

 --------------------------------------- -------------------------------------- 
  Bundle name                             Extension alias                       
 --------------------------------------- -------------------------------------- 
  DebugBundle                             debug                                 
  DoctrineBundle                          doctrine                              
  DoctrineMigrationsBundle                doctrine_migrations                   
  FrameworkBundle                         framework                             
  KnpPaginatorBundle                      knp_paginator                         
  KrtvSingleSignOnServiceProviderBundle   krtv_single_sign_on_service_provider  
  LiipImagineBundle                       liip_imagine                          
  MDPICommonBundle                                                              
  MakerBundle                             maker                                 
  MonologBundle                           monolog                               
  SecurityBundle                          security                              
  SensioFrameworkExtraBundle              sensio_framework_extra                
  SymfonyCastsVerifyEmailBundle           symfonycasts_verify_email             
  TwigBundle                              twig                                  
  TwigExtraBundle                         twig_extra                            
  WebProfilerBundle                       web_profiler                          
  WebpackEncoreBundle                     webpack_encore                        
 --------------------------------------- -------------------------------------- 

 // Provide the name of a bundle as the first argument of this command to dump its default configuration. (e.g.         
 // config:dump-reference FrameworkBundle)                                                                              
 //                                                                                                                     
 // For dumping a specific option, add its path as the second argument of this command. (e.g. config:dump-reference     
 // FrameworkBundle profiler.matcher to dump the framework.profiler.matcher configuration)  

②查看security的默认配置格式

php bin/console config:dump-reference security
...
...
...

③查看security在项目中的实际配置

php bin/console debug:config security

Current configuration for extension with alias "security"
=========================================================

security:
    enable_authenticator_manager: false
    password_hashers:
        App\Entity\User:
            algorithm: bcrypt
            cost: 4
            migrate_from: {  }
            hash_algorithm: sha512
            key_length: 40
            ignore_case: false
            encode_as_base64: true
            iterations: 5000
            memory_cost: null
            time_cost: null
    providers:
        main:
            entity:
                class: App\Entity\User
                property: email
                manager_name: null
        users_in_memory:
            memory:
                users: {  }
    firewalls:
        dev:
            pattern: ^/(_(profiler|wdt)|css|images|js)/
            security: false
            methods: {  }
            user_checker: security.user_checker
            stateless: false
            lazy: false
            required_badges: {  }
        main:
            lazy: true
            pattern: ^/
            provider: main
            sso:
                require_previous_session: false
                provider: main
                check_path: /otp/validate/
                sso_scheme: '%env(IDP_SCHEME)%'
                sso_host: '%env(IDP_URL)%'
                sso_otp_scheme: '%env(ACADEMY_SCHEME)%'
                sso_otp_host: '%env(ACADEMY_DOMAIN)%'
                sso_failure_path: /login
                sso_path: /sso/login/
                sso_service: '%env(SSO_SERVICE)%'
                success_handler: App\Security\LoginSuccessHandler
                remember_me: true
                use_forward: false
                login_path: /login
                sso_service_parameter: service
                sso_service_extra: {  }
                sso_service_extra_parameter: service_extra
                sso_login_required: 1
                sso_login_required_parameter: login_required
                always_use_default_target_path: false
                default_target_path: /
                target_path_parameter: _target_path
                use_referer: false
                failure_path: null
                failure_forward: false
                failure_path_parameter: _failure_path
            logout:
                invalidate_session: true
                path: /logout
                csrf_parameter: _csrf_token
                csrf_token_id: logout
                target: /
                delete_cookies: {  }
                handlers: {  }
            security: true
            anonymous:
                lazy: false
                secret: null
            methods: {  }
            user_checker: security.user_checker
            stateless: false
            required_badges: {  }
    access_control:
        -
            path: ^/admin
            roles:
                - ROLE_ADMIN
            requires_channel: null
            host: null
            port: null
            ips: {  }
            methods: {  }
            allow_if: null
        -
            path: '/.*'
            roles:
                - PUBLIC_ACCESS
            requires_channel: null
            host: null
            port: null
            ips: {  }
            methods: {  }
            allow_if: null
    encoders:
        App\Entity\User:
            algorithm: bcrypt
            cost: 4
            migrate_from: {  }
            hash_algorithm: sha512
            key_length: 40
            ignore_case: false
            encode_as_base64: true
            iterations: 5000
            memory_cost: null
            time_cost: null
    access_denied_url: null
    session_fixation_strategy: migrate
    hide_user_not_found: true
    always_authenticate_before_granting: false
    erase_credentials: true
    access_decision_manager:
        allow_if_all_abstain: false
        allow_if_equal_granted_denied: true
    role_hierarchy: {  }
    
//关于security的源码:https://github.com/symfony/symfony/blob/6.2/src/Symfony/Bundle/SecurityBundle/Security.php

查看symfony版本:

php bin/console --version

或者

php bin/console about

 -------------------- -------------------------------------------- 
  Symfony                                                          
 -------------------- -------------------------------------------- 
  Version              5.4.15                                      
  Long-Term Support    Yes                                         
  End of maintenance   11/2024 (in +582 days)                      
  End of life          11/2025 (in +947 days)                      
 -------------------- -------------------------------------------- 
  Kernel                                                           
 -------------------- -------------------------------------------- 
  Type                 App\Kernel                                  
  Environment          dev                                         
  Debug                true                                        
  Charset              UTF-8                                       
  Cache directory      ./var/cache/dev (3.9 GiB)                   
  Build directory      ./var/cache/dev (3.9 GiB)                   
  Log directory        ./var/log (475.5 MiB)                       
 -------------------- -------------------------------------------- 
  PHP                                                              
 -------------------- -------------------------------------------- 
  Version              8.1.2-1ubuntu2.11                           
  Architecture         64 bits                                     
  Intl locale          n/a                                         
  Timezone             Asia/Chongqing (2023-04-28T11:31:14+08:00)  
  OPcache              true                                        
  APCu                 false                                       
  Xdebug               false                                       
 -------------------- --------------------------------------------