PHP Class Neos\Flow\Security\Authentication\Controller\AbstractAuthenticationController

Inheritance: extends Neos\Flow\Mvc\Controller\ActionController
Exibir arquivo Open project: neos/flow-development-collection Class Usage Examples

Protected Properties

Property Type Description
$authenticationManager Neos\Flow\Security\Authentication\AuthenticationManagerInterface
$securityContext Neos\Flow\Security\Context

Public Methods

Method Description
authenticateAction ( ) : string Calls the authentication manager to authenticate all active tokens and redirects to the original intercepted request on success if there is one stored in the security context. If no intercepted request is found, the function simply returns.
loginAction ( ) : void This action is used to show the login form. To make this work in your package simply create a template for this action, which could look like this in the simplest case:
logoutAction ( ) : void Logs all active tokens out. Override this, if you want to have some custom action here. You can always call the parent method to do the actual logout.

Protected Methods

Method Description
getErrorFlashMessage ( ) : Neos\Error\Messages\Error A template method for displaying custom error flash messages, or to display no flash message at all on errors. Override this to customize the flash message in your action controller.
onAuthenticationFailure ( AuthenticationRequiredException $exception = null ) : void Is called if authentication failed.
onAuthenticationSuccess ( ActionRequest $originalRequest = null ) : string Is called if authentication was successful. If there has been an intercepted request due to security restrictions, you might want to use something like the following code to restart the originally intercepted request:

Method Details

authenticateAction() public method

If authentication fails, the result of calling the defined $errorMethodName is returned. Note: Usually there is no need to override this action. You should use the according callback methods instead (onAuthenticationSuccess() and onAuthenticationFailure()).
public authenticateAction ( ) : string
return string

getErrorFlashMessage() protected method

Note: If you implement a nice redirect in the onAuthenticationFailure() method of you login controller, this message should never be displayed.
protected getErrorFlashMessage ( ) : Neos\Error\Messages\Error
return Neos\Error\Messages\Error The flash message

loginAction() public method

Note: This example is designed to serve the "UsernamePassword" token.
public loginAction ( ) : void
return void

logoutAction() public method

Logs all active tokens out. Override this, if you want to have some custom action here. You can always call the parent method to do the actual logout.
public logoutAction ( ) : void
return void

onAuthenticationFailure() protected method

Override this method in your login controller to take any custom action for this event. Most likely you would want to redirect to some action showing the login form again.
protected onAuthenticationFailure ( AuthenticationRequiredException $exception = null ) : void
$exception Neos\Flow\Security\Exception\AuthenticationRequiredException The exception thrown while the authentication process
return void

onAuthenticationSuccess() abstract protected method

if ($originalRequest !== NULL) { $this->redirectToRequest($originalRequest); } $this->redirect('someDefaultActionAfterLogin');
abstract protected onAuthenticationSuccess ( ActionRequest $originalRequest = null ) : string
$originalRequest Neos\Flow\Mvc\ActionRequest The request that was intercepted by the security framework, NULL if there was none
return string

Property Details

$authenticationManager protected_oe property

protected AuthenticationManagerInterface,Neos\Flow\Security\Authentication $authenticationManager
return Neos\Flow\Security\Authentication\AuthenticationManagerInterface

$securityContext protected_oe property

protected Context,Neos\Flow\Security $securityContext
return Neos\Flow\Security\Context