Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Symfony Security Component - Core Library

License

NotificationsYou must be signed in to change notification settings

symfony/security-core

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.

Getting Started

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();}

Sponsor

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!

Resources

About

Symfony Security Component - Core Library

Topics

Resources

License

Code of conduct

Contributing

Security policy

Stars

Watchers

Forks

Packages

No packages published

Contributors286

Languages


[8]ページ先頭

©2009-2025 Movatter.jp