PHP Class Neos\Flow\Tests\Unit\Security\ContextTest

Inheritance: extends Neos\Flow\Tests\UnitTestCase
Afficher le fichier Open project: neos/flow-development-collection

Protected Properties

Свойство Type Description
$mockActionRequest Neos\Flow\Mvc\ActionRequest
$mockAuthenticationManager Neos\Flow\Security\Authentication\AuthenticationManagerInterface
$securityContext Neos\Flow\Security\Context

Méthodes publiques

Méthode Description
authenticationStrategies ( ) : array Data provider for authentication strategy settings
authenticationStrategyIsSetCorrectlyFromConfiguration ( $settings, $expectedAuthenticationStrategy )
authorizationChecksAreEnabledByDefault ( )
csrfProtectionStrategies ( ) : array Data provider for CSRF protection strategy settings
csrfProtectionStrategyIsSetCorrectlyFromConfiguration ( $settings, $expectedCsrfProtectionStrategy )
currentRequestIsSetInTheSecurityContext ( )
getAccountByAuthenticationProviderNameReturnsNullIfNoAccountFound ( )
getAccountByAuthenticationProviderNameReturnsTheAuthenticatedAccountWithGivenProviderName ( )
getAccountReturnsTheAccountAttachedToTheFirstAuthenticatedToken ( )
getContextHashInitializesSecurityContext ( )
getContextHashReturnsAHashOverAllAuthenticatedRoles ( )
getContextHashReturnsStaticStringIfAuthorizationChecksAreDisabled ( )
getContextHashReturnsStaticStringIfSecurityContextCantBeInitialized ( )
getCsrfProtectionTokenReturnsANewTokenIfNoneIsPresentInTheContext ( )
getCsrfProtectionTokenReturnsANewTokenIfTheCsrfStrategyIsOnePerUri ( )
getRolesReturnsTheAnonymousRoleIfNoTokenIsAuthenticated ( )
getRolesReturnsTheAuthenticatedUserRoleIfATokenIsAuthenticated ( )
getRolesReturnsTheCorrectRoles ( )
getRolesReturnsTheEverybodyRoleEvenIfNoTokenIsAuthenticated ( )
getRolesTakesInheritanceOfRolesIntoAccount ( )
hasRoleReturnsFalseForAnonymousRoleIfAuthenticated ( )
hasRoleReturnsTrueForAnonymousRoleIfNotAuthenticated ( )
hasRoleReturnsTrueForEverybodyRole ( )
hasRoleWorks ( )
hasRoleWorksWithRecursiveRoles ( )
initializeCallsUpdateCredentialsOnAllActiveTokens ( )
initializeSeparatesActiveAndInactiveTokens ( )
initializeUpdatesAndSeparatesActiveAndInactiveTokensCorrectly ( )
injectAuthenticationManagerSetsAReferenceToTheSecurityContextInTheAuthenticationManager ( )
invalidAuthenticationStrategyFromConfigurationThrowsException ( )
invalidCsrfProtectionStrategyFromConfigurationThrowsException ( )
isCsrfProtectionTokenValidChecksIfTheGivenTokenIsExistingInTheContext ( )
isCsrfProtectionTokenValidChecksIfTheGivenTokenIsExistingInTheContextAndUnsetsItIfTheCsrfStrategyIsOnePerUri ( )
securityContextCallsTheAuthenticationManagerToSetItsTokens ( )
securityContextIsNotInitializedAgainIfItHasBeenInitializedAlready ( ) initialize() might be called multiple times during one request. This might override roles and other data acquired from tokens / accounts, which have been initialized in a previous initialize() call. Therefore - and in order to save some processor cycles - initialization should only by executed once for a Context instance.
securityContextIsSetToInitialized ( )
separateActiveAndInactiveTokensDataProvider ( ) : array
separateActiveAndInactiveTokensTests ( array $patterns, boolean $expectedActive )
setUp ( ) Sets up this test case
tokenFromAnAuthenticationManagerIsReplacedIfThereIsOneOfTheSameTypeInTheSession ( )
withoutAuthorizationChecksDisabledAuthorizationChecks ( )
withoutAuthorizationChecksReactivatesAuthorizationCheckCorrectlyWhenCalledNested ( )
withoutAuthorizationChecksReactivatesAuthorizationChecksAfterClosureInvocation ( )
withoutAuthorizationChecksReactivatesAuthorizationChecksAfterClosureInvocationIfClosureThrowsException ( )

Method Details

authenticationStrategies() public méthode

Data provider for authentication strategy settings
public authenticationStrategies ( ) : array
Résultat array

authenticationStrategyIsSetCorrectlyFromConfiguration() public méthode

public authenticationStrategyIsSetCorrectlyFromConfiguration ( $settings, $expectedAuthenticationStrategy )

authorizationChecksAreEnabledByDefault() public méthode

csrfProtectionStrategies() public méthode

Data provider for CSRF protection strategy settings
public csrfProtectionStrategies ( ) : array
Résultat array

csrfProtectionStrategyIsSetCorrectlyFromConfiguration() public méthode

public csrfProtectionStrategyIsSetCorrectlyFromConfiguration ( $settings, $expectedCsrfProtectionStrategy )

currentRequestIsSetInTheSecurityContext() public méthode

getAccountByAuthenticationProviderNameReturnsNullIfNoAccountFound() public méthode

getAccountByAuthenticationProviderNameReturnsTheAuthenticatedAccountWithGivenProviderName() public méthode

getAccountReturnsTheAccountAttachedToTheFirstAuthenticatedToken() public méthode

getContextHashInitializesSecurityContext() public méthode

getContextHashReturnsAHashOverAllAuthenticatedRoles() public méthode

getContextHashReturnsStaticStringIfAuthorizationChecksAreDisabled() public méthode

getContextHashReturnsStaticStringIfSecurityContextCantBeInitialized() public méthode

getCsrfProtectionTokenReturnsANewTokenIfNoneIsPresentInTheContext() public méthode

getCsrfProtectionTokenReturnsANewTokenIfTheCsrfStrategyIsOnePerUri() public méthode

getRolesReturnsTheAnonymousRoleIfNoTokenIsAuthenticated() public méthode

getRolesReturnsTheAuthenticatedUserRoleIfATokenIsAuthenticated() public méthode

getRolesReturnsTheCorrectRoles() public méthode

getRolesReturnsTheEverybodyRoleEvenIfNoTokenIsAuthenticated() public méthode

getRolesTakesInheritanceOfRolesIntoAccount() public méthode

hasRoleReturnsFalseForAnonymousRoleIfAuthenticated() public méthode

hasRoleReturnsTrueForAnonymousRoleIfNotAuthenticated() public méthode

hasRoleReturnsTrueForEverybodyRole() public méthode

hasRoleWorks() public méthode

public hasRoleWorks ( )

hasRoleWorksWithRecursiveRoles() public méthode

initializeCallsUpdateCredentialsOnAllActiveTokens() public méthode

initializeSeparatesActiveAndInactiveTokens() public méthode

initializeUpdatesAndSeparatesActiveAndInactiveTokensCorrectly() public méthode

injectAuthenticationManagerSetsAReferenceToTheSecurityContextInTheAuthenticationManager() public méthode

invalidAuthenticationStrategyFromConfigurationThrowsException() public méthode

invalidCsrfProtectionStrategyFromConfigurationThrowsException() public méthode

isCsrfProtectionTokenValidChecksIfTheGivenTokenIsExistingInTheContext() public méthode

isCsrfProtectionTokenValidChecksIfTheGivenTokenIsExistingInTheContextAndUnsetsItIfTheCsrfStrategyIsOnePerUri() public méthode

securityContextCallsTheAuthenticationManagerToSetItsTokens() public méthode

securityContextIsNotInitializedAgainIfItHasBeenInitializedAlready() public méthode

initialize() might be called multiple times during one request. This might override roles and other data acquired from tokens / accounts, which have been initialized in a previous initialize() call. Therefore - and in order to save some processor cycles - initialization should only by executed once for a Context instance.

securityContextIsSetToInitialized() public méthode

separateActiveAndInactiveTokensDataProvider() public méthode

separateActiveAndInactiveTokensTests() public méthode

public separateActiveAndInactiveTokensTests ( array $patterns, boolean $expectedActive )
$patterns array
$expectedActive boolean

setUp() public méthode

Sets up this test case
public setUp ( )

tokenFromAnAuthenticationManagerIsReplacedIfThereIsOneOfTheSameTypeInTheSession() public méthode

withoutAuthorizationChecksDisabledAuthorizationChecks() public méthode

withoutAuthorizationChecksReactivatesAuthorizationCheckCorrectlyWhenCalledNested() public méthode

withoutAuthorizationChecksReactivatesAuthorizationChecksAfterClosureInvocation() public méthode

withoutAuthorizationChecksReactivatesAuthorizationChecksAfterClosureInvocationIfClosureThrowsException() public méthode

Property Details

$mockActionRequest protected_oe property

protected ActionRequest,Neos\Flow\Mvc $mockActionRequest
Résultat Neos\Flow\Mvc\ActionRequest

$mockAuthenticationManager protected_oe property

protected AuthenticationManagerInterface,Neos\Flow\Security\Authentication $mockAuthenticationManager
Résultat Neos\Flow\Security\Authentication\AuthenticationManagerInterface

$securityContext protected_oe property

protected Context,Neos\Flow\Security $securityContext
Résultat Neos\Flow\Security\Context