class SecurityCommandController extends CommandController (View source)

Command controller for tasks related to security

Properties

protected Request $request from  CommandController
protected Response $response from  CommandController
protected Arguments $arguments from  CommandController
protected string $commandMethodName

Name of the command method

from  CommandController
protected ObjectManagerInterface $objectManager
protected CommandManager $commandManager from  CommandController
protected ConsoleOutput $output from  CommandController
protected ReflectionService $reflectionService
protected RsaWalletServicePhp $rsaWalletService
protected PolicyService $policyService
protected VariableFrontend $methodPermissionCache

Methods

__construct()

Constructs the command controller

void
injectCommandManager(CommandManager $commandManager)

No description

void
injectObjectManager(ObjectManagerInterface $objectManager)

Injects the reflection service

void
processRequest(Request $request, Response $response)

Processes a command line request.

string
resolveCommandMethodName()

Resolves and checks the current command method name

void
initializeCommandMethodArguments()

Initializes the arguments array of this controller by creating an empty argument object for each of the method arguments found in the designated command method.

void
mapRequestArgumentsToControllerArguments()

Maps arguments delivered by the request object to the local controller arguments.

void
forward(string $commandName, string $controllerObjectName = null, array $arguments = [])

Forwards the request to another command and / or CommandController.

void
callCommandMethod()

Calls the specified command method and passes the arguments.

string
getFlowInvocationString()

Returns the CLI Flow command depending on the environment

void
output(string $text, array $arguments = [])

Outputs specified text to the console window You can specify arguments that will be passed to the text via sprintf

void
outputLine(string $text = '', array $arguments = [])

Outputs specified text to the console window and appends a line break

void
outputFormatted(string $text = '', array $arguments = [], int $leftPadding = 0)

Formats the given text to fit into MAXIMUM_LINE_LENGTH and outputs it to the console window

void
quit(int $exitCode = 0)

Exits the CLI through the dispatcher and makes sure that Flow is properly shut down.

void
sendAndExit(int $exitCode = 0)

Sends the response and exits the CLI without any further code execution Should be used for commands that flush code caches.

void
injectCacheManager(CacheManager $cacheManager)

Injects the Cache Manager because we cannot inject an automatically factored cache during compile time.

void
importPublicKeyCommand()

Import a public key

void
generateKeyPairCommand(bool $usedForPasswords = false)

Generate a public/private key pair and add it to the RSAWalletService

void
importPrivateKeyCommand(bool $usedForPasswords = false)

Import a private key

showEffectivePolicyCommand(string $privilegeType, string $roles = '')

Shows a list of all defined privilege targets and the effective permissions

void
showUnprotectedActionsCommand()

Lists all public controller actions not covered by the active security policy

void
showMethodsForPrivilegeTargetCommand(string $privilegeTarget)

Shows the methods represented by the given security privilege target

void
listRolesCommand(bool $includeAbstract = false)

List all configured roles

void
describeRoleCommand(string $role)

Show details of a specified role

Details

__construct()

Constructs the command controller

void injectCommandManager(CommandManager $commandManager)

No description

Parameters

CommandManager $commandManager

Return Value

void

void injectObjectManager(ObjectManagerInterface $objectManager)

Injects the reflection service

Parameters

ObjectManagerInterface $objectManager

Return Value

void

void processRequest(Request $request, Response $response)

Processes a command line request.

Parameters

Request $request

The request object

Response $response

The response, modified by the controller

Return Value

void

Exceptions

InvalidArgumentTypeException
NoSuchCommandException

protected string resolveCommandMethodName()

Resolves and checks the current command method name

Note: The resulting command method name might not have the correct case, which isn't a problem because PHP is case insensitive regarding method names.

Return Value

string

Method name of the current command

Exceptions

NoSuchCommandException

protected void initializeCommandMethodArguments()

Initializes the arguments array of this controller by creating an empty argument object for each of the method arguments found in the designated command method.

Return Value

void

Exceptions

InvalidArgumentTypeException

protected void mapRequestArgumentsToControllerArguments()

Maps arguments delivered by the request object to the local controller arguments.

Return Value

void

protected void forward(string $commandName, string $controllerObjectName = null, array $arguments = [])

Forwards the request to another command and / or CommandController.

Request is directly transferred to the other command / controller without the need for a new request.

Parameters

string $commandName
string $controllerObjectName
array $arguments

Return Value

void

Exceptions

StopCommandException

protected void callCommandMethod()

Calls the specified command method and passes the arguments.

If the command returns a string, it is appended to the content in the response object. If the command doesn't return anything and a valid view exists, the view is rendered automatically.

Return Value

void

string getFlowInvocationString()

Returns the CLI Flow command depending on the environment

Return Value

string

protected void output(string $text, array $arguments = [])

Outputs specified text to the console window You can specify arguments that will be passed to the text via sprintf

Parameters

string $text

Text to output

array $arguments

Optional arguments to use for sprintf

Return Value

void

See also

http://www.php.net/sprintf

protected void outputLine(string $text = '', array $arguments = [])

Outputs specified text to the console window and appends a line break

Parameters

string $text

Text to output

array $arguments

Optional arguments to use for sprintf

Return Value

void

See also

output()
outputLines()

protected void outputFormatted(string $text = '', array $arguments = [], int $leftPadding = 0)

Formats the given text to fit into MAXIMUM_LINE_LENGTH and outputs it to the console window

Parameters

string $text

Text to output

array $arguments

Optional arguments to use for sprintf

int $leftPadding

The number of spaces to use for indentation

Return Value

void

See also

outputLine()

protected void quit(int $exitCode = 0)

Exits the CLI through the dispatcher and makes sure that Flow is properly shut down.

If your command relies on functionality which is triggered through the Bootstrap shutdown (such as the persistence framework), you must use quit() instead of exit().

Parameters

int $exitCode

Exit code to return on exit (see http://www.php.net/exit)

Return Value

void

Exceptions

StopCommandException

protected void sendAndExit(int $exitCode = 0)

Sends the response and exits the CLI without any further code execution Should be used for commands that flush code caches.

Parameters

int $exitCode

Exit code to return on exit

Return Value

void

void injectCacheManager(CacheManager $cacheManager)

Injects the Cache Manager because we cannot inject an automatically factored cache during compile time.

Parameters

CacheManager $cacheManager

Return Value

void

void importPublicKeyCommand()

Import a public key

Read a PEM formatted public key from stdin and import it into the RSAWalletService.

Return Value

void

See also

neos.flow:security:importprivatekey

void generateKeyPairCommand(bool $usedForPasswords = false)

Generate a public/private key pair and add it to the RSAWalletService

Parameters

bool $usedForPasswords

If the private key should be used for passwords

Return Value

void

See also

neos.flow:security:importprivatekey

void importPrivateKeyCommand(bool $usedForPasswords = false)

Import a private key

Read a PEM formatted private key from stdin and import it into the RSAWalletService. The public key will be automatically extracted and stored together with the private key as a key pair.

You can generate the same fingerprint returned from this using these commands:

ssh-keygen -yf my-key.pem > my-key.pub ssh-keygen -lf my-key.pub

To create a private key to import using this method, you can use:

ssh-keygen -t rsa -f my-key ./flow security:importprivatekey < my-key

Again, the fingerprint can also be generated using:

ssh-keygen -lf my-key.pub

Parameters

bool $usedForPasswords

If the private key should be used for passwords

Return Value

void

See also

neos.flow:security:importpublickey
neos.flow:security:generatekeypair

showEffectivePolicyCommand(string $privilegeType, string $roles = '')

Shows a list of all defined privilege targets and the effective permissions

Parameters

string $privilegeType

The privilege type ("entity", "method" or the FQN of a class implementing PrivilegeInterface)

string $roles

A comma separated list of role identifiers. Shows policy for an unauthenticated user when left empty.

void showUnprotectedActionsCommand()

Lists all public controller actions not covered by the active security policy

Return Value

void

void showMethodsForPrivilegeTargetCommand(string $privilegeTarget)

Shows the methods represented by the given security privilege target

If the privilege target has parameters those can be specified separated by a colon for example "parameter1:value1" "parameter2:value2". But be aware that this only works for parameters that have been specified in the policy

Parameters

string $privilegeTarget

The name of the privilegeTarget as stated in the policy

Return Value

void

void listRolesCommand(bool $includeAbstract = false)

List all configured roles

Parameters

bool $includeAbstract

Set this flag to include abstract roles

Return Value

void

Exceptions

InvalidConfigurationTypeException

void describeRoleCommand(string $role)

Show details of a specified role

Parameters

string $role

identifier of the role to describe (for example "Neos.Flow:Everybody")

Return Value

void

Exceptions

InvalidConfigurationTypeException