diff options
author | Ryan Weaver <ryan@thatsquality.com> | 2015-05-17 14:39:26 -0400 |
---|---|---|
committer | Ryan Weaver <ryan@thatsquality.com> | 2015-09-20 19:24:20 -0400 |
commit | e7d6919203ec4e60e71bba1f4c84c9aee0a4c816 (patch) | |
tree | c60a9af360303ca2fac0a7eb553ecdf5dd71709f /Guard/AbstractGuardAuthenticator.php | |
parent | 85fb36d5cc968c432e0f0013d0eaab0c7c9f78c6 (diff) | |
download | symfony-security-e7d6919203ec4e60e71bba1f4c84c9aee0a4c816.zip symfony-security-e7d6919203ec4e60e71bba1f4c84c9aee0a4c816.tar.gz symfony-security-e7d6919203ec4e60e71bba1f4c84c9aee0a4c816.tar.bz2 |
Initial commit (but after some polished work) of the new Guard authentication system
Diffstat (limited to 'Guard/AbstractGuardAuthenticator.php')
-rw-r--r-- | Guard/AbstractGuardAuthenticator.php | 31 |
1 files changed, 31 insertions, 0 deletions
diff --git a/Guard/AbstractGuardAuthenticator.php b/Guard/AbstractGuardAuthenticator.php new file mode 100644 index 0000000..ebd09bb --- /dev/null +++ b/Guard/AbstractGuardAuthenticator.php @@ -0,0 +1,31 @@ +<?php + +namespace Symfony\Component\Security\Guard; + +use Symfony\Component\Security\Core\User\UserInterface; +use Symfony\Component\Security\Guard\Token\GenericGuardToken; + +/** + * An optional base class that creates a GenericGuardToken for you + * + * @author Ryan Weaver <weaverryan@gmail.com> + */ +abstract class AbstractGuardAuthenticator implements GuardAuthenticatorInterface +{ + /** + * Shortcut to create a GenericGuardToken for you, if you don't really + * care about which authenticated token you're using + * + * @param UserInterface $user + * @param string $providerKey + * @return GenericGuardToken + */ + public function createAuthenticatedToken(UserInterface $user, $providerKey) + { + return new GenericGuardToken( + $user, + $providerKey, + $user->getRoles() + ); + } +}
\ No newline at end of file |