Home
Docs
GitHub
Pricing
Blog
Log In

Run Sandworm Audit for your App

Get started
Hold on, we're currently generating a fresh version of this report
Generated on May 9, 2024 via composer

symfony/security-core v7.0.3

Symfony Security Component - Core Library
Package summary
Share
0
issues
1
license
7
MIT
Package created
18 Sep 2013
Version published
23 Jan 2024
Maintainers
1
Total deps
7
Direct deps
4
License
MIT

Issues

0
This package has no issues

Licenses

MIT License

Permissive
OSI Approved
This is a human-readable summary of (and not a substitute for) the license. Disclaimer.
Can
commercial-use
modify
distribute
sublicense
private-use
Cannot
hold-liable
Must
include-copyright
include-license
7 Packages, Including:
psr/container@2.0.2
psr/event-dispatcher@1.0.0
symfony/deprecation-contracts@v3.5.0
symfony/event-dispatcher-contracts@v3.5.0
symfony/password-hasher@v7.0.7
symfony/security-core@v7.0.3
symfony/service-contracts@v3.5.0
Disclaimer

This deed highlights only some of the key features and terms of the actual license. It is not a license and has no legal value. You should carefully review all of the terms and conditions of the actual license before using the licensed material.

Sandworm is not a law firm and does not provide legal services. Distributing, displaying, or linking to this deed or the license that it summarizes does not create a lawyer-client or any other relationship.

Direct Dependencies

4
All Dependencies CSV
β“˜ This is a list of symfony/security-core 's direct dependencies. Data on all dependencies, including transitive ones, is available via CSV download.
NameVersionSizeLicenseTypeVulnerabilities
psr/container2.0.23.55 kBMIT
prod dev
symfony/event-dispatcher-contractsv3.5.0-MIT
prod
symfony/password-hasherv7.0.7-MIT
prod
symfony/service-contractsv3.5.0-MIT
prod

Visualizations

Frequently Asked Questions

What does symfony/security-core do?

The Symfony Security Component - Core Library, also known as symfony/security-core, provides an infrastructure for creating sophisticated authorization systems. It is a powerful tool which allows the easy separation of user providers that hold user credentials from the actual authorization logic, enhancing security and the manageability of the user roles and authorities within an application.

How do you use symfony/security-core?

To use symfony/security-core in your application, you first need to install it using composer by running $ composer require symfony/security-core in your terminal. Once installed, you can use various classes, such as AuthenticationTrustResolver, AccessDecisionManager, RoleVoter, RoleHierarchyVoter, and others for managing user roles and decisions about user authorizations. For instance, you can check if the authenticated user has the 'ROLE_ADMIN' using the AccessDecisionManager and throw an AccessDeniedException if they don't. Here is a code snippet:

use Symfony\Component\Security\Core\Authentication\AuthenticationTrustResolver;
use Symfony\Component\Security\Core\Authentication\Token\UsernamePasswordToken;
use Symfony\Component\Security\Core\Authorization\AccessDecisionManager;
use Symfony\Component\Security\Core\Authorization\Voter\AuthenticatedVoter;
use Symfony\Component\Security\Core\Authorization\Voter\RoleVoter;
use Symfony\Component\Security\Core\Authorization\Voter\RoleHierarchyVoter;
use Symfony\Component\Security\Core\Exception\AccessDeniedException;
use Symfony\Component\Security\Core\Role\RoleHierarchy;

$accessDecisionManager = new AccessDecisionManager([
    new AuthenticatedVoter(new AuthenticationTrustResolver()),
    new RoleVoter(),
    new RoleHierarchyVoter(new RoleHierarchy([
        'ROLE_ADMIN' => ['ROLE_USER'],
    ]))
]);

$user = new \App\Entity\User(...);
$token = new UsernamePasswordToken($user, 'main', $user->getRoles());

if (!$accessDecisionManager->decide($token, ['ROLE_ADMIN'])) {
    throw new AccessDeniedException();
}

Replace new \App\Entity\User(...); with the actual user entity in your application, and replace 'main' with the appropriate firewall name.

Where are the symfony/security-core docs?

For additional and detailed information on using symfony/security-core, the comprehensive documentation can be accessed at Symfony Documentation. Further contributions and issues can be reported at the main Symfony repository on GitHub. Sound knowledge of this library can be instrumental in building applications with scalable and secure authorization systems.