RunAsManagerInterface.php 1.8KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657
  1. <?php
  2. /*
  3. * Copyright 2010 Johannes M. Schmitt <schmittjoh@gmail.com>
  4. *
  5. * Licensed under the Apache License, Version 2.0 (the "License");
  6. * you may not use this file except in compliance with the License.
  7. * You may obtain a copy of the License at
  8. *
  9. * http://www.apache.org/licenses/LICENSE-2.0
  10. *
  11. * Unless required by applicable law or agreed to in writing, software
  12. * distributed under the License is distributed on an "AS IS" BASIS,
  13. * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  14. * See the License for the specific language governing permissions and
  15. * limitations under the License.
  16. */
  17. namespace JMS\SecurityExtraBundle\Security\Authorization;
  18. use Symfony\Component\Security\Core\Authentication\Token\TokenInterface;
  19. /**
  20. * RunAsManagerInterface
  21. *
  22. * @author Johannes M. Schmitt <schmittjoh@gmail.com>
  23. */
  24. interface RunAsManagerInterface
  25. {
  26. /**
  27. * Creates a temporary RunAsToken.
  28. *
  29. * The returned Token must have a complementing AuthenticationProvider implementation.
  30. *
  31. * @param TokenInterface $token the original Token
  32. * @param object $secureObject the secure object which caused this call
  33. * @param array $attributes an array of attributes to apply to the built token
  34. * @return TokenInterface
  35. */
  36. function buildRunAs(TokenInterface $token, $secureObject, array $attributes);
  37. /**
  38. * Whether this RunAsManager supports the given attribute
  39. *
  40. * @param string $attribute
  41. * @return Boolean
  42. */
  43. function supportsAttribute($attribute);
  44. /**
  45. * Whether this RunAsManager supports the given class.
  46. *
  47. * @param string $className The class of the secure object which requests RunAs capabilities
  48. * @return Boolean
  49. */
  50. function supportsClass($className);
  51. }