Browse Source

added some doc comments

Johannes Schmitt 14 năm trước cách đây
mục cha
commit
139510a78e

+ 21 - 0
src/Symfony/Component/Security/Http/Authentication/AuthenticationFailureHandlerInterface.php

@@ -5,7 +5,28 @@ namespace Symfony\Component\Security\Http\Authentication;
 use Symfony\Component\EventDispatcher\EventInterface;
 use Symfony\Component\HttpFoundation\Request;
 
+/**
+ * Interface for custom authentication failure handlers.
+ *
+ * If you want to customize the failure handling process, instead of
+ * overwriting the respective listener globally, you can set a custom failure
+ * handler which implements this interface.
+ *
+ * @author Johannes M. Schmitt <schmittjoh@gmail.com>
+ */
 interface AuthenticationFailureHandlerInterface
 {
+    /**
+     * This is called when an interactive authentication attempt fails. This is
+     * called by authentication listeners inheriting from
+     * AbstractAuthenticationListener.
+     *
+     * @param EventInterface $event the "core.security" event, this event always
+     *                              has the kernel as target
+     * @param Request        $request
+     * @param \Exception     $exception
+     *
+     * @return Response the response to return
+     */
     function onAuthenticationFailure(EventInterface $event, Request $request, \Exception $exception);
 }

+ 21 - 0
src/Symfony/Component/Security/Http/Authentication/AuthenticationSuccessHandlerInterface.php

@@ -6,7 +6,28 @@ use Symfony\Component\EventDispatcher\EventInterface;
 use Symfony\Component\Security\Core\Authentication\Token\TokenInterface;
 use Symfony\Component\HttpFoundation\Request;
 
+/**
+ * Interface for a custom authentication success handler
+ *
+ * If you want to customize the success handling process, instead of
+ * overwriting the respective listener globally, you can set a custom success
+ * handler which implements this interface.
+ *
+ * @author Johannes M. Schmitt <schmittjoh@gmail.com>
+ */
 interface AuthenticationSuccessHandlerInterface
 {
+    /**
+     * This is called when an interactive authentication attempt succeeds. This
+     * is called by authentication listeners inheriting from
+     * AbstractAuthenticationListener.
+     *
+     * @param EventInterface $event the "core.security" event, this event always
+     *                              has the kernel as target
+     * @param Request        $request
+     * @param TokenInterface $token
+     *
+     * @return Response the response to return
+     */
     function onAuthenticationSuccess(EventInterface $event, Request $request, TokenInterface $token);
 }

+ 3 - 3
src/Symfony/Component/Security/Http/ExceptionTranslation/AccessDeniedHandlerInterface.php

@@ -1,6 +1,6 @@
 <?php
 
-namespace Symfony\Component\Security\Http\ExceptionTranslation;
+namespace Symfony\Component\Security\Http\Authorization;
 
 use Symfony\Component\HttpFoundation\Request;
 use Symfony\Component\EventDispatcher\EventInterface;
@@ -17,8 +17,8 @@ interface AccessDeniedHandlerInterface
     /**
      * Handles an access denied failure.
      *
-     * @param EventInterface $event
-     * @param Request $request
+     * @param EventInterface        $event
+     * @param Request               $request
      * @param AccessDeniedException $accessDeniedException
      *
      * @return Response may return null

+ 1 - 1
src/Symfony/Component/Security/Http/Firewall/ExceptionListener.php

@@ -13,7 +13,7 @@ namespace Symfony\Component\Security\Http\Firewall;
 
 use Symfony\Component\HttpFoundation\Response;
 use Symfony\Bundle\SecurityBundle\Security\AccessDeniedHandler;
-use Symfony\Component\Security\Http\ExceptionTranslation\AccessDeniedHandlerInterface;
+use Symfony\Component\Security\Http\Authorization\AccessDeniedHandlerInterface;
 use Symfony\Component\Security\Core\SecurityContext;
 use Symfony\Component\Security\Core\Authentication\AuthenticationTrustResolverInterface;
 use Symfony\Component\Security\Core\Authentication\EntryPoint\AuthenticationEntryPointInterface;

+ 13 - 0
src/Symfony/Component/Security/Http/Session/SessionAuthenticationStrategy.php

@@ -5,6 +5,16 @@ namespace Symfony\Component\Security\Http\Session;
 use Symfony\Component\Security\Core\Authentication\Token\TokenInterface;
 use Symfony\Component\HttpFoundation\Request;
 
+/**
+ * The default session strategy implementation.
+ *
+ * Supports the following strategies:
+ * NONE: the session is not changed
+ * MIGRATE: the session id is updated, attributes are kept
+ * INVALIDATE: the session id is updated, attributes are lost
+ *
+ * @author Johannes M. Schmitt <schmittjoh@gmail.com>
+ */
 class SessionAuthenticationStrategy implements SessionAuthenticationStrategyInterface
 {
     const NONE         = 'none';
@@ -18,6 +28,9 @@ class SessionAuthenticationStrategy implements SessionAuthenticationStrategyInte
         $this->strategy = $strategy;
     }
 
+    /**
+     * {@inheritDoc}
+     */
     public function onAuthentication(Request $request, TokenInterface $token)
     {
         switch ($this->strategy) {

+ 19 - 0
src/Symfony/Component/Security/Http/Session/SessionAuthenticationStrategyInterface.php

@@ -5,7 +5,26 @@ namespace Symfony\Component\Security\Http\Session;
 use Symfony\Component\Security\Core\Authentication\Token\TokenInterface;
 use Symfony\Component\HttpFoundation\Request;
 
+/**
+ * SessionAuthenticationStrategyInterface
+ *
+ * Implementation are responsible for updating the session after an interactive
+ * authentication attempt was successful.
+ *
+ * @author Johannes M. Schmitt <schmittjoh@gmail.com>
+ */
 interface SessionAuthenticationStrategyInterface
 {
+    /**
+     * This performs any necessary changes to the session.
+     *
+     * This method is called before the SecurityContext is populated with a
+     * Token, and only by classes inheriting from AbstractAuthenticationListener.
+     *
+     * @param Request        $request
+     * @param TokenInterface $token
+     *
+     * @return void
+     */
     function onAuthentication(Request $request, TokenInterface $token);
 }