PHPackages                             cooolinho/symfony-security-bundle - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Security](/categories/security)
4. /
5. cooolinho/symfony-security-bundle

ActiveSymfony-bundle[Security](/categories/security)

cooolinho/symfony-security-bundle
=================================

test reusable bundle

5.4.1(4y ago)188GPL-2.0-onlyPHPPHP &gt;=7.4

Since Mar 17Pushed 3y ago1 watchersCompare

[ Source](https://github.com/cooolinho/symfony-security-bundle)[ Packagist](https://packagist.org/packages/cooolinho/symfony-security-bundle)[ RSS](/packages/cooolinho-symfony-security-bundle/feed)WikiDiscussions main Synced today

READMEChangelogDependencies (12)Versions (33)Used By (0)

symfony-security-bundle
=======================

[](#symfony-security-bundle)

Setup
-----

[](#setup)

### Install via composer

[](#install-via-composer)

`composer install cooolinho/symfony-security-bundle`

### update .env

[](#update-env)

```
MAILER_DSN=smtp://user:pass@smtp.example.com:port

```

### update security.yml

[](#update-securityyml)

#### add to encoders

[](#add-to-encoders)

```
security:
    encoders:
        ...
        Cooolinho\Bundle\SecurityBundle\Entity\User:
            algorithm: auto

```

#### use in provider

[](#use-in-provider)

```
security:
    providers:
        ...
        my_custom_provider:
            entity:
                class: Cooolinho\Bundle\SecurityBundle\Entity\User
                property: email | username

```

#### update firewall

[](#update-firewall)

```
security:
    firewalls:
        ...
        secured_admin_area:
            provider: my_custom_provider
            user_checker: Cooolinho\Bundle\SecurityBundle\Security\UserChecker
            custom_authenticator:
                - Cooolinho\Bundle\SecurityBundle\Security\SecurityAuthenticator
            logout:
                path: app_logout
                target: app_login

```

#### add role hierarchy

[](#add-role-hierarchy)

```
role_hierarchy:
    ROLE_SUPER_ADMIN: [ ROLE_ADMIN, ROLE_ALLOWED_TO_SWITCH ]
    ROLE_ADMIN: ROLE_USER

```

#### add access control

[](#add-access-control)

```
access_control:
    - { path: ^/login, roles: PUBLIC_ACCESS }
    - { path: ^/logout, roles: PUBLIC_ACCESS }
    - { path: ^/admin, roles: ROLE_ADMIN }

```

### add cooolinho\_security.yaml to config/packages

[](#add-cooolinho_securityyaml-to-configpackages)

```
cooolinho_security:
    route_after_login: # REQUIRED
    user_class: # REQUIRED
    registration_enabled: false # optional
    route_login: app_login # optional
    route_logout: app_logout # optional
    mailer_from: test@localhost # optional
    mailer_name: Localhost Mailbot # optional
    login_provider_property: email # optional

```

### ResetPassword Setup

[](#resetpassword-setup)

First you have to create two classes: App\\Entity\\ResetPasswordRequest and App\\Repository\\ResetPasswordRequestRepository

#### App\\Entity\\ResetPasswordRequest

[](#appentityresetpasswordrequest)

```
