ics/ssi-bundle
Composer 安装命令:
composer require ics/ssi-bundle
包简介
Bundle security extention
README 文档
README
Symfony bundle for extend security and logging
Installation
Make sure Composer is installed globally, as explained in the installation chapter of the Composer documentation.
Applications that use Symfony Flex
Open a command console, enter your project directory and execute:
composer require ics/ssi-bundle
Applications that don't use Symfony Flex
Step 1: Download the Bundle
Open a command console, enter your project directory and execute the following command to download the latest stable version of this bundle:
$ composer require ics/ssi-bundle
Step 2: Enable the Bundle
Then, enable the bundle by adding it to the list of registered bundles
in the config/bundles.php file of your project:
// config/bundles.php return [ // ... ICS\SsiBundle\SsiBundle::class => ['all' => true], ];
Step 3: Adding bundle routing
Add routes in applications config/routes.yaml
# config/routes.yaml # ... ssi_bundle: resource: '@SsiBundle/config/routes.yaml' prefix: /ssi # ...
Step 4: Install Database
For install database :
# Installer la base de données
php bin/console doctrine:schema:create
For update database :
# Mise a jour la base de données
php bin/console doctrine:schema:update -f
Adding bundle to EasyAdmin
Step 1: Add entities to dashboard
Add this MenuItems in your dashboard Controller/Admin/DashboardController.php
// Controller/Admin/DashboardController.php use ICS\SsiBundle\Entity\Account; use ICS\SsiBundle\Entity\Log; class DashboardController extends AbstractDashboardController { public function configureMenuItems(): iterable { // ... yield MenuItem::section('Security', 'fa fa-shield'); yield MenuItem::linkToCrud('Accounts', 'fa fa-user-circle', Account::class); yield MenuItem::linkToCrud('Logs', 'fa fa-newspaper', Log::class); // ... } }
Step 2: Add twig widgets to dashboard
{# templates/admin/dashboard.html.twig #} {% extends "@EasyAdmin/page/content.html.twig" %} {% block page_content %} {% include "@Ssi/admin/logs.html.twig" %} {% endblock %}
Install bundle fixtures
# Every data in database will destruct
php bin/console doctrine:fixture:load
The Passwords for created users are :
- admin :
adminPassword - user[1~10] :
userPassword
Log Entity
For log an entity just add @Log Annotation on entity declaration
you must define the actions and property properties
value for actions can :
- "add" On add entity in database
- "update" On update entity in database
- "delete" On delete entity in database
- "all" On all action of entity in database
for property make a property than return the log message you want
use Doctrine\ORM\Mapping as ORM; use ICS\SsiBundle\Annotation\Log; /** * @ORM\Entity() * @ORM\Table() * @Log(actions={"all"},property="logMessage") */ class Account implements UserInterface { /** * @ORM\Column(type="string", length=180, unique=true) */ private $username; public function getLogMessage() { return $this->username.' (#'.$this->getId().')'; } }
Configure keycloak authentification
For enabled a keycloak authentification add this lines in .env file :
#Keycloak configuration KEYCLOAK_URL="<url of keycloak server>" KEYCLOAK_REALM="<realm for keycloak>" KEYCLOAK_CLIENT_ID="<client_id of keycloak server>" KEYCLOAK_CLIENT_SECRET="<secret of client_id"
you can enabled keycloak user auto creation :
# config/packages/ssi.yaml ssi: keycloak: auto_create_user: true
by default unknow user as ignored.
Configure Active Directory authentification
For enabled a Active Directory authentification add this lines in .env file :
#Keycloak configuration ACTIVE_DIRECTORY_HOST="<Active Directory domain controller IP or DNS name>" ACTIVE_DIRECTORY_BASEDN="<User base DN (dc=example,dc=com)>" ACTIVE_DIRECTORY_DOMAIN="<Active Directory short domain name>"
you can enabled Active Directory user auto creation :
# config/packages/ssi.yaml ssi: active_directory: auto_create_user: true
by default unknow user as ignored.
ics/ssi-bundle 适用场景与选型建议
ics/ssi-bundle 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 197 次下载、GitHub Stars 达 3, 最近一次更新时间为 2021 年 03 月 28 日, 在 PHP 生态内属于活跃度较高的组件。
我们在过去多个企业项目中使用过 ics/ssi-bundle 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 ics/ssi-bundle 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
统计信息
- 总下载量: 197
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 3
- 点击次数: 1
- 依赖项目数: 2
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2021-03-28