超级管理员 / auth-bundle
使用ApiPlatform和JWT的SuperAdmin Bundle
v1.4.1
2021-10-14 11:51 UTC
Requires
- php: >=7.1
- ext-ctype: *
- ext-iconv: *
- ext-json: *
- doctrine/doctrine-bundle: ^2.2
- lexik/jwt-authentication-bundle: ^2.10
- symfony/framework-bundle: ^3.4|^4.0|^5.0
- symfony/security-bundle: ^3.4|^4.0|^5.0
Requires (Dev)
- symfony/browser-kit: ^3.4|^4.0|^5.0
- symfony/console: ^3.4|^4.0|^5.0
- symfony/dom-crawler: ^3.4|^4.0|^5.0
- symfony/phpunit-bridge: ^3.4|^4.0|^5.0
- symfony/var-dumper: ^3.4|^4.0|^5.0
- symfony/yaml: ^3.4|^4.0|^5.0
Conflicts
- dev-main
- v1.4.1
- v1.3.22
- v1.3.21
- v1.3.19
- v1.3.18
- 1.3.17
- v1.3.16
- v1.3.15
- v1.3.14
- v1.3.13
- v1.3.12
- v1.3.11
- v1.3.10
- v1.3.9
- v1.3.8
- v1.3.7
- v1.3.6
- v1.3.5
- v1.3.4
- v1.3.3
- v1.3.2
- v1.3.1
- v1.3.0
- v1.2.15
- v1.2.14
- v1.2.13
- v1.2.12
- v1.2.11
- v1.2.10
- v1.2.9
- v1.2.8
- v1.2.7
- v1.2.6
- v1.2.5
- v1.2.4
- v1.2.3
- v1.2.2
- v1.2.1
- v1.2.0
- v1.1.2
- v1.1.1
- v1.1.0
- v1.0.2
- v1.0.1
- v1.0.0
This package is auto-updated.
Last update: 2024-09-14 18:09:52 UTC
README
此包提供了与 Symfony 的简单集成,用于 SuperAdmin API。
您可以选择启动自己的 SuperAdmin 服务器 或者免费使用托管服务。
安装
从此包的 ~1.0
版本开始,只提供了实现类,配置和依赖项管理必须由用户完成(在此处文档化)。在未来的版本中,它将在包安装时自动完成。
依赖关系
composer require lexik/jwt-authentication-bundle
通过composer安装
composer require superadmin/auth-bundle ~1.0
配置
安装后,您必须将以下设置添加到您的配置文件中
# File config/packages/security.yaml security: access_decision_manager: strategy: unanimous allow_if_all_abstain: false # https://symfony.com.cn/doc/current/security.html#where-do-users-come-from-user-providers providers: jwt: lexik_jwt: class: SuperAdmin\Bundle\Security\User firewalls: dev: pattern: ^/(_(profiler|wdt)|css|images|js)/ security: false main: pattern: ^/ stateless: true anonymous: true provider: jwt guard: authenticators: - lexik_jwt_authentication.jwt_token_authenticator - SuperAdmin\Bundle\Security\Authenticator\ApiKeyAuthenticator entry_point: lexik_jwt_authentication.jwt_token_authenticator # activate different ways to authenticate # https://symfony.com.cn/doc/current/security.html#firewalls-authentication # https://symfony.com.cn/doc/current/security/impersonating_user.html # switch_user: true # Easy way to control access for large sections of your site # Note: Only the *first* access control that matches will be used access_control: - { path: ^/docs, roles: IS_AUTHENTICATED_ANONYMOUSLY } - { path: ^/public, roles: IS_AUTHENTICATED_ANONYMOUSLY } - { path: ^/sadmin, roles: ROLE_SUPER_ADMIN } - { path: ^/admin, roles: ROLE_ADMIN } - { path: ^/, roles: ROLE_USER }
# File config/services.yaml services: # here your original configurations # ... SuperAdmin\Bundle\Security\Authenticator\ApiKeyAuthenticator: arguments: [ '@doctrine.orm.entity_manager'] SuperAdmin\Bundle\Security\Serializer\ContextBuilder: decorates: 'api_platform.serializer.context_builder' arguments: [ '@SuperAdmin\Bundle\Security\Serializer\ContextBuilder.inner' ] autoconfigure: false SuperAdmin\Bundle\EventListener\OwnedFilterConfigurator: tags: - { name: kernel.event_listener, event: kernel.request, priority: 5 } # Autoconfiguration must be disabled to set a custom priority autoconfigure: false
# File config/packages/doctrine.yaml doctrine: dbal: url: '%env(resolve:DATABASE_URL)%' # IMPORTANT: You MUST configure your server version, # either here or in the DATABASE_URL env var (see .env file) #server_version: '5.7' orm: auto_generate_proxy_classes: true naming_strategy: doctrine.orm.naming_strategy.underscore_number_aware auto_mapping: true mappings: App: is_bundle: false type: annotation dir: '%kernel.project_dir%/src/Entity' prefix: 'App\Entity' alias: App filters: owned_filter: class: SuperAdmin\Bundle\Filter\OwnedFilter