Uh oh!
There was an error while loading.Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork33
Symfony Security Component - Core Library
License
symfony/security-core
Folders and files
| Name | Name | Last commit message | Last commit date | |
|---|---|---|---|---|
Repository files navigation
Security provides an infrastructure for sophisticated authorization systems,which makes it possible to easily separate the actual authorization logic fromso called user providers that hold the users credentials.
composer require symfony/security-core
useSymfony\Component\Security\Core\Authentication\AuthenticationTrustResolver;useSymfony\Component\Security\Core\Authentication\Token\UsernamePasswordToken;useSymfony\Component\Security\Core\Authorization\AccessDecisionManager;useSymfony\Component\Security\Core\Authorization\Voter\AuthenticatedVoter;useSymfony\Component\Security\Core\Authorization\Voter\RoleVoter;useSymfony\Component\Security\Core\Authorization\Voter\RoleHierarchyVoter;useSymfony\Component\Security\Core\Exception\AccessDeniedException;useSymfony\Component\Security\Core\Role\RoleHierarchy;$accessDecisionManager =newAccessDecisionManager([newAuthenticatedVoter(newAuthenticationTrustResolver()),newRoleVoter(),newRoleHierarchyVoter(newRoleHierarchy(['ROLE_ADMIN' => ['ROLE_USER'], ]))]);$user =new \App\Entity\User(...);$token =newUsernamePasswordToken($user,'main',$user->getRoles());if (!$accessDecisionManager->decide($token, ['ROLE_ADMIN'])) {thrownewAccessDeniedException();}
The Security component for Symfony 7.1 isbacked bySymfonyCasts.
Learn Symfony faster by watching real projects being built and actively codingalong with them. SymfonyCasts bridges that learning gap, bringing you videotutorials and coding challenges. Code on!
Help Symfony bysponsoring its development!
About
Symfony Security Component - Core Library
Topics
Resources
License
Code of conduct
Contributing
Security policy
Uh oh!
There was an error while loading.Please reload this page.
Stars
Watchers
Forks
Sponsor this project
Uh oh!
There was an error while loading.Please reload this page.
Packages0
Uh oh!
There was an error while loading.Please reload this page.